Struct TrieUpdatesSorted
pub struct TrieUpdatesSorted { /* private fields */ }Expand description
Sorted trie updates used for lookups and insertions.
Implementations§
§impl TrieUpdatesSorted
impl TrieUpdatesSorted
pub fn new(
account_nodes: Vec<(Nibbles, Option<BranchNodeCompact>)>,
storage_tries: HashMap<FixedBytes<32>, StorageTrieUpdatesSorted, FbBuildHasher<32>>,
) -> TrieUpdatesSorted
pub fn new( account_nodes: Vec<(Nibbles, Option<BranchNodeCompact>)>, storage_tries: HashMap<FixedBytes<32>, StorageTrieUpdatesSorted, FbBuildHasher<32>>, ) -> TrieUpdatesSorted
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.
pub fn account_nodes_ref(&self) -> &[(Nibbles, Option<BranchNodeCompact>)]
pub fn account_nodes_ref(&self) -> &[(Nibbles, Option<BranchNodeCompact>)]
Returns reference to updated account nodes.
pub const fn storage_tries_ref(
&self,
) -> &HashMap<FixedBytes<32>, StorageTrieUpdatesSorted, FbBuildHasher<32>>
pub const fn storage_tries_ref( &self, ) -> &HashMap<FixedBytes<32>, StorageTrieUpdatesSorted, FbBuildHasher<32>>
Returns reference to updated storage tries.
pub fn total_len(&self) -> usize
pub fn total_len(&self) -> usize
Returns the total number of updates including account nodes and all storage updates.
pub fn extend_ref_and_sort(&mut self, other: &TrieUpdatesSorted)
pub fn extend_ref_and_sort(&mut self, other: &TrieUpdatesSorted)
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.
pub fn clear(&mut self)
pub fn clear(&mut self)
Clears all account nodes and storage tries.
pub fn merge_batch<T>(iter: impl IntoIterator<Item = T>) -> T
pub fn merge_batch<T>(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.
pub fn merge_slice<T>(items: &[T]) -> TrieUpdatesSortedwhere
T: AsRef<TrieUpdatesSorted>,
pub fn merge_slice<T>(items: &[T]) -> TrieUpdatesSortedwhere
T: AsRef<TrieUpdatesSorted>,
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.
pub fn merge_iter<'a>(
items: impl Iterator<Item = &'a TrieUpdatesSorted> + Clone,
) -> TrieUpdatesSorted
pub fn merge_iter<'a>( items: impl Iterator<Item = &'a TrieUpdatesSorted> + Clone, ) -> TrieUpdatesSorted
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.
pub fn disjointed_merge_batch<'a>(
batch: &[&'a TrieUpdatesSorted],
mask: &[&'a TrieUpdatesSorted],
) -> TrieUpdatesSorted
pub fn disjointed_merge_batch<'a>( batch: &[&'a TrieUpdatesSorted], mask: &[&'a TrieUpdatesSorted], ) -> TrieUpdatesSorted
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§
§impl AsRef<TrieUpdatesSorted> for TrieUpdatesSorted
impl AsRef<TrieUpdatesSorted> for TrieUpdatesSorted
§fn as_ref(&self) -> &TrieUpdatesSorted
fn as_ref(&self) -> &TrieUpdatesSorted
§impl Clone for TrieUpdatesSorted
impl Clone for TrieUpdatesSorted
§fn clone(&self) -> TrieUpdatesSorted
fn clone(&self) -> TrieUpdatesSorted
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for TrieUpdatesSorted
impl Debug for TrieUpdatesSorted
§impl Default for TrieUpdatesSorted
impl Default for TrieUpdatesSorted
§fn default() -> TrieUpdatesSorted
fn default() -> TrieUpdatesSorted
§impl<'de> Deserialize<'de> for TrieUpdatesSorted
impl<'de> Deserialize<'de> for TrieUpdatesSorted
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<TrieUpdatesSorted, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TrieUpdatesSorted, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl<'de> DeserializeAs<'de, TrieUpdatesSorted> for TrieUpdatesSorted<'de>
impl<'de> DeserializeAs<'de, TrieUpdatesSorted> for TrieUpdatesSorted<'de>
§fn deserialize_as<D>(
deserializer: D,
) -> Result<TrieUpdatesSorted, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize_as<D>(
deserializer: D,
) -> Result<TrieUpdatesSorted, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
impl Eq for TrieUpdatesSorted
§impl<'a> From<&'a TrieUpdatesSorted> for TrieUpdatesSorted<'a>
impl<'a> From<&'a TrieUpdatesSorted> for TrieUpdatesSorted<'a>
§fn from(value: &'a TrieUpdatesSorted) -> TrieUpdatesSorted<'a>
fn from(value: &'a TrieUpdatesSorted) -> TrieUpdatesSorted<'a>
§impl<'a> From<TrieUpdatesSorted<'a>> for TrieUpdatesSorted
impl<'a> From<TrieUpdatesSorted<'a>> for TrieUpdatesSorted
§fn from(value: TrieUpdatesSorted<'a>) -> TrieUpdatesSorted
fn from(value: TrieUpdatesSorted<'a>) -> TrieUpdatesSorted
§impl From<TrieUpdatesSorted> for TrieUpdates
impl From<TrieUpdatesSorted> for TrieUpdates
§fn from(sorted: TrieUpdatesSorted) -> TrieUpdates
fn from(sorted: TrieUpdatesSorted) -> TrieUpdates
§impl PartialEq for TrieUpdatesSorted
impl PartialEq for TrieUpdatesSorted
§impl Serialize for TrieUpdatesSorted
impl Serialize for TrieUpdatesSorted
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
§impl SerializeAs<TrieUpdatesSorted> for TrieUpdatesSorted<'_>
impl SerializeAs<TrieUpdatesSorted> for TrieUpdatesSorted<'_>
§fn serialize_as<S>(
source: &TrieUpdatesSorted,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize_as<S>(
source: &TrieUpdatesSorted,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> 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> ⓘ
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§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>,
Source§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