Initial version
This commit is contained in:
4
Cargo.lock
generated
Normal file
4
Cargo.lock
generated
Normal file
@@ -0,0 +1,4 @@
|
||||
[[package]]
|
||||
name = "ironsea_index"
|
||||
version = "0.1.0"
|
||||
|
||||
22
Cargo.toml
Normal file
22
Cargo.toml
Normal 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
35
README.md
Normal 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 Union’s 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
25
src/lib.rs
Normal 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>;
|
||||
}
|
||||
Reference in New Issue
Block a user