Struct sp_trie::cache::SharedTrieCache
source · pub struct SharedTrieCache<H: Hasher> { /* private fields */ }Expand description
The shared trie cache.
It should be instantiated once per node. It will hold the trie nodes and values of all
operations to the state. To not use all available memory it will ensure to stay in the
bounds given via the CacheSize at startup.
The instance of this object can be shared between multiple threads.
Implementations§
sourcepub fn new(cache_size: CacheSize) -> Self
pub fn new(cache_size: CacheSize) -> Self
Create a new SharedTrieCache.
sourcepub fn local_cache(&self) -> LocalTrieCache<H>
pub fn local_cache(&self) -> LocalTrieCache<H>
Create a new LocalTrieCache instance from this shared cache.
sourcepub fn used_memory_size(&self) -> usize
pub fn used_memory_size(&self) -> usize
Returns the used memory size of this cache in bytes.
sourcepub fn reset_node_cache(&self)
pub fn reset_node_cache(&self)
Reset the node cache.
sourcepub fn reset_value_cache(&self)
pub fn reset_value_cache(&self)
Reset the value cache.
Trait Implementations§
Auto Trait Implementations§
Blanket Implementations§
§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. Read more§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. Read more§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. Read more§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. Read morefn __clone_box(&self, _: Private) -> *mut ()
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§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
The counterpart to
unchecked_from.