aboutsummaryrefslogtreecommitdiff
path: root/src/storage
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2023-11-16 18:27:24 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2023-11-16 18:27:24 +0100
commit6da8b815b694a37d39a2be04c8e1585aac17954a (patch)
treec9df6389e4272e91de9131a8fbf2b8fe6df3eaf0 /src/storage
parent916b27d87ec7f5bff41f9dd888914d50ae067fc0 (diff)
downloadaerogramme-6da8b815b694a37d39a2be04c8e1585aac17954a.tar.gz
aerogramme-6da8b815b694a37d39a2be04c8e1585aac17954a.zip
not very clear how we pass data across channel
Diffstat (limited to 'src/storage')
-rw-r--r--src/storage/garage.rs9
-rw-r--r--src/storage/in_memory.rs4
-rw-r--r--src/storage/mod.rs18
3 files changed, 25 insertions, 6 deletions
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<Vec<RowValue>> {
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<Vec<RowValue>> {
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<Alternative>;
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<Vec<RowValue>>;
+ fn rm(&self, selector: Selector) -> AsyncResult<()>;
}
pub type RowStore = Box<dyn IRowStore + Sync + Send>;
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<u8>) -> RowValue;
fn fetch(&self) -> AsyncResult<RowValue>;
@@ -93,11 +95,17 @@ pub trait IRowRef
fn poll(&self) -> AsyncResult<RowValue>;
}
pub type RowRef = Box<dyn IRowRef + Send + Sync>;
-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<dyn IRowRefOrphan + Send + Sync>;
pub trait IRowValue
{