Trait hash_db::HashDB[][src]

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

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

Required methods

fn get(&self, key: &H::Out, prefix: Prefix<'_>) -> Option<T>[src]

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

fn contains(&self, key: &H::Out, prefix: Prefix<'_>) -> bool[src]

Check for the existance of a hash-key.

fn insert(&mut self, prefix: Prefix<'_>, value: &[u8]) -> H::Out[src]

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.

fn emplace(&mut self, key: H::Out, prefix: Prefix<'_>, value: T)[src]

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

fn remove(&mut self, key: &H::Out, prefix: Prefix<'_>)[src]

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.

Loading content...

Trait Implementations

impl<'a, H: Hasher, T> AsHashDB<H, T> for &'a mut dyn HashDB<H, T>[src]

impl<'a, H: Hasher, T> HashDBRef<H, T> for &'a dyn HashDB<H, T>[src]

impl<'a, H: Hasher, T> HashDBRef<H, T> for &'a mut dyn HashDB<H, T>[src]

Implementors

Loading content...