referrerpolicy=no-referrer-when-downgrade
sp_state_machine

Type Alias TrieDBMutV1

pub type TrieDBMutV1<'a, H> = TrieDBMut<'a, LayoutV1<H>>;
Expand description

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

Aliased Type§

struct TrieDBMutV1<'a, H> { /* private fields */ }

Implementations

§

impl<'a, L> TrieDBMut<'a, L>
where L: TrieLayout,

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

Get the backing database.

pub fn db_mut(&mut self) -> &mut dyn HashDB<<L as TrieLayout>::Hash, Vec<u8>>

Get the backing database mutably.

pub fn commit(&mut self)

Commit the in-memory changes to disk, freeing their storage and updating the state root.

Trait Implementations

§

impl<'a, L> Drop for TrieDBMut<'a, L>
where L: TrieLayout,

§

fn drop(&mut self)

Executes the destructor for this type. Read more
§

impl<'a, L> TrieMut<L> for TrieDBMut<'a, L>
where L: TrieLayout,

§

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

Return the root of the trie.
§

fn is_empty(&self) -> bool

Is the trie empty?
§

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

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

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

Insert a key/value pair into the trie. An empty value is equivalent to removing key from the trie. Returns the old value associated with this key, if it existed.
§

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

Remove a key from the trie. Equivalent to making it equal to the empty value. Returns the old value associated with this key, if it existed.
§

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?