aboutsummaryrefslogtreecommitdiff
path: root/src/storage
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2023-10-30 18:07:40 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2023-10-30 18:07:40 +0100
commit0a76db1b8cf6a7d7180d35fbfae82e135e7fbf59 (patch)
treed24e7e81ba11e00bda486a1c03325aff74a4c0f0 /src/storage
parent609dde413972ebeeb8cd658a5ec9f62b34b5c402 (diff)
downloadaerogramme-0a76db1b8cf6a7d7180d35fbfae82e135e7fbf59.tar.gz
aerogramme-0a76db1b8cf6a7d7180d35fbfae82e135e7fbf59.zip
WIP traits for the storage
Diffstat (limited to 'src/storage')
-rw-r--r--src/storage/mod.rs32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/storage/mod.rs b/src/storage/mod.rs
new file mode 100644
index 0000000..399a416
--- /dev/null
+++ b/src/storage/mod.rs
@@ -0,0 +1,32 @@
+pub trait RowStore<K: RowRef, E> {
+ fn new_row_ref(partition: &str, sort: &str) -> K<E>;
+}
+
+pub trait RowRef {
+ fn set_value(&self, content: &[u8]) -> RowValue;
+ async fn get(&self) -> Result<RowValue, E>;
+ async fn rm(&self) -> Result<(), E>;
+ async fn obs(&self) -> Result<Option<RowValue>, ()>;
+}
+
+pub trait RowValue {
+ fn row_ref(&self) -> RowRef;
+ fn content(&self) -> Vec<u8>;
+ async fn put(&self) -> Result<(), E>;
+}
+
+/*
+ async fn get_many_keys(&self, keys: &[K]) -> Result<Vec<V>, ()>;
+ async fn put_many_keys(&self, values: &[V]) -> Result<(), ()>;
+}*/
+
+pub trait BlobStore {
+ fn new_blob_ref(key: &str) -> BlobRef;
+ async fn list(&self) -> ();
+}
+
+pub trait BlobRef {
+ async fn put(&self, key: &str, body: &[u8]) -> ();
+ async fn copy(&self, dst: &BlobRef) -> ();
+ async fn rm(&self, key: &str);
+}