/* * * This abstraction goal is to leverage all the semantic of Garage K2V+S3, * to be as tailored as possible to it ; it aims to be a zero-cost abstraction * compared to when we where directly using the K2V+S3 client. * * My idea: we can encapsulate the causality token * into the object system so it is not exposed. */ mod in_memory; mod garage; pub enum Selector<'a> { Range{ begin: &'a str, end: &'a str }, Filter(u64), } pub enum Alternative { Tombstone, Value(Vec), } type ConcurrentValues = Vec; #[derive(Debug)] pub enum Error { NotFound, Internal, } pub trait RowRealization: Sized { type Store: RowStore; type Ref: RowRef; type Value: RowValue; } // ------ Row Builder pub trait RowBuilder { fn row_store(&self) -> R::Store; } // ------ Row Store pub trait RowStore { fn new_row(&self, partition: &str, sort: &str) -> R::Ref; } // ------- Row Item pub trait RowRef { fn set_value(&self, content: Vec) -> R::Value; async fn fetch(&self) -> Result; async fn rm(&self) -> Result<(), Error>; async fn poll(&self) -> Result, Error>; } pub trait RowValue { fn to_ref(&self) -> R::Ref; fn content(&self) -> ConcurrentValues; async fn push(&self) -> Result<(), Error>; }