Skip to main content

BlobStore

Trait BlobStore 

Source
pub trait BlobStore: Send + Sync {
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn get_blob(
        &self,
        reference: &BlobRef,
    ) -> Result<Option<Vec<u8>>, Self::Error>;
    fn put_blob(&self, bytes: &[u8]) -> Result<BlobRef, Self::Error>;
    fn delete_blob(&self, reference: &BlobRef) -> Result<(), Self::Error>;
}
Expand description

Content-addressed blob storage used by large-value helpers.

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

Error type for blob storage operations.

Required Methods§

Source

fn get_blob(&self, reference: &BlobRef) -> Result<Option<Vec<u8>>, Self::Error>

Load a blob by reference.

Source

fn put_blob(&self, bytes: &[u8]) -> Result<BlobRef, Self::Error>

Store bytes and return their content-addressed reference.

Source

fn delete_blob(&self, reference: &BlobRef) -> Result<(), Self::Error>

Delete a blob. Deleting a missing blob is not an error.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: BlobStore> BlobStore for Arc<T>

Source§

type Error = <T as BlobStore>::Error

Source§

fn get_blob(&self, reference: &BlobRef) -> Result<Option<Vec<u8>>, Self::Error>

Source§

fn put_blob(&self, bytes: &[u8]) -> Result<BlobRef, Self::Error>

Source§

fn delete_blob(&self, reference: &BlobRef) -> Result<(), Self::Error>

Implementors§