pub trait ContentAddrStore: Send + Sync + 'static {
    // Required methods
    fn get<'a>(&'a self, key: &[u8]) -> Option<Cow<'a, [u8]>>;
    fn insert(&self, key: &[u8], value: &[u8]);

    // Provided method
    fn realize(&self, hash: Hashed) -> Option<RawNode<'_>> { ... }
}
Expand description

Trait that implements a thread-safe, concurrent low-level content addressed store.

Required Methods§

source

fn get<'a>(&'a self, key: &[u8]) -> Option<Cow<'a, [u8]>>

Gets a block by hash.

source

fn insert(&self, key: &[u8], value: &[u8])

Inserts a block and its hash.

Provided Methods§

source

fn realize(&self, hash: Hashed) -> Option<RawNode<'_>>

Helper function to realize a hash as a raw node. May override if caching, etc makes sense, but the default impl is reasonable in most cases.

Implementors§