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§
Sourcetype Sink: PackSink
type Sink: PackSink
The upload handle Self::begin returns.
Required Methods§
Sourcefn begin(
&self,
key: BlobKey,
len: u64,
) -> impl Future<Output = Result<Self::Sink, StoreError>> + MaybeSend
fn begin( &self, key: BlobKey, len: u64, ) -> impl Future<Output = Result<Self::Sink, StoreError>> + MaybeSend
Start writing blob key of len bytes.
Sourcefn get(
&self,
key: &BlobKey,
range: Option<ByteRange>,
) -> impl Future<Output = Result<Option<BlobBody>, StoreError>> + MaybeSend
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.
Sourcefn head(
&self,
key: &BlobKey,
) -> impl Future<Output = Result<Option<BlobMeta>, StoreError>> + MaybeSend
fn head( &self, key: &BlobKey, ) -> impl Future<Output = Result<Option<BlobMeta>, StoreError>> + MaybeSend
The blob’s metadata, if present.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".