StorageTrieWriter

Trait StorageTrieWriter 

Source
pub trait StorageTrieWriter: Send + Sync {
    // Required methods
    fn write_storage_trie_updates_sorted<'a>(
        &self,
        storage_tries: impl Iterator<Item = (&'a B256, &'a StorageTrieUpdatesSorted)>,
    ) -> ProviderResult<usize>;
    fn write_storage_trie_changesets<'a>(
        &self,
        block_number: BlockNumber,
        storage_tries: impl Iterator<Item = (&'a B256, &'a StorageTrieUpdatesSorted)>,
        updates_overlay: Option<&TrieUpdatesSorted>,
    ) -> ProviderResult<usize>;
}
Expand description

Storage Trie Writer

Required Methods§

Source

fn write_storage_trie_updates_sorted<'a>( &self, storage_tries: impl Iterator<Item = (&'a B256, &'a StorageTrieUpdatesSorted)>, ) -> ProviderResult<usize>

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.

Source

fn write_storage_trie_changesets<'a>( &self, block_number: BlockNumber, storage_tries: impl Iterator<Item = (&'a B256, &'a StorageTrieUpdatesSorted)>, updates_overlay: Option<&TrieUpdatesSorted>, ) -> ProviderResult<usize>

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.

Implementations on Foreign Types§

Source§

impl<'b, T: 'b + StorageTrieWriter + ?Sized> StorageTrieWriter for &'b T
where &'b T: Send + Sync,

Source§

fn write_storage_trie_updates_sorted<'a>( &self, storage_tries: impl Iterator<Item = (&'a B256, &'a StorageTrieUpdatesSorted)>, ) -> ProviderResult<usize>

Source§

fn write_storage_trie_changesets<'a>( &self, block_number: BlockNumber, storage_tries: impl Iterator<Item = (&'a B256, &'a StorageTrieUpdatesSorted)>, updates_overlay: Option<&TrieUpdatesSorted>, ) -> ProviderResult<usize>

Source§

impl<T: StorageTrieWriter + ?Sized> StorageTrieWriter for Box<T>
where Box<T>: Send + Sync,

Source§

fn write_storage_trie_updates_sorted<'a>( &self, storage_tries: impl Iterator<Item = (&'a B256, &'a StorageTrieUpdatesSorted)>, ) -> ProviderResult<usize>

Source§

fn write_storage_trie_changesets<'a>( &self, block_number: BlockNumber, storage_tries: impl Iterator<Item = (&'a B256, &'a StorageTrieUpdatesSorted)>, updates_overlay: Option<&TrieUpdatesSorted>, ) -> ProviderResult<usize>

Source§

impl<T: StorageTrieWriter + ?Sized> StorageTrieWriter for Arc<T>
where Arc<T>: Send + Sync,

Source§

fn write_storage_trie_updates_sorted<'a>( &self, storage_tries: impl Iterator<Item = (&'a B256, &'a StorageTrieUpdatesSorted)>, ) -> ProviderResult<usize>

Source§

fn write_storage_trie_changesets<'a>( &self, block_number: BlockNumber, storage_tries: impl Iterator<Item = (&'a B256, &'a StorageTrieUpdatesSorted)>, updates_overlay: Option<&TrieUpdatesSorted>, ) -> ProviderResult<usize>

Implementors§