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> !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>where <H as Hasher>::Out: Unpin,
impl<'a, H> !UnwindSafe for TrieCache<'a, H>
Blanket Implementations§
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.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, Outer> IsWrappedBy<Outer> for Twhere
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for Twhere Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,
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
.