Struct sp_state_machine::TrieBackend [−][src]
Patricia trie-based backend. Transaction type is an overlay of changes to commit.
Implementations
impl<H: Hasher> TrieBackend<MemoryDB<H>, H> where
H::Out: Codec + Ord,
[src]
H::Out: Codec + Ord,
pub fn update<T: IntoIterator<Item = (Option<ChildInfo>, StorageCollection)>>(
&self,
changes: T
) -> Self
[src]
&self,
changes: T
) -> Self
Copy the state, with applied updates
pub fn insert<T: IntoIterator<Item = (Option<ChildInfo>, StorageCollection)>>(
&mut self,
changes: T
)
[src]
&mut self,
changes: T
)
Insert values into backend trie.
pub fn update_backend(&self, root: H::Out, changes: MemoryDB<H>) -> Self
[src]
Merge trie nodes into this backend.
pub fn eq(&self, other: &Self) -> bool
[src]
Compare with another in-memory backend.
impl<S: TrieBackendStorage<H>, H: Hasher> TrieBackend<S, H> where
H::Out: Codec,
[src]
H::Out: Codec,
pub fn new(storage: S, root: H::Out) -> Self
[src]
Create new trie-based backend.
pub fn essence(&self) -> &TrieBackendEssence<S, H>
[src]
Get backend essence reference.
pub fn backend_storage(&self) -> &S
[src]
Get backend storage reference.
pub fn backend_storage_mut(&mut self) -> &mut S
[src]
Get backend storage reference.
pub fn root(&self) -> &H::Out
[src]
Get trie root.
pub fn into_storage(self) -> S
[src]
Consumes self and returns underlying storage.
Trait Implementations
impl<S: TrieBackendStorage<H>, H: Hasher> Backend<H> for TrieBackend<S, H> where
H::Out: Ord + Codec,
[src]
H::Out: Ord + Codec,
type Error = DefaultError
An error type when fetching data is not possible.
type Transaction = S::Overlay
Storage changes to be applied if committing
type TrieBackendStorage = S
Type of trie backend storage.
fn storage(&self, key: &[u8]) -> Result<Option<StorageValue>, Self::Error>
[src]
fn child_storage(
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<StorageValue>, Self::Error>
[src]
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<StorageValue>, Self::Error>
fn next_storage_key(
&self,
key: &[u8]
) -> Result<Option<StorageKey>, Self::Error>
[src]
&self,
key: &[u8]
) -> Result<Option<StorageKey>, Self::Error>
fn next_child_storage_key(
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<StorageKey>, Self::Error>
[src]
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<StorageKey>, Self::Error>
fn for_keys_with_prefix<F: FnMut(&[u8])>(&self, prefix: &[u8], f: F)
[src]
fn for_key_values_with_prefix<F: FnMut(&[u8], &[u8])>(
&self,
prefix: &[u8],
f: F
)
[src]
&self,
prefix: &[u8],
f: F
)
fn for_keys_in_child_storage<F: FnMut(&[u8])>(
&self,
child_info: &ChildInfo,
f: F
)
[src]
&self,
child_info: &ChildInfo,
f: F
)
fn for_child_keys_with_prefix<F: FnMut(&[u8])>(
&self,
child_info: &ChildInfo,
prefix: &[u8],
f: F
)
[src]
&self,
child_info: &ChildInfo,
prefix: &[u8],
f: F
)
fn pairs(&self) -> Vec<(StorageKey, StorageValue)>
[src]
fn keys(&self, prefix: &[u8]) -> Vec<StorageKey>
[src]
fn storage_root<'a>(
&self,
delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>
) -> (H::Out, Self::Transaction) where
H::Out: Ord,
[src]
&self,
delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>
) -> (H::Out, Self::Transaction) where
H::Out: Ord,
fn child_storage_root<'a>(
&self,
child_info: &ChildInfo,
delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>
) -> (H::Out, bool, Self::Transaction) where
H::Out: Ord,
[src]
&self,
child_info: &ChildInfo,
delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>
) -> (H::Out, bool, Self::Transaction) where
H::Out: Ord,
fn as_trie_backend(
&mut self
) -> Option<&TrieBackend<Self::TrieBackendStorage, H>>
[src]
&mut self
) -> Option<&TrieBackend<Self::TrieBackendStorage, H>>
fn register_overlay_stats(&mut self, _stats: &StateMachineStats)
[src]
fn usage_info(&self) -> UsageInfo
[src]
fn wipe(&self) -> Result<(), Self::Error>
[src]
fn storage_hash(&self, key: &[u8]) -> Result<Option<H::Out>, Self::Error>
[src]
fn child_storage_hash(
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<H::Out>, Self::Error>
[src]
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<H::Out>, Self::Error>
fn exists_storage(&self, key: &[u8]) -> Result<bool, Self::Error>
[src]
fn exists_child_storage(
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<bool, Self::Error>
[src]
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<bool, Self::Error>
fn child_keys(&self, child_info: &ChildInfo, prefix: &[u8]) -> Vec<StorageKey>
[src]
fn full_storage_root<'a>(
&self,
delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>,
child_deltas: impl Iterator<Item = (&'a ChildInfo, impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>)>
) -> (H::Out, Self::Transaction) where
H::Out: Ord + Encode,
[src]
&self,
delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>,
child_deltas: impl Iterator<Item = (&'a ChildInfo, impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>)>
) -> (H::Out, Self::Transaction) where
H::Out: Ord + Encode,
fn commit(
&self,
_: H::Out,
_: Self::Transaction,
_: StorageCollection,
_: ChildStorageCollection
) -> Result<(), Self::Error>
[src]
&self,
_: H::Out,
_: Self::Transaction,
_: StorageCollection,
_: ChildStorageCollection
) -> Result<(), Self::Error>
fn read_write_count(&self) -> (u32, u32, u32, u32)
[src]
fn reset_read_write_count(&self)
[src]
fn get_whitelist(&self) -> Vec<TrackedStorageKey>
[src]
fn set_whitelist(&self, _: Vec<TrackedStorageKey>)
[src]
impl<H: Hasher> Clone for TrieBackend<MemoryDB<H>, H> where
H::Out: Codec + Ord,
[src]
H::Out: Codec + Ord,
fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<S: TrieBackendStorage<H>, H: Hasher> Debug for TrieBackend<S, H>
[src]
impl<H: Hasher> Default for TrieBackend<MemoryDB<H>, H> where
H::Out: Codec + Ord,
[src]
H::Out: Codec + Ord,
impl<H: Hasher> From<BTreeMap<Vec<u8, Global>, Vec<u8, Global>>> for TrieBackend<MemoryDB<H>, H> where
H::Out: Codec + Ord,
[src]
H::Out: Codec + Ord,
fn from(inner: BTreeMap<StorageKey, StorageValue>) -> Self
[src]
impl<H: Hasher> From<HashMap<Option<ChildInfo>, BTreeMap<Vec<u8, Global>, Vec<u8, Global>>, RandomState>> for TrieBackend<MemoryDB<H>, H> where
H::Out: Codec + Ord,
[src]
H::Out: Codec + Ord,
fn from(
inner: HashMap<Option<ChildInfo>, BTreeMap<StorageKey, StorageValue>>
) -> Self
[src]
inner: HashMap<Option<ChildInfo>, BTreeMap<StorageKey, StorageValue>>
) -> Self
impl<H: Hasher> From<Storage> for TrieBackend<MemoryDB<H>, H> where
H::Out: Codec + Ord,
[src]
H::Out: Codec + Ord,
impl<H: Hasher> From<Vec<(Option<ChildInfo>, Vec<(Vec<u8, Global>, Option<Vec<u8, Global>>), Global>), Global>> for TrieBackend<MemoryDB<H>, H> where
H::Out: Codec + Ord,
[src]
H::Out: Codec + Ord,
Auto Trait Implementations
impl<S, H> RefUnwindSafe for TrieBackend<S, H> where
S: RefUnwindSafe,
<H as Hasher>::Out: RefUnwindSafe,
S: RefUnwindSafe,
<H as Hasher>::Out: RefUnwindSafe,
impl<S, H> Send for TrieBackend<S, H>
impl<S, H> Sync for TrieBackend<S, H>
impl<S, H> Unpin for TrieBackend<S, H> where
S: Unpin,
<H as Hasher>::Out: Unpin,
S: Unpin,
<H as Hasher>::Out: Unpin,
impl<S, H> UnwindSafe for TrieBackend<S, H> where
S: UnwindSafe,
<H as Hasher>::Out: UnwindSafe,
S: UnwindSafe,
<H as Hasher>::Out: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DynClone for T where
T: Clone,
[src]
T: Clone,
pub fn __clone_box(&self, Private) -> *mut ()
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, Outer> IsWrappedBy<Outer> for T where
T: From<Outer>,
Outer: AsRef<T> + AsMut<T> + From<T>,
[src]
T: From<Outer>,
Outer: AsRef<T> + AsMut<T> + From<T>,
pub fn from_ref(outer: &Outer) -> &T
[src]
Get a reference to the inner from the outer.
pub fn from_mut(outer: &mut Outer) -> &mut T
[src]
Get a mutable reference to the inner from the outer.
impl<T> MaybeDebug for T where
T: Debug,
[src]
T: Debug,
impl<T> MaybeDebug for T where
T: Debug,
[src]
T: Debug,
impl<T> MaybeRefUnwindSafe for T where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<T> Pointable for T
[src]
pub const ALIGN: usize
[src]
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
[src]
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
[src]
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
[src]
pub unsafe fn drop(ptr: usize)
[src]
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
[src]
T: UncheckedFrom<S>,
pub fn unchecked_into(self) -> T
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,