aboutsummaryrefslogtreecommitdiff
path: root/src/storage/garage.rs
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2023-12-16 11:13:32 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2023-12-16 11:13:32 +0100
commit684f4de225c44464abcb6a9cb2ef6dcae90537a8 (patch)
treecbbc9ba773ed3d9f8f011637d58791af79672774 /src/storage/garage.rs
parent1b5f2eb695d658c57ba9c4264e76ca13bd82a958 (diff)
downloadaerogramme-684f4de225c44464abcb6a9cb2ef6dcae90537a8.tar.gz
aerogramme-684f4de225c44464abcb6a9cb2ef6dcae90537a8.zip
new new new storage interface
Diffstat (limited to 'src/storage/garage.rs')
-rw-r--r--src/storage/garage.rs118
1 files changed, 16 insertions, 102 deletions
diff --git a/src/storage/garage.rs b/src/storage/garage.rs
index 052e812..8276f70 100644
--- a/src/storage/garage.rs
+++ b/src/storage/garage.rs
@@ -1,7 +1,7 @@
use crate::storage::*;
#[derive(Clone, Debug, Hash)]
-pub struct GrgCreds {
+pub struct GarageBuilder {
pub region: String,
pub s3_endpoint: String,
pub k2v_endpoint: String,
@@ -9,133 +9,47 @@ pub struct GrgCreds {
pub aws_secret_access_key: String,
pub bucket: String,
}
-pub struct GrgStore {}
-pub struct GrgRef {}
-pub struct GrgValue {}
-#[derive(Clone, Debug, PartialEq)]
-pub struct GrgOrphanRowRef {}
-
-impl IBuilders for GrgCreds {
- fn row_store(&self) -> Result<RowStore, StorageError> {
- unimplemented!();
- }
-
- fn blob_store(&self) -> Result<BlobStore, StorageError> {
+impl IBuilder for GarageBuilder {
+ fn build(&self) -> Box<dyn IStore> {
unimplemented!();
}
+}
- fn url(&self) -> &str {
- return "grg://unimplemented;"
- }
+pub struct GarageStore {
+ dummy: String,
}
-impl IRowStore for GrgStore {
- fn row(&self, partition: &str, sort: &str) -> RowRef {
+#[async_trait]
+impl IStore for GarageStore {
+ async fn row_fetch<'a>(&self, select: &Selector<'a>) -> Result<Vec<RowVal>, StorageError> {
unimplemented!();
}
-
- fn select(&self, selector: Selector) -> AsyncResult<Vec<RowValue>> {
+ async fn row_rm<'a>(&self, select: &Selector<'a>) -> Result<(), StorageError> {
unimplemented!();
}
- fn rm(&self, selector: Selector) -> AsyncResult<()> {
+ async fn row_insert(&self, values: Vec<RowVal>) -> Result<(), StorageError> {
unimplemented!();
- }
- fn from_orphan(&self, orphan: OrphanRowRef) -> Result<RowRef, StorageError> {
- unimplemented!();
}
-}
-
-impl IRowRef for GrgRef {
- /*fn clone_boxed(&self) -> RowRef {
+ async fn row_poll(&self, value: RowRef) -> Result<RowVal, StorageError> {
unimplemented!();
- }*/
- fn to_orphan(&self) -> OrphanRowRef {
- unimplemented!()
}
- fn key(&self) -> (&str, &str) {
+ async fn blob_fetch(&self, blob_ref: &BlobRef) -> Result<BlobVal, StorageError> {
unimplemented!();
- }
- fn set_value(&self, content: &[u8]) -> RowValue {
- unimplemented!();
- }
- fn fetch(&self) -> AsyncResult<RowValue> {
- unimplemented!();
}
- fn rm(&self) -> AsyncResult<()> {
+ async fn blob_copy(&self, src: &BlobRef, dst: &BlobRef) -> Result<BlobVal, StorageError> {
unimplemented!();
- }
- fn poll(&self) -> AsyncResult<RowValue> {
- unimplemented!();
- }
-}
-impl std::fmt::Debug for GrgRef {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- unimplemented!();
}
-}
-
-impl IRowValue for GrgValue {
- fn to_ref(&self) -> RowRef {
+ async fn blob_list(&self, prefix: &str) -> Result<Vec<BlobRef>, StorageError> {
unimplemented!();
}
- fn content(&self) -> ConcurrentValues {
+ async fn blob_rm(&self, blob_ref: &BlobRef) -> Result<(), StorageError> {
unimplemented!();
}
- fn push(&self) -> AsyncResult<()> {
- unimplemented!();
- }
-}
-
-impl std::fmt::Debug for GrgValue {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- unimplemented!();
- }
-}
-
-
-/*
-/// A custom S3 region, composed of a region name and endpoint.
-/// We use this instead of rusoto_signature::Region so that we can
-/// derive Hash and Eq
-
-
-#[derive(Clone, Debug, Hash, PartialEq, Eq)]
-pub struct Region {
- pub name: String,
- pub endpoint: String,
-}
-
-impl Region {
- pub fn as_rusoto_region(&self) -> rusoto_signature::Region {
- rusoto_signature::Region::Custom {
- name: self.name.clone(),
- endpoint: self.endpoint.clone(),
- }
- }
}
-*/
-
-/*
-pub struct Garage {
- pub s3_region: Region,
- pub k2v_region: Region,
-
- pub aws_access_key_id: String,
- pub aws_secret_access_key: String,
- pub bucket: String,
-}
-
-impl StoreBuilder<> for Garage {
- fn row_store(&self) ->
-}
-
-pub struct K2V {}
-impl RowStore for K2V {
-}*/