pub struct TrieUpdatesSorted { /* private fields */ }Expand description
Sorted trie updates used for lookups and insertions.
Implementations§
Source§impl TrieUpdatesSorted
impl TrieUpdatesSorted
Sourcepub fn new(
account_nodes: Vec<(Nibbles, Option<BranchNodeCompact>)>,
storage_tries: B256Map<StorageTrieUpdatesSorted>,
) -> Self
pub fn new( account_nodes: Vec<(Nibbles, Option<BranchNodeCompact>)>, storage_tries: B256Map<StorageTrieUpdatesSorted>, ) -> Self
Creates a new TrieUpdatesSorted with the given account nodes and storage tries.
§Panics
In debug mode, panics if account_nodes is not sorted by the Nibbles key,
or if any storage trie’s storage_nodes is not sorted by its Nibbles key.
Sourcepub fn account_nodes_ref(&self) -> &[(Nibbles, Option<BranchNodeCompact>)]
pub fn account_nodes_ref(&self) -> &[(Nibbles, Option<BranchNodeCompact>)]
Returns reference to updated account nodes.
Sourcepub const fn storage_tries_ref(&self) -> &B256Map<StorageTrieUpdatesSorted>
pub const fn storage_tries_ref(&self) -> &B256Map<StorageTrieUpdatesSorted>
Returns reference to updated storage tries.
Sourcepub fn total_len(&self) -> usize
pub fn total_len(&self) -> usize
Returns the total number of updates including account nodes and all storage updates.
Sourcepub fn extend_ref_and_sort(&mut self, other: &Self)
pub fn extend_ref_and_sort(&mut self, other: &Self)
Extends the trie updates with another set of sorted updates.
This merges the account nodes and storage tries from other into self.
Account nodes are merged and re-sorted, with other’s values taking precedence
for duplicate keys.
Sorts the account nodes after extending. Sorts the storage tries after extending, for each storage trie.
Sourcepub fn merge_batch<T: AsRef<Self> + From<Self>>(
iter: impl IntoIterator<Item = T>,
) -> T
pub fn merge_batch<T: AsRef<Self> + From<Self>>( iter: impl IntoIterator<Item = T>, ) -> T
Batch-merge sorted trie updates. Iterator yields newest to oldest.
For small batches, uses extend_ref_and_sort loop.
For large batches, uses k-way merge for O(n log k) complexity.
Sourcepub fn merge_slice<T: AsRef<Self>>(items: &[T]) -> Self
pub fn merge_slice<T: AsRef<Self>>(items: &[T]) -> Self
Batch-merge sorted trie updates from a slice. Slice is newest to oldest.
This variant takes a slice reference directly, avoiding iterator collection overhead.
For small batches, uses extend_ref_and_sort loop.
For large batches, uses k-way merge for O(n log k) complexity.
Sourcepub fn merge_iter<'a>(items: impl Iterator<Item = &'a Self> + Clone) -> Self
pub fn merge_iter<'a>(items: impl Iterator<Item = &'a Self> + Clone) -> Self
Batch-merge sorted trie updates yielded newest to oldest, using a k-way merge.
Traverses the iterator separately for account and storage nodes without collecting its inputs. The iterator is cloned for the account-node traversal.
Sourcepub fn disjointed_merge_batch<'a>(batch: &[&'a Self], mask: &[&'a Self]) -> Self
pub fn disjointed_merge_batch<'a>(batch: &[&'a Self], mask: &[&'a Self]) -> Self
Merges the batch and removes overlapping keys whose mask values all differ from the merged batch value.
Account trie nodes are masked at the top level, while storage trie entries are masked at the node level. For duplicate keys in the batch, later items take precedence over earlier ones. An overlapping entry is retained if any mask value is equal to the merged batch value. The order of the mask does not matter. An empty mask merges the batch without filtering.
Trait Implementations§
Source§impl AsRef<TrieUpdatesSorted> for TrieUpdatesSorted
impl AsRef<TrieUpdatesSorted> for TrieUpdatesSorted
Source§impl Clone for TrieUpdatesSorted
impl Clone for TrieUpdatesSorted
Source§impl Debug for TrieUpdatesSorted
impl Debug for TrieUpdatesSorted
Source§impl Default for TrieUpdatesSorted
impl Default for TrieUpdatesSorted
Source§impl<'de> Deserialize<'de> for TrieUpdatesSorted
Available on crate features serde only.
impl<'de> Deserialize<'de> for TrieUpdatesSorted
serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<'de> DeserializeAs<'de, TrieUpdatesSorted> for TrieUpdatesSorted<'de>
Available on crate feature serde-bincode-compat only.
impl<'de> DeserializeAs<'de, TrieUpdatesSorted> for TrieUpdatesSorted<'de>
serde-bincode-compat only.Source§fn deserialize_as<D>(deserializer: D) -> Result<TrieUpdatesSorted, D::Error>where
D: Deserializer<'de>,
fn deserialize_as<D>(deserializer: D) -> Result<TrieUpdatesSorted, D::Error>where
D: Deserializer<'de>,
impl Eq for TrieUpdatesSorted
Source§impl<'a> From<&'a TrieUpdatesSorted> for TrieUpdatesSorted<'a>
Available on crate feature serde-bincode-compat only.
impl<'a> From<&'a TrieUpdatesSorted> for TrieUpdatesSorted<'a>
serde-bincode-compat only.Source§fn from(value: &'a TrieUpdatesSorted) -> Self
fn from(value: &'a TrieUpdatesSorted) -> Self
Source§impl<'a> From<TrieUpdatesSorted<'a>> for TrieUpdatesSorted
Available on crate feature serde-bincode-compat only.
impl<'a> From<TrieUpdatesSorted<'a>> for TrieUpdatesSorted
serde-bincode-compat only.Source§fn from(value: TrieUpdatesSorted<'a>) -> Self
fn from(value: TrieUpdatesSorted<'a>) -> Self
Source§impl From<TrieUpdatesSorted> for TrieUpdates
impl From<TrieUpdatesSorted> for TrieUpdates
Source§fn from(sorted: TrieUpdatesSorted) -> Self
fn from(sorted: TrieUpdatesSorted) -> Self
Source§impl PartialEq for TrieUpdatesSorted
impl PartialEq for TrieUpdatesSorted
Source§impl Serialize for TrieUpdatesSorted
Available on crate features serde only.
impl Serialize for TrieUpdatesSorted
serde only.Source§impl SerializeAs<TrieUpdatesSorted> for TrieUpdatesSorted<'_>
Available on crate feature serde-bincode-compat only.
impl SerializeAs<TrieUpdatesSorted> for TrieUpdatesSorted<'_>
serde-bincode-compat only.Source§fn serialize_as<S>(
source: &TrieUpdatesSorted,
serializer: S,
) -> Result<S::Ok, S::Error>where
S: Serializer,
fn serialize_as<S>(
source: &TrieUpdatesSorted,
serializer: S,
) -> Result<S::Ok, S::Error>where
S: Serializer,
impl StructuralPartialEq for TrieUpdatesSorted
Auto Trait Implementations§
impl Freeze for TrieUpdatesSorted
impl RefUnwindSafe for TrieUpdatesSorted
impl Send for TrieUpdatesSorted
impl Sync for TrieUpdatesSorted
impl Unpin for TrieUpdatesSorted
impl UnsafeUnpin for TrieUpdatesSorted
impl UnwindSafe for TrieUpdatesSorted
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreimpl<T> MaybeDebug for Twhere
T: Debug,
impl<T> MaybeSerde for Twhere
T: Serialize + for<'de> Deserialize<'de>,
§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 64 bytes