Page MenuHomePhorge

D5681.1768813158.diff
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

D5681.1768813158.diff

diff --git a/services/blob/src/database.rs b/services/blob/src/database.rs
new file mode 100644
--- /dev/null
+++ b/services/blob/src/database.rs
@@ -0,0 +1,74 @@
+use anyhow::Result;
+use std::sync::Arc;
+
+use crate::s3::S3Path;
+
+#[derive(Clone, Debug)]
+pub struct BlobItem {
+ pub blob_hash: String,
+ pub s3_path: S3Path,
+ pub created: i64,
+}
+
+#[derive(Clone, Debug)]
+pub struct ReverseIndexItem {
+ pub holder: String,
+ pub blob_hash: String,
+}
+
+#[derive(Clone)]
+pub struct DatabaseClient {
+ client: Arc<aws_sdk_dynamodb::Client>,
+}
+
+impl DatabaseClient {
+ pub fn new(aws_config: &aws_types::SdkConfig) -> Self {
+ DatabaseClient {
+ client: Arc::new(aws_sdk_dynamodb::Client::new(aws_config)),
+ }
+ }
+
+ // Blob item
+
+ pub async fn put_blob_item(&self, blob_item: BlobItem) -> Result<()> {
+ unimplemented!();
+ }
+
+ pub async fn find_blob_item(
+ &self,
+ blob_hash: &str,
+ ) -> Result<Option<BlobItem>> {
+ unimplemented!();
+ }
+
+ pub async fn remove_blob_item(&self, blob_hash: &str) -> Result<()> {
+ unimplemented!();
+ }
+
+ // Reverse index item
+
+ pub async fn put_reverse_index_item(
+ &self,
+ reverse_index_item: ReverseIndexItem,
+ ) -> Result<()> {
+ unimplemented!();
+ }
+
+ pub async fn find_reverse_index_by_holder(
+ &self,
+ holder: &str,
+ ) -> Result<Option<ReverseIndexItem>> {
+ unimplemented!();
+ }
+
+ pub async fn find_reverse_index_by_hash(
+ &self,
+ blob_hash: &str,
+ ) -> Result<Vec<ReverseIndexItem>> {
+ unimplemented!();
+ }
+
+ pub async fn remove_reverse_index_item(&self, holder: &str) -> Result<()> {
+ unimplemented!();
+ }
+}
diff --git a/services/blob/src/main.rs b/services/blob/src/main.rs
--- a/services/blob/src/main.rs
+++ b/services/blob/src/main.rs
@@ -1,4 +1,5 @@
pub mod constants;
+pub mod database;
pub mod s3;
pub mod service;
pub mod tools;

File Metadata

Mime Type
text/plain
Expires
Mon, Jan 19, 8:59 AM (9 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5951377
Default Alt Text
D5681.1768813158.diff (1 KB)

Event Timeline