Skip to main content

BlobStore

Trait BlobStore 

Source
pub trait BlobStore: Send + Sync {
    // Required methods
    fn get(&self, hash: &[u8; 32]) -> Option<Vec<u8>>;
    fn put(&self, hash: [u8; 32], data: Vec<u8>) -> bool;
    fn contains(&self, hash: &[u8; 32]) -> bool;
}
Expand description

Content-addressed blob storage.

Required Methods§

Source

fn get(&self, hash: &[u8; 32]) -> Option<Vec<u8>>

Retrieve the blob for the given content hash, or None if absent.

Source

fn put(&self, hash: [u8; 32], data: Vec<u8>) -> bool

Store a blob under the given content hash. Returns true if the blob was newly inserted, false if it already existed.

Source

fn contains(&self, hash: &[u8; 32]) -> bool

Check whether a blob exists for the given hash.

Implementors§