[−][src]Struct sp_state_machine::InMemoryBackend
In-memory backend. Fully recomputes tries each time as_trie_backend
is called but useful for
tests and proof checking.
Methods
impl<H: Hasher> InMemory<H>
[src]
pub fn update<T: IntoIterator<Item = (Option<(StorageKey, OwnedChildInfo)>, StorageCollection)>>(
&self,
changes: T
) -> Self
[src]
&self,
changes: T
) -> Self
Copy the state, with applied updates
impl<H: Hasher> InMemory<H>
[src]
pub fn child_storage_keys(&self) -> impl Iterator<Item = (&[u8], ChildInfo)>
[src]
child storage key iterator
Trait Implementations
impl<H: Hasher> Backend<H> for InMemory<H> where
H::Out: Codec,
[src]
H::Out: Codec,
type Error = Void
An error type when fetching data is not possible.
type Transaction = Vec<(Option<(StorageKey, OwnedChildInfo)>, StorageCollection)>
Storage changes to be applied if committing
type TrieBackendStorage = MemoryDB<H>
Type of trie backend storage.
fn storage(&self, key: &[u8]) -> Result<Option<StorageValue>, Self::Error>
[src]
fn child_storage(
&self,
storage_key: &[u8],
child_info: ChildInfo,
key: &[u8]
) -> Result<Option<StorageValue>, Self::Error>
[src]
&self,
storage_key: &[u8],
child_info: ChildInfo,
key: &[u8]
) -> Result<Option<StorageValue>, Self::Error>
fn exists_storage(&self, key: &[u8]) -> Result<bool, Self::Error>
[src]
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,
storage_key: &[u8],
child_info: ChildInfo,
f: F
)
[src]
&self,
storage_key: &[u8],
child_info: ChildInfo,
f: F
)
fn for_child_keys_with_prefix<F: FnMut(&[u8])>(
&self,
storage_key: &[u8],
child_info: ChildInfo,
prefix: &[u8],
f: F
)
[src]
&self,
storage_key: &[u8],
child_info: ChildInfo,
prefix: &[u8],
f: F
)
fn storage_root<I>(&self, delta: I) -> (H::Out, Self::Transaction) where
I: IntoIterator<Item = (Vec<u8>, Option<Vec<u8>>)>,
<H as Hasher>::Out: Ord,
[src]
I: IntoIterator<Item = (Vec<u8>, Option<Vec<u8>>)>,
<H as Hasher>::Out: Ord,
fn child_storage_root<I>(
&self,
storage_key: &[u8],
child_info: ChildInfo,
delta: I
) -> (H::Out, bool, Self::Transaction) where
I: IntoIterator<Item = (Vec<u8>, Option<Vec<u8>>)>,
H::Out: Ord,
[src]
&self,
storage_key: &[u8],
child_info: ChildInfo,
delta: I
) -> (H::Out, bool, Self::Transaction) where
I: IntoIterator<Item = (Vec<u8>, Option<Vec<u8>>)>,
H::Out: Ord,
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,
storage_key: &[u8],
child_info: ChildInfo,
key: &[u8]
) -> Result<Option<StorageKey>, Self::Error>
[src]
&self,
storage_key: &[u8],
child_info: ChildInfo,
key: &[u8]
) -> Result<Option<StorageKey>, Self::Error>
fn pairs(&self) -> Vec<(StorageKey, StorageValue)>
[src]
fn keys(&self, prefix: &[u8]) -> Vec<StorageKey>
[src]
fn child_keys(
&self,
storage_key: &[u8],
child_info: ChildInfo,
prefix: &[u8]
) -> Vec<StorageKey>
[src]
&self,
storage_key: &[u8],
child_info: ChildInfo,
prefix: &[u8]
) -> Vec<StorageKey>
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,
storage_key: &[u8],
child_info: ChildInfo,
key: &[u8]
) -> Result<Option<H::Out>, Self::Error>
[src]
&self,
storage_key: &[u8],
child_info: ChildInfo,
key: &[u8]
) -> Result<Option<H::Out>, Self::Error>
fn exists_child_storage(
&self,
storage_key: &[u8],
child_info: ChildInfo,
key: &[u8]
) -> Result<bool, Self::Error>
[src]
&self,
storage_key: &[u8],
child_info: ChildInfo,
key: &[u8]
) -> Result<bool, Self::Error>
fn full_storage_root<I1, I2i, I2>(
&self,
delta: I1,
child_deltas: I2
) -> (H::Out, Self::Transaction) where
I1: IntoIterator<Item = (StorageKey, Option<StorageValue>)>,
I2i: IntoIterator<Item = (StorageKey, Option<StorageValue>)>,
I2: IntoIterator<Item = (StorageKey, I2i, OwnedChildInfo)>,
H::Out: Ord + Encode,
[src]
&self,
delta: I1,
child_deltas: I2
) -> (H::Out, Self::Transaction) where
I1: IntoIterator<Item = (StorageKey, Option<StorageValue>)>,
I2i: IntoIterator<Item = (StorageKey, Option<StorageValue>)>,
I2: IntoIterator<Item = (StorageKey, I2i, OwnedChildInfo)>,
H::Out: Ord + Encode,
fn commit(
&self,
_storage_root: H::Out,
_transaction: Self::Transaction
) -> Result<(), Self::Error>
[src]
&self,
_storage_root: H::Out,
_transaction: Self::Transaction
) -> Result<(), Self::Error>
impl<H: Hasher> Clone for InMemory<H>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<H: Hasher> Debug for InMemory<H>
[src]
impl<H: Hasher> Default for InMemory<H>
[src]
impl<H: Hasher> From<BTreeMap<Vec<u8>, Vec<u8>>> for InMemory<H>
[src]
fn from(inner: BTreeMap<StorageKey, StorageValue>) -> Self
[src]
impl<H: Hasher> From<HashMap<Option<(Vec<u8>, OwnedChildInfo)>, BTreeMap<Vec<u8>, Vec<u8>>, RandomState>> for InMemory<H>
[src]
fn from(
inner: HashMap<Option<(StorageKey, OwnedChildInfo)>, BTreeMap<StorageKey, StorageValue>>
) -> Self
[src]
inner: HashMap<Option<(StorageKey, OwnedChildInfo)>, BTreeMap<StorageKey, StorageValue>>
) -> Self
impl<H: Hasher> From<Storage> for InMemory<H>
[src]
impl<H: Hasher> From<Vec<(Option<(Vec<u8>, OwnedChildInfo)>, Vec<(Vec<u8>, Option<Vec<u8>>)>)>> for InMemory<H>
[src]
fn from(
inner: Vec<(Option<(StorageKey, OwnedChildInfo)>, StorageCollection)>
) -> Self
[src]
inner: Vec<(Option<(StorageKey, OwnedChildInfo)>, StorageCollection)>
) -> Self
impl<H: Hasher> PartialEq<InMemory<H>> for InMemory<H>
[src]
Auto Trait Implementations
impl<H> RefUnwindSafe for InMemory<H> where
H: RefUnwindSafe,
<H as Hasher>::Out: RefUnwindSafe,
H: RefUnwindSafe,
<H as Hasher>::Out: RefUnwindSafe,
impl<H> Send for InMemory<H> where
<H as Hasher>::Out: Send,
<H as Hasher>::Out: Send,
impl<H> Sync for InMemory<H> where
<H as Hasher>::Out: Sync,
<H as Hasher>::Out: Sync,
impl<H> Unpin for InMemory<H> where
H: Unpin,
<H as Hasher>::Out: Unpin,
H: Unpin,
<H as Hasher>::Out: Unpin,
impl<H> UnwindSafe for InMemory<H> where
H: UnwindSafe,
<H as Hasher>::Out: UnwindSafe,
H: 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,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Clear for T where
T: InitializableFromZeroed + ?Sized,
T: InitializableFromZeroed + ?Sized,
fn clear(&mut self)
impl<T> From<T> for T
[src]
impl<T> InitializableFromZeroed for T where
T: Default,
T: Default,
unsafe fn initialize(place: *mut T)
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, Outer> IsWrappedBy<Outer> for T where
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
[src]
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
fn from_ref(outer: &Outer) -> &T
[src]
Get a reference to the inner from the outer.
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,
T: Debug,
impl<T> MaybeRefUnwindSafe for T where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Same<T> for T
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.
fn to_owned(&self) -> T
[src]
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.
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.
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>,
fn unchecked_into(self) -> T
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,