Initial version

This commit is contained in:
2019-07-17 18:50:48 +02:00
parent 3155089a1e
commit 63b2e539d6
4 changed files with 86 additions and 0 deletions

4
Cargo.lock generated Normal file
View File

@@ -0,0 +1,4 @@
[[package]]
name = "ironsea_index"
version = "0.1.0"

22
Cargo.toml Normal file
View File

@@ -0,0 +1,22 @@
[package]
name = "ironsea_index"
version = "0.1.0"
authors = ["EPFL-DIAS", "Lionel Sambuc <lionel.sambuc@epfl.ch>"]
edition = "2018"
description = "Traits definitions for the Iron Sea database toolkit indices."
homepage = "https://crates.io/crates/ironsea_index"
repository = "https://github.com/epfl-dias/ironsea_index"
readme = "README.md"
keywords = []
categories = ["database-implementations", "data-structures"]
license = "MIT"
#license-file = "LICENSE"
include = ["Cargo.toml", "README.md", "LICENSE", "ACKNOWLEDGEMENTS", "src/**/*.rs"]
[dependencies]
ironsea_table = "^0.1"

35
README.md Normal file
View File

@@ -0,0 +1,35 @@
# Iron Sea - Index
## Introduction
This repository contains the traits definitions for the Iron Sea database toolkit indices.
## Iron Sea: Database Toolkit
**Iron Sea** provides a set of database engine bricks, which can be combined and applied on arbitrary data structures.
Unlike a traditional database, it does not assume a specific physical structure for the tables nor the records, but relies on the developper to provide a set of extractor functions which are used by the specific indices provided.
This enables the index implementations to be agnostic from the underlying data structure, and re-used.
## Requirements
### Software
* Rust: https://www.rust-lang.org
## Documentation
For more information, please refer to the [documentation](https://epfl-dias.github.io/ironsea_index).
If you want to build the documentation and access it locally, you can use:
```sh
cargo doc --open
```
## Acknowledgements
This open source software code was developed in part or in whole in the
Human Brain Project, funded from the European Unions Horizon 2020
Framework Programme for Research and Innovation under the Specific Grant
Agreement No. 785907 (Human Brain Project SGA2).

25
src/lib.rs Normal file
View File

@@ -0,0 +1,25 @@
use ironsea_table::Table;
pub trait Record<K> {
fn key(&self) -> K; // Extract key from record.
}
pub trait RecordFields<F> {
fn fields(&self) -> F;
}
pub trait RecordBuild<K, F, R> {
fn build(key: &K, fields: &F) -> R;
}
pub trait Indexed<T: Table<R>, R: Record<K>, K> {
fn find(&self, key: &K) -> Vec<&R>;
fn find_range(&self, start: &K, end: &K) -> Vec<&R>;
}
pub trait IndexedOwned<T: Table<R>, R: Record<K>, K> {
fn find(&self, key: &K) -> Vec<R>;
fn find_range(&self, start: &K, end: &K) -> Vec<R>;
}