Trait trie_db::HashDB[][src]

pub trait HashDB<H, T>: Send + Sync + AsHashDB<H, T> where
    H: Hasher
{ fn get(
        &self,
        key: &<H as Hasher>::Out,
        prefix: (&[u8], Option<u8>)
    ) -> Option<T>;
fn contains(
        &self,
        key: &<H as Hasher>::Out,
        prefix: (&[u8], Option<u8>)
    ) -> bool;
fn insert(
        &mut self,
        prefix: (&[u8], Option<u8>),
        value: &[u8]
    ) -> <H as Hasher>::Out;
fn emplace(
        &mut self,
        key: <H as Hasher>::Out,
        prefix: (&[u8], Option<u8>),
        value: T
    );
fn remove(&mut self, key: &<H as Hasher>::Out, prefix: (&[u8], Option<u8>)); }
Expand description

Trait modelling datastore keyed by a hash defined by the Hasher.

Required methods

Look up a given hash into the bytes that hash to it, returning None if the hash is not known.

Check for the existance of a hash-key.

Insert a datum item into the DB and return the datum’s hash for a later lookup. Insertions are counted and the equivalent number of remove()s must be performed before the data is considered dead.

Like insert(), except you provide the key and the data is all moved.

Remove a datum previously inserted. Insertions can be “owed” such that the same number of insert()s may happen without the data being eventually being inserted into the DB. It can be “owed” more than once.

Trait Implementations

Perform upcast to HashDB for anything that derives from HashDB.

Perform mutable upcast to HashDB for anything that derives from HashDB.

Look up a given hash into the bytes that hash to it, returning None if the hash is not known. Read more

Check for the existance of a hash-key.

Look up a given hash into the bytes that hash to it, returning None if the hash is not known. Read more

Check for the existance of a hash-key.

Implementors