From 6da8b815b694a37d39a2be04c8e1585aac17954a Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Thu, 16 Nov 2023 18:27:24 +0100 Subject: not very clear how we pass data across channel --- src/storage/mod.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/storage/mod.rs') diff --git a/src/storage/mod.rs b/src/storage/mod.rs index c3bf19f..2e3c0ee 100644 --- a/src/storage/mod.rs +++ b/src/storage/mod.rs @@ -21,9 +21,9 @@ pub enum Alternative { type ConcurrentValues = Vec; pub enum Selector<'a> { - Range { begin: &'a str, end: &'a str }, - List (Vec<(&'a str, &'a str)>), - Prefix (&'a str), + Range { shard_key: &'a str, begin: &'a str, end: &'a str }, + List (Vec<(&'a str, &'a str)>), // list of (shard_key, sort_key) + Prefix { shard_key: &'a str, prefix: &'a str }, } #[derive(Debug)] @@ -80,12 +80,14 @@ pub trait IRowStore { fn row(&self, partition: &str, sort: &str) -> RowRef; fn select(&self, selector: Selector) -> AsyncResult>; + fn rm(&self, selector: Selector) -> AsyncResult<()>; } pub type RowStore = Box; pub trait IRowRef { - fn clone_boxed(&self) -> RowRef; + /*fn clone_boxed(&self) -> RowRef;*/ + fn to_orphan(&self) -> RowRefOrphan; fn key(&self) -> (&str, &str); fn set_value(&self, content: Vec) -> RowValue; fn fetch(&self) -> AsyncResult; @@ -93,11 +95,17 @@ pub trait IRowRef fn poll(&self) -> AsyncResult; } pub type RowRef = Box; -impl Clone for RowRef { +/*impl Clone for RowRef { fn clone(&self) -> Self { return self.clone_boxed() } +}*/ + +pub trait IRowRefOrphan +{ + fn attach(&self, store: &RowStore) -> RowRef; } +pub type RowRefOrphan = Box; pub trait IRowValue { -- cgit v1.2.3