pub trait TrieWriter: Send + Sync {
// Required methods
fn write_trie_updates_sorted(
&self,
trie_updates: &TrieUpdatesSorted,
) -> ProviderResult<usize>;
fn write_trie_changesets(
&self,
block_number: BlockNumber,
trie_updates: &TrieUpdatesSorted,
updates_overlay: Option<&TrieUpdatesSorted>,
) -> ProviderResult<usize>;
fn clear_trie_changesets(&self) -> ProviderResult<()>;
fn clear_trie_changesets_from(
&self,
from: BlockNumber,
) -> ProviderResult<()>;
// Provided method
fn write_trie_updates(
&self,
trie_updates: TrieUpdates,
) -> ProviderResult<usize> { ... }
}Expand description
Trie Writer
Required Methods§
Sourcefn write_trie_updates_sorted(
&self,
trie_updates: &TrieUpdatesSorted,
) -> ProviderResult<usize>
fn write_trie_updates_sorted( &self, trie_updates: &TrieUpdatesSorted, ) -> ProviderResult<usize>
Writes trie updates to the database with already sorted updates.
Returns the number of entries modified.
Sourcefn write_trie_changesets(
&self,
block_number: BlockNumber,
trie_updates: &TrieUpdatesSorted,
updates_overlay: Option<&TrieUpdatesSorted>,
) -> ProviderResult<usize>
fn write_trie_changesets( &self, block_number: BlockNumber, trie_updates: &TrieUpdatesSorted, updates_overlay: Option<&TrieUpdatesSorted>, ) -> ProviderResult<usize>
Records the current values of all trie nodes which will be updated using the [TrieUpdates]
into the trie changesets tables.
The intended usage of this method is to call it prior to calling write_trie_updates with
the same [TrieUpdates].
The updates_overlay parameter allows providing additional in-memory trie updates that
should be considered when looking up current node values. When provided, these overlay
updates are applied on top of the database state, allowing the method to see a view that
includes both committed database values and pending in-memory changes. This is useful
when writing changesets for updates that depend on previous uncommitted trie changes.
Returns the number of keys written.
Sourcefn clear_trie_changesets(&self) -> ProviderResult<()>
fn clear_trie_changesets(&self) -> ProviderResult<()>
Clears contents of trie changesets completely
Sourcefn clear_trie_changesets_from(&self, from: BlockNumber) -> ProviderResult<()>
fn clear_trie_changesets_from(&self, from: BlockNumber) -> ProviderResult<()>
Clears contents of trie changesets starting from the given block number (inclusive) onwards.
Provided Methods§
Sourcefn write_trie_updates(&self, trie_updates: TrieUpdates) -> ProviderResult<usize>
fn write_trie_updates(&self, trie_updates: TrieUpdates) -> ProviderResult<usize>
Writes trie updates to the database.
Returns the number of entries modified.