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/garage.rs | 9 ++++++++- src/storage/in_memory.rs | 4 ++++ src/storage/mod.rs | 18 +++++++++++++----- 3 files changed, 25 insertions(+), 6 deletions(-) (limited to 'src/storage') diff --git a/src/storage/garage.rs b/src/storage/garage.rs index 0abeb4d..aef9a0d 100644 --- a/src/storage/garage.rs +++ b/src/storage/garage.rs @@ -28,11 +28,18 @@ impl IRowStore for GrgStore { fn select(&self, selector: Selector) -> AsyncResult> { unimplemented!(); } + + fn rm(&self, selector: Selector) -> AsyncResult<()> { + unimplemented!(); + } } impl IRowRef for GrgRef { - fn clone_boxed(&self) -> RowRef { + /*fn clone_boxed(&self) -> RowRef { unimplemented!(); + }*/ + fn to_orphan(&self) -> RowRefOrphan { + unimplemented!() } fn key(&self) -> (&str, &str) { diff --git a/src/storage/in_memory.rs b/src/storage/in_memory.rs index 8db4eff..a4436e6 100644 --- a/src/storage/in_memory.rs +++ b/src/storage/in_memory.rs @@ -29,6 +29,10 @@ impl IRowStore for MemStore { fn select(&self, selector: Selector) -> AsyncResult> { unimplemented!(); } + + fn rm(&self, selector: Selector) -> AsyncResult<()> { + unimplemented!(); + } } impl IRowRef for MemRef { 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