Skip to main content

AsyncBlobStore

Trait AsyncBlobStore 

Source
pub trait AsyncBlobStore {
    type Error: Error + 'static;

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

    // Provided methods
    fn read_parallelism(&self) -> usize { ... }
    async fn get_blobs_ordered(
        &self,
        references: &[BlobRef],
    ) -> Result<Vec<Option<Vec<u8>>>, Self::Error> { ... }
}
Expand description

Async content-addressed blob storage used by large-value helpers.

This trait mirrors BlobStore for object stores, remote caches, browser storage, and other non-blocking blob backends. Like crate::AsyncStore, it does not require Send or Sync at the trait level so single-threaded WASM stores can implement it.

Required Associated Types§

Source

type Error: Error + 'static

Error type for blob storage operations.

Required Methods§

Source

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

Load a blob by reference.

Source

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

Store bytes and return their content-addressed reference.

Source

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

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

Provided Methods§

Source

fn read_parallelism(&self) -> usize

Maximum in-flight point reads for default ordered blob reads.

Source

async fn get_blobs_ordered( &self, references: &[BlobRef], ) -> Result<Vec<Option<Vec<u8>>>, Self::Error>

Retrieve multiple blobs while preserving request order.

The default implementation deduplicates repeated references, performs point reads, and expands results back to the original request order. If AsyncBlobStore::read_parallelism is greater than one, point reads are overlapped up to that limit.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T: AsyncBlobStore> AsyncBlobStore for Arc<T>

Source§

type Error = <T as AsyncBlobStore>::Error

Source§

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

Source§

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

Source§

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

Source§

fn read_parallelism(&self) -> usize

Source§

async fn get_blobs_ordered( &self, references: &[BlobRef], ) -> Result<Vec<Option<Vec<u8>>>, Self::Error>

Implementors§