Skip to main content

BlobStore

Trait BlobStore 

Source
pub trait BlobStore: Send + Sync {
    // Required methods
    fn put_bytes(&self, bytes: &[u8]) -> Result<ContentHash>;
    fn get_bytes(&self, hash: &ContentHash) -> Result<Option<Vec<u8>>>;
    fn contains(&self, hash: &ContentHash) -> Result<bool>;
}
Expand description

Store of content-addressed blobs (the big table).

Required Methods§

Source

fn put_bytes(&self, bytes: &[u8]) -> Result<ContentHash>

Store bytes under their content hash. Idempotent: storing the same bytes twice is a no-op.

Source

fn get_bytes(&self, hash: &ContentHash) -> Result<Option<Vec<u8>>>

Read the blob at hash, None if absent (possibly evicted).

Source

fn contains(&self, hash: &ContentHash) -> Result<bool>

Whether a blob exists at hash, without reading it.

Implementors§