From 8ac3a8ce8ba268a3261e23694b8b62afa6a3ae37 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Wed, 1 Nov 2023 16:45:29 +0100 Subject: implement an AnyCredentials --- src/storage/garage.rs | 3 ++- src/storage/in_memory.rs | 3 ++- src/storage/mod.rs | 14 ++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/storage') 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; +pub trait Sto: Sized { + type Builder: RowStore; type Store: RowStore; type Ref: RowRef; type Value: RowValue; } -pub trait StorageEngine: RowRealization {} - // ------ Row Builder -pub trait RowBuilder +pub trait RowBuilder { fn row_store(&self) -> R::Store; } // ------ Row Store -pub trait RowStore +pub trait RowStore { fn new_row(&self, partition: &str, sort: &str) -> R::Ref; } // ------- Row Item -pub trait RowRef +pub trait RowRef { fn set_value(&self, content: Vec) -> R::Value; async fn fetch(&self) -> Result; @@ -58,7 +56,7 @@ pub trait RowRef async fn poll(&self) -> Result, Error>; } -pub trait RowValue +pub trait RowValue { fn to_ref(&self) -> R::Ref; fn content(&self) -> ConcurrentValues; -- cgit v1.2.3