aboutsummaryrefslogtreecommitdiff
path: root/src/storage/garage.rs
diff options
context:
space:
mode:
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!();