b-table

A persistent database table based on b-tree, with support for multiple indices.

Example usage: ```rust use b_table::{Collator, Schema, TableLock};

enum ColumnValue { U64(u64), Str(String), }

...

// note: b-table provides a Schema trait but not a struct which implements it let schema = Schema::new( ["zero", "one", "two", "value"], [ ("indexone", ["one", "zero", "two"]), ("indextwo", ["two", "zero", "one"]), ] );

let key: Vec = vec![0.into(), 0.into(), 0.into()]; let value: Vec = vec!["value".into()];

let table = TableLock::create(schema, Collator::new(), dir)?;

{ let mut table = table.write().await; // or table.trywrite()? table.upsert(key.clone(), value.clone()).await?; asserteq!(table.get_value(key.clone())).await?, Ok(Some(value.clone())); }

let mut expectedrow = key; expectedrow.extend(value);

{ let order = &["two", "one", "zero"]; let range = [("one", 0)].intoiter().collect(); let table = table.read().await; // or table.tryread()? let mut rows = table.rows(order, range, Some(&["value"]))?; asserteq!(rows.trynext().await, Ok(Some(expected_row))); } ```