about summary refs log tree commit diff
path: root/tvix/store/src/blobservice/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/store/src/blobservice/mod.rs')
-rw-r--r--tvix/store/src/blobservice/mod.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/tvix/store/src/blobservice/mod.rs b/tvix/store/src/blobservice/mod.rs
new file mode 100644
index 000000000000..53e941795e7e
--- /dev/null
+++ b/tvix/store/src/blobservice/mod.rs
@@ -0,0 +1,20 @@
+use crate::{proto, Error};
+
+mod memory;
+mod sled;
+
+pub use self::memory::MemoryBlobService;
+pub use self::sled::SledBlobService;
+
+/// The base trait all BlobService services need to implement.
+/// It provides information about how a blob is chunked,
+/// and allows creating new blobs by creating a BlobMeta (referring to chunks
+/// in a [crate::chunkservice::ChunkService]).
+pub trait BlobService {
+    /// Retrieve chunking information for a given blob
+    fn stat(&self, req: &proto::StatBlobRequest) -> Result<Option<proto::BlobMeta>, Error>;
+
+    /// Insert chunking information for a given blob.
+    /// Implementations SHOULD make sure chunks referred do exist.
+    fn put(&self, blob_digest: &[u8], blob_meta: proto::BlobMeta) -> Result<(), Error>;
+}