Trait StorageTrieWriter
pub trait StorageTrieWriter: Send + Sync {
// Required methods
fn write_storage_trie_updates_sorted<'a>(
&self,
storage_tries: impl Iterator<Item = (&'a FixedBytes<32>, &'a StorageTrieUpdatesSorted)>,
) -> Result<usize, ProviderError>;
fn write_storage_trie_changesets<'a>(
&self,
block_number: u64,
storage_tries: impl Iterator<Item = (&'a FixedBytes<32>, &'a StorageTrieUpdatesSorted)>,
updates_overlay: Option<&TrieUpdatesSorted>,
) -> Result<usize, ProviderError>;
}Expand description
Storage Trie Writer
Required Methods§
fn write_storage_trie_updates_sorted<'a>(
&self,
storage_tries: impl Iterator<Item = (&'a FixedBytes<32>, &'a StorageTrieUpdatesSorted)>,
) -> Result<usize, ProviderError>
fn write_storage_trie_updates_sorted<'a>( &self, storage_tries: impl Iterator<Item = (&'a FixedBytes<32>, &'a StorageTrieUpdatesSorted)>, ) -> Result<usize, ProviderError>
Writes storage trie updates from the given storage trie map with already sorted updates.
Expects the storage trie updates to already be sorted by the hashed address key.
Returns the number of entries modified.
fn write_storage_trie_changesets<'a>(
&self,
block_number: u64,
storage_tries: impl Iterator<Item = (&'a FixedBytes<32>, &'a StorageTrieUpdatesSorted)>,
updates_overlay: Option<&TrieUpdatesSorted>,
) -> Result<usize, ProviderError>
fn write_storage_trie_changesets<'a>( &self, block_number: u64, storage_tries: impl Iterator<Item = (&'a FixedBytes<32>, &'a StorageTrieUpdatesSorted)>, updates_overlay: Option<&TrieUpdatesSorted>, ) -> Result<usize, ProviderError>
Records the current values of all trie nodes which will be updated using the
[StorageTrieUpdatesSorted] into the storage trie changesets table.
The intended usage of this method is to call it prior to calling
write_storage_trie_updates with the same set of [StorageTrieUpdatesSorted].
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 for each storage trie, 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 storage updates that depend on
previous uncommitted trie changes.
Returns the number of keys written.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.