Struct sp_trie::cache::TrieCache

source ·
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>

source

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>

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>>

Get or insert a NodeOwned. Read more
source§

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>>

Lookup value for the given key. Read more
source§

fn cache_value_for_key(&mut self, key: &[u8], data: CachedValue<H::Out>)

Cache the given value for the given key. Read more

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§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, Outer> IsWrappedBy<Outer> for T
where Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,

source§

fn from_ref(outer: &Outer) -> &T

Get a reference to the inner from the outer.

source§

fn from_mut(outer: &mut Outer) -> &mut T

Get a mutable reference to the inner from the outer.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<S, T> UncheckedInto<T> for S
where T: UncheckedFrom<S>,

source§

fn unchecked_into(self) -> T

The counterpart to unchecked_from.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> JsonSchemaMaybe for T