pub struct TrieCache<'a, H: Hasher> { /* private fields */ }
Expand description
The actual TrieCache
implementation.
If this instance was created for using it with a TrieDBMut
, it needs to
be merged back into the LocalTrieCache
with Self::merge_into
after all operations are
done.
Implementations§
source§impl<'a, H: Hasher> TrieCache<'a, H>
impl<'a, H: Hasher> TrieCache<'a, H>
sourcepub fn merge_into(self, local: &LocalTrieCache<H>, storage_root: H::Out)
pub fn merge_into(self, local: &LocalTrieCache<H>, storage_root: H::Out)
Merge this cache into the given LocalTrieCache
.
This function is only required to be called when this instance was created through
LocalTrieCache::as_trie_db_mut_cache
, otherwise this method is a no-op. The given
storage_root
is the new storage root that was obtained after finishing all operations
using the TrieDBMut
.
Trait Implementations§
source§impl<'a, H: Hasher> TrieCache<NodeCodec<H>> for TrieCache<'a, H>
impl<'a, H: Hasher> TrieCache<NodeCodec<H>> for TrieCache<'a, H>
source§fn get_or_insert_node(
&mut self,
hash: H::Out,
fetch_node: &mut dyn FnMut() -> Result<NodeOwned<H::Out>, H::Out, Error<H::Out>>,
) -> Result<&NodeOwned<H::Out>, H::Out, Error<H::Out>>
fn get_or_insert_node( &mut self, hash: H::Out, fetch_node: &mut dyn FnMut() -> Result<NodeOwned<H::Out>, H::Out, Error<H::Out>>, ) -> Result<&NodeOwned<H::Out>, H::Out, Error<H::Out>>
source§fn get_node(&mut self, hash: &H::Out) -> Option<&NodeOwned<H::Out>>
fn get_node(&mut self, hash: &H::Out) -> Option<&NodeOwned<H::Out>>
Get the
NodeOwned
that corresponds to the given hash
.source§fn lookup_value_for_key(&mut self, key: &[u8]) -> Option<&CachedValue<H::Out>>
fn lookup_value_for_key(&mut self, key: &[u8]) -> Option<&CachedValue<H::Out>>
Lookup value for the given
key
. Read moresource§fn cache_value_for_key(&mut self, key: &[u8], data: CachedValue<H::Out>)
fn cache_value_for_key(&mut self, key: &[u8], data: CachedValue<H::Out>)
Auto Trait Implementations§
impl<'a, H> Freeze for TrieCache<'a, H>
impl<'a, H> !RefUnwindSafe for TrieCache<'a, H>
impl<'a, H> !Send for TrieCache<'a, H>
impl<'a, H> Sync for TrieCache<'a, H>
impl<'a, H> Unpin for TrieCache<'a, H>
impl<'a, H> !UnwindSafe for TrieCache<'a, H>
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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 moresource§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
source§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
The counterpart to
unchecked_from
.