diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2023-11-01 16:45:29 +0100 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2023-11-01 16:45:29 +0100 |
commit | 8ac3a8ce8ba268a3261e23694b8b62afa6a3ae37 (patch) | |
tree | 0ffa2cf006c592f184df693f216ebcaeb07c2876 /src/storage | |
parent | 3026b217774a51e01cca1ae584fba8c6398754cc (diff) | |
download | aerogramme-8ac3a8ce8ba268a3261e23694b8b62afa6a3ae37.tar.gz aerogramme-8ac3a8ce8ba268a3261e23694b8b62afa6a3ae37.zip |
implement an AnyCredentials
Diffstat (limited to 'src/storage')
-rw-r--r-- | src/storage/garage.rs | 3 | ||||
-rw-r--r-- | src/storage/in_memory.rs | 3 | ||||
-rw-r--r-- | src/storage/mod.rs | 14 |
3 files changed, 10 insertions, 10 deletions
diff --git a/src/storage/garage.rs b/src/storage/garage.rs index 91c4fa2..b883623 100644 --- a/src/storage/garage.rs +++ b/src/storage/garage.rs @@ -6,7 +6,8 @@ pub struct GrgRef {} pub struct GrgValue {} pub struct GrgTypes {} -impl RowRealization for GrgTypes { +impl Sto for GrgTypes { + type Builder=GrgCreds; type Store=GrgStore; type Ref=GrgRef; type Value=GrgValue; diff --git a/src/storage/in_memory.rs b/src/storage/in_memory.rs index a2e9e96..56df266 100644 --- a/src/storage/in_memory.rs +++ b/src/storage/in_memory.rs @@ -6,7 +6,8 @@ pub struct MemRef {} pub struct MemValue {} pub struct MemTypes {} -impl RowRealization for MemTypes { +impl Sto for MemTypes { + type Builder=MemCreds; type Store=MemStore; type Ref=MemRef; type Value=MemValue; diff --git a/src/storage/mod.rs b/src/storage/mod.rs index bc26379..2e4f757 100644 --- a/src/storage/mod.rs +++ b/src/storage/mod.rs @@ -28,29 +28,27 @@ pub enum Error { Internal, } -pub trait RowRealization: Sized { - type Builder: RowBuilder<Self>; +pub trait Sto: Sized { + type Builder: RowStore<Self>; type Store: RowStore<Self>; type Ref: RowRef<Self>; type Value: RowValue<Self>; } -pub trait StorageEngine: RowRealization {} - // ------ Row Builder -pub trait RowBuilder<R: RowRealization> +pub trait RowBuilder<R: Sto> { fn row_store(&self) -> R::Store; } // ------ Row Store -pub trait RowStore<R: RowRealization> +pub trait RowStore<R: Sto> { fn new_row(&self, partition: &str, sort: &str) -> R::Ref; } // ------- Row Item -pub trait RowRef<R: RowRealization> +pub trait RowRef<R: Sto> { fn set_value(&self, content: Vec<u8>) -> R::Value; async fn fetch(&self) -> Result<R::Value, Error>; @@ -58,7 +56,7 @@ pub trait RowRef<R: RowRealization> async fn poll(&self) -> Result<Option<R::Value>, Error>; } -pub trait RowValue<R: RowRealization> +pub trait RowValue<R: Sto> { fn to_ref(&self) -> R::Ref; fn content(&self) -> ConcurrentValues; |