From 63b2e539d6561bc6c6cebf62e564fd77e9942bb6 Mon Sep 17 00:00:00 2001 From: Lionel Sambuc Date: Wed, 17 Jul 2019 18:50:48 +0200 Subject: [PATCH] Initial version --- Cargo.lock | 4 ++++ Cargo.toml | 22 ++++++++++++++++++++++ README.md | 35 +++++++++++++++++++++++++++++++++++ src/lib.rs | 25 +++++++++++++++++++++++++ 4 files changed, 86 insertions(+) create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 README.md create mode 100644 src/lib.rs diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..0af2be3 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,4 @@ +[[package]] +name = "ironsea_index" +version = "0.1.0" + diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..0e744f4 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "ironsea_index" +version = "0.1.0" +authors = ["EPFL-DIAS", "Lionel Sambuc "] + +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" diff --git a/README.md b/README.md new file mode 100644 index 0000000..87bd430 --- /dev/null +++ b/README.md @@ -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). diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..5f0b77f --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,25 @@ +use ironsea_table::Table; + +pub trait Record { + fn key(&self) -> K; // Extract key from record. +} + +pub trait RecordFields { + fn fields(&self) -> F; +} + +pub trait RecordBuild { + fn build(key: &K, fields: &F) -> R; +} + +pub trait Indexed, R: Record, K> { + fn find(&self, key: &K) -> Vec<&R>; + + fn find_range(&self, start: &K, end: &K) -> Vec<&R>; +} + +pub trait IndexedOwned, R: Record, K> { + fn find(&self, key: &K) -> Vec; + + fn find_range(&self, start: &K, end: &K) -> Vec; +}