aboutsummaryrefslogtreecommitdiff
path: root/src/storage/garage.rs
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2023-12-18 17:09:44 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2023-12-18 17:09:44 +0100
commit3d41f40dc8cd6bdfa7a9279ab1959564d06eefaf (patch)
treefff5d16e266788b28e812c24669f50118831512b /src/storage/garage.rs
parent684f4de225c44464abcb6a9cb2ef6dcae90537a8 (diff)
downloadaerogramme-3d41f40dc8cd6bdfa7a9279ab1959564d06eefaf.tar.gz
aerogramme-3d41f40dc8cd6bdfa7a9279ab1959564d06eefaf.zip
Storage trait new implementation
Diffstat (limited to 'src/storage/garage.rs')
-rw-r--r--src/storage/garage.rs30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/storage/garage.rs b/src/storage/garage.rs
index 8276f70..ff37287 100644
--- a/src/storage/garage.rs
+++ b/src/storage/garage.rs
@@ -1,7 +1,8 @@
use crate::storage::*;
+use serde::Serialize;
-#[derive(Clone, Debug, Hash)]
-pub struct GarageBuilder {
+#[derive(Clone, Debug, Serialize)]
+pub struct GarageConf {
pub region: String,
pub s3_endpoint: String,
pub k2v_endpoint: String,
@@ -10,10 +11,28 @@ pub struct GarageBuilder {
pub bucket: String,
}
+#[derive(Clone, Debug)]
+pub struct GarageBuilder {
+ conf: GarageConf,
+ unicity: Vec<u8>,
+}
+
+impl GarageBuilder {
+ pub fn new(conf: GarageConf) -> anyhow::Result<Arc<Self>> {
+ let mut unicity: Vec<u8> = vec![];
+ unicity.extend_from_slice(file!().as_bytes());
+ unicity.append(&mut rmp_serde::to_vec(&conf)?);
+ Ok(Arc::new(Self { conf, unicity }))
+ }
+}
+
impl IBuilder for GarageBuilder {
- fn build(&self) -> Box<dyn IStore> {
+ fn build(&self) -> Result<Store, StorageError> {
unimplemented!();
}
+ fn unique(&self) -> UnicityBuffer {
+ UnicityBuffer(self.unicity.clone())
+ }
}
pub struct GarageStore {
@@ -33,7 +52,7 @@ impl IStore for GarageStore {
unimplemented!();
}
- async fn row_poll(&self, value: RowRef) -> Result<RowVal, StorageError> {
+ async fn row_poll(&self, value: &RowRef) -> Result<RowVal, StorageError> {
unimplemented!();
}
@@ -41,6 +60,9 @@ impl IStore for GarageStore {
unimplemented!();
}
+ async fn blob_insert(&self, blob_val: &BlobVal) -> Result<BlobVal, StorageError> {
+ unimplemented!();
+ }
async fn blob_copy(&self, src: &BlobRef, dst: &BlobRef) -> Result<BlobVal, StorageError> {
unimplemented!();