Type Alias sp_trie::TrieDB

source ·
pub type TrieDB<'a, 'cache, L> = TrieDB<'a, 'cache, L>;
Expand description

Persistent trie database read-access interface for a given hasher.

Aliased Type§

struct TrieDB<'a, 'cache, L> { /* private fields */ }

Implementations

source§

impl<'db, 'cache, L> TrieDB<'db, 'cache, L>
where L: TrieLayout,

source

pub fn db(&'db self) -> &'db dyn HashDBRef<<L as TrieLayout>::Hash, Vec<u8>>

Get the backing database.

source

pub fn into_double_ended_iter( &'db self, ) -> Result<TrieDBDoubleEndedIterator<'db, 'cache, L>, Box<TrieError<<<L as TrieLayout>::Hash as Hasher>::Out, <<L as TrieLayout>::Codec as NodeCodec>::Error>>>

Create TrieDBDoubleEndedIterator from TrieDB.

source

pub fn into_node_double_ended_iter( &'db self, ) -> Result<TrieDBNodeDoubleEndedIterator<'db, 'cache, L>, Box<TrieError<<<L as TrieLayout>::Hash as Hasher>::Out, <<L as TrieLayout>::Codec as NodeCodec>::Error>>>

Create TrieDBNodeDoubleEndedIterator from TrieDB.

source

pub fn into_key_double_ended_iter( &'db self, ) -> Result<TrieDBKeyDoubleEndedIterator<'db, 'cache, L>, Box<TrieError<<<L as TrieLayout>::Hash as Hasher>::Out, <<L as TrieLayout>::Codec as NodeCodec>::Error>>>

create TrieDBKeyDoubleEndedIterator from TrieDB.

source

pub fn into_fat_double_ended_iter( &'db self, ) -> Result<FatDBDoubleEndedIterator<'db, 'cache, L>, Box<TrieError<<<L as TrieLayout>::Hash as Hasher>::Out, <<L as TrieLayout>::Codec as NodeCodec>::Error>>>

create FatDBDoubleEndedIterator from TrieDB.

Trait Implementations

source§

impl<'db, 'cache, L> Debug for TrieDB<'db, 'cache, L>
where L: TrieLayout,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<'db, 'cache, L> Trie<L> for TrieDB<'db, 'cache, L>
where L: TrieLayout,

source§

fn root(&self) -> &<<L as TrieLayout>::Hash as Hasher>::Out

Return the root of the trie.
source§

fn get_hash( &self, key: &[u8], ) -> Result<Option<<<L as TrieLayout>::Hash as Hasher>::Out>, Box<TrieError<<<L as TrieLayout>::Hash as Hasher>::Out, <<L as TrieLayout>::Codec as NodeCodec>::Error>>>

Returns the hash of the value for key.
source§

fn get_with<Q>( &self, key: &[u8], query: Q, ) -> Result<Option<<Q as Query<<L as TrieLayout>::Hash>>::Item>, Box<TrieError<<<L as TrieLayout>::Hash as Hasher>::Out, <<L as TrieLayout>::Codec as NodeCodec>::Error>>>
where Q: Query<<L as TrieLayout>::Hash>,

Search for the key with the given query parameter. See the docs of the Query trait for more details.
source§

fn lookup_first_descendant( &self, key: &[u8], ) -> Result<Option<MerkleValue<<<L as TrieLayout>::Hash as Hasher>::Out>>, Box<TrieError<<<L as TrieLayout>::Hash as Hasher>::Out, <<L as TrieLayout>::Codec as NodeCodec>::Error>>>

Look up the MerkleValue of the node that is the closest descendant for the provided key. Read more
source§

fn iter<'a>( &'a self, ) -> Result<Box<dyn TrieIterator<L, Item = Result<(Vec<u8>, Vec<u8>), Box<TrieError<<<L as TrieLayout>::Hash as Hasher>::Out, <<L as TrieLayout>::Codec as NodeCodec>::Error>>>> + 'a>, Box<TrieError<<<L as TrieLayout>::Hash as Hasher>::Out, <<L as TrieLayout>::Codec as NodeCodec>::Error>>>

Returns a depth-first iterator over the elements of trie.
source§

fn key_iter<'a>( &'a self, ) -> Result<Box<dyn TrieIterator<L, Item = Result<Vec<u8>, Box<TrieError<<<L as TrieLayout>::Hash as Hasher>::Out, <<L as TrieLayout>::Codec as NodeCodec>::Error>>>> + 'a>, Box<TrieError<<<L as TrieLayout>::Hash as Hasher>::Out, <<L as TrieLayout>::Codec as NodeCodec>::Error>>>

Returns a depth-first iterator over the keys of elemets of trie.
source§

fn is_empty(&self) -> bool

Is the trie empty?
source§

fn contains( &self, key: &[u8], ) -> Result<bool, Box<TrieError<<<L as TrieLayout>::Hash as Hasher>::Out, <<L as TrieLayout>::Codec as NodeCodec>::Error>>>

Does the trie contain a given key?
source§

fn get( &self, key: &[u8], ) -> Result<Option<Vec<u8>>, Box<TrieError<<<L as TrieLayout>::Hash as Hasher>::Out, <<L as TrieLayout>::Codec as NodeCodec>::Error>>>

What is the value of the given key in this trie?