pub trait BlobStore: Send + Sync {
// Required methods
fn put_blob<'life0, 'life1, 'async_trait>(
&'life0 self,
content: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<ContentHash>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_blob<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 ContentHash,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn list_blobs<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ContentHash>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn delete_blob<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 ContentHash,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
A content-addressed blob store for out-of-line record bodies
(Body::Blob). Content is keyed by its ContentHash, so byte-identical
bodies — e.g. code-graph slices shared across worktrees (ADR 0012) — are
stored once. Writes are write-if-absent: storing content that already
exists is an idempotent no-op, never a conflict (same hash ⇒ same bytes).
Required Methods§
Sourcefn put_blob<'life0, 'life1, 'async_trait>(
&'life0 self,
content: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<ContentHash>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn put_blob<'life0, 'life1, 'async_trait>(
&'life0 self,
content: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<ContentHash>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Store content addressed by its hash, write-if-absent, and return the
hash. Idempotent: storing identical content again is a no-op.
Sourcefn get_blob<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 ContentHash,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_blob<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 ContentHash,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetch blob content by hash, or None if absent.
Sourcefn list_blobs<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ContentHash>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_blobs<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ContentHash>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List the hashes of every stored blob. Order is unspecified. Used by GC to enumerate candidates for sweeping (ADR 0012).
Sourcefn delete_blob<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 ContentHash,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_blob<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 ContentHash,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete the blob addressed by hash. Deleting an absent blob is an
idempotent no-op — GC may race another sweeper or a re-put.