Skip to main content

BlobStore

Trait BlobStore 

Source
pub trait BlobStore: MaybeSend + MaybeSync {
    type Sink: PackSink;

    // Required methods
    fn begin(
        &self,
        key: BlobKey,
        len: u64,
    ) -> impl Future<Output = Result<Self::Sink, StoreError>> + MaybeSend;
    fn get(
        &self,
        key: &BlobKey,
        range: Option<ByteRange>,
    ) -> impl Future<Output = Result<Option<BlobBody>, StoreError>> + MaybeSend;
    fn head(
        &self,
        key: &BlobKey,
    ) -> impl Future<Output = Result<Option<BlobMeta>, StoreError>> + MaybeSend;
    fn probe(&self) -> impl Future<Output = Result<(), StoreError>> + MaybeSend;
    fn delete(
        &self,
        key: &BlobKey,
    ) -> impl Future<Output = Result<bool, StoreError>> + MaybeSend;
}
Expand description

A content-addressed, immutable blob store. Writes are put-if-absent; rewriting a present key with identical bytes is AlreadyPresent.

Required Associated Types§

Source

type Sink: PackSink

The upload handle Self::begin returns.

Required Methods§

Source

fn begin( &self, key: BlobKey, len: u64, ) -> impl Future<Output = Result<Self::Sink, StoreError>> + MaybeSend

Start writing blob key of len bytes.

Source

fn get( &self, key: &BlobKey, range: Option<ByteRange>, ) -> impl Future<Output = Result<Option<BlobBody>, StoreError>> + MaybeSend

The blob’s bytes, or range of them. A body longer than MAX_BLOB_PIECE_BYTES MUST be a BlobBody::Stream whose pieces are each at most MAX_BLOB_PIECE_BYTES (an adapter re-chunks its backend’s stream); a backend never buffers a whole pack. A range starting at or past the end is StoreError::RangeNotSatisfiable.

Source

fn head( &self, key: &BlobKey, ) -> impl Future<Output = Result<Option<BlobMeta>, StoreError>> + MaybeSend

The blob’s metadata, if present.

Source

fn probe(&self) -> impl Future<Output = Result<(), StoreError>> + MaybeSend

A cheap health check.

Source

fn delete( &self, key: &BlobKey, ) -> impl Future<Output = Result<bool, StoreError>> + MaybeSend

Remove a blob; returns whether it existed. Never called by the M0 pipeline: reserved for GC and takedown (WP-5.3b, WP-5.6).

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl BlobStore for FsBlobStore

Source§

impl BlobStore for MemoryBlobStore

Source§

impl<B: BlobStore> BlobStore for Budgeted<'_, B>

Blob reads use the same counter as namespace calls.

Source§

type Sink = <B as BlobStore>::Sink