aboutsummaryrefslogtreecommitdiff
path: root/src/storage/mod.rs
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2023-11-02 15:28:19 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2023-11-02 15:28:19 +0100
commita65f5b25894faa9802d274beb394f40062c65bae (patch)
tree990e3f3cb1a9d9eb3bbaa62bc16049ef9524d6e6 /src/storage/mod.rs
parent1e192f93d5bf544c82fe91fb799d77e8b5d53afe (diff)
downloadaerogramme-a65f5b25894faa9802d274beb394f40062c65bae.tar.gz
aerogramme-a65f5b25894faa9802d274beb394f40062c65bae.zip
WIP rewrite mail/incoming
Diffstat (limited to 'src/storage/mod.rs')
-rw-r--r--src/storage/mod.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/storage/mod.rs b/src/storage/mod.rs
index 3e66e84..c5ed1f8 100644
--- a/src/storage/mod.rs
+++ b/src/storage/mod.rs
@@ -83,12 +83,18 @@ pub type RowStore = Box<dyn IRowStore + Sync + Send>;
pub trait IRowRef
{
+ fn clone_boxed(&self) -> RowRef;
fn set_value(&self, content: Vec<u8>) -> RowValue;
fn fetch(&self) -> AsyncResult<RowValue>;
fn rm(&self) -> AsyncResult<()>;
- fn poll(&self) -> AsyncResult<Option<RowValue>>;
+ fn poll(&self) -> AsyncResult<RowValue>;
}
pub type RowRef = Box<dyn IRowRef + Send + Sync>;
+impl Clone for RowRef {
+ fn clone(&self) -> Self {
+ return self.clone_boxed()
+ }
+}
pub trait IRowValue
{
@@ -101,14 +107,15 @@ pub type RowValue = Box<dyn IRowValue + Send + Sync>;
// ------- Blob
pub trait IBlobStore
{
- fn new_blob(&self, key: &str) -> BlobRef;
- fn list(&self) -> AsyncResult<Vec<BlobRef>>;
+ fn blob(&self, key: &str) -> BlobRef;
+ fn list(&self, prefix: &str) -> AsyncResult<Vec<BlobRef>>;
}
pub type BlobStore = Box<dyn IBlobStore + Send + Sync>;
pub trait IBlobRef
{
fn set_value(&self, content: Vec<u8>) -> BlobValue;
+ fn key(&self) -> &str;
fn fetch(&self) -> AsyncResult<BlobValue>;
fn copy(&self, dst: &BlobRef) -> AsyncResult<()>;
fn rm(&self) -> AsyncResult<()>;
@@ -117,6 +124,8 @@ pub type BlobRef = Box<dyn IBlobRef + Send + Sync>;
pub trait IBlobValue {
fn to_ref(&self) -> BlobRef;
+ fn get_meta(&self, key: &str) -> Option<&[u8]>;
+ fn content(&self) -> Option<&[u8]>;
fn push(&self) -> AsyncResult<()>;
}
pub type BlobValue = Box<dyn IBlobValue + Send + Sync>;