Type Alias sp_trie::TrieDBBuilder

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

Builder for creating a TrieDB.

Aliased Type§

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

Implementations

source§

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

source

pub fn new( db: &'db dyn HashDBRef<<L as TrieLayout>::Hash, Vec<u8>>, root: &'db <<L as TrieLayout>::Hash as Hasher>::Out, ) -> TrieDBBuilder<'db, 'cache, L>

Create a new trie-db builder with the backing database db and root.

This doesn’t check if root exists in the given db. If root doesn’t exist it will fail when trying to lookup any key.

source

pub fn with_cache( self, cache: &'cache mut dyn TrieCache<<L as TrieLayout>::Codec>, ) -> TrieDBBuilder<'db, 'cache, L>

Use the given cache for the db.

source

pub fn with_optional_cache<'ocache>( self, cache: Option<&'ocache mut dyn TrieCache<<L as TrieLayout>::Codec>>, ) -> TrieDBBuilder<'db, 'cache, L>
where 'ocache: 'cache,

Use the given optional cache for the db.

source

pub fn with_recorder( self, recorder: &'cache mut dyn TrieRecorder<<<L as TrieLayout>::Hash as Hasher>::Out>, ) -> TrieDBBuilder<'db, 'cache, L>

Use the given recorder to record trie accesses.

source

pub fn with_optional_recorder<'recorder>( self, recorder: Option<&'recorder mut dyn TrieRecorder<<<L as TrieLayout>::Hash as Hasher>::Out>>, ) -> TrieDBBuilder<'db, 'cache, L>
where 'recorder: 'cache,

Use the given optional recorder to record trie accesses.

source

pub fn build(self) -> TrieDB<'db, 'cache, L>

Build the TrieDB.