pub trait HashDB<H: Hasher, T>:
Send
+ Sync
+ AsHashDB<H, T> {
// Required methods
fn keys(&self) -> HashMap<H::Out, i32>;
fn get(&self, key: &H::Out) -> Option<T>;
fn contains(&self, key: &H::Out) -> bool;
fn insert(&mut self, value: &[u8]) -> H::Out;
fn emplace(&mut self, key: H::Out, value: T);
fn remove(&mut self, key: &H::Out);
}Expand description
Trait modelling datastore keyed by a hash defined by the Hasher.
Required Methods§
Sourcefn keys(&self) -> HashMap<H::Out, i32>
fn keys(&self) -> HashMap<H::Out, i32>
Get the keys in the database together with number of underlying references.
Sourcefn get(&self, key: &H::Out) -> Option<T>
fn get(&self, key: &H::Out) -> Option<T>
Look up a given hash into the bytes that hash to it, returning None if the hash is not known.
Sourcefn insert(&mut self, value: &[u8]) -> H::Out
fn insert(&mut self, value: &[u8]) -> H::Out
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.