[−]Trait polymesh::service::StateBackend
A state backend is used to read state data and can have changes committed to it.
The clone operation (if implemented) should be cheap.
Associated Types
type Error: Error
An error type when fetching data is not possible.
type Transaction: Consolidate + Default + Send
Storage changes to be applied if committing
type TrieBackendStorage: TrieBackendStorage<H>
Type of trie backend storage.
Required methods
pub fn storage(
&self,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, Self::Error>
&self,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, Self::Error>
Get keyed storage or None if there is nothing associated.
pub fn child_storage(
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, Self::Error>
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, Self::Error>
Get keyed child storage or None if there is nothing associated.
pub fn next_storage_key(
&self,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, Self::Error>
&self,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, Self::Error>
Return the next key in storage in lexicographic order or None
if there is no value.
pub fn next_child_storage_key(
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, Self::Error>
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, Self::Error>
Return the next key in child storage in lexicographic order or None
if there is no value.
pub fn for_keys_in_child_storage<F>(&self, child_info: &ChildInfo, f: F) where
F: FnMut(&[u8]),
F: FnMut(&[u8]),
Retrieve all entries keys of child storage and call f
for each of those keys.
pub fn for_key_values_with_prefix<F>(&self, prefix: &[u8], f: F) where
F: FnMut(&[u8], &[u8]),
F: FnMut(&[u8], &[u8]),
Retrieve all entries keys and values of which start with the given prefix and
call f
for each of those keys.
pub fn for_child_keys_with_prefix<F>(
&self,
child_info: &ChildInfo,
prefix: &[u8],
f: F
) where
F: FnMut(&[u8]),
&self,
child_info: &ChildInfo,
prefix: &[u8],
f: F
) where
F: FnMut(&[u8]),
Retrieve all child entries keys which start with the given prefix and
call f
for each of those keys.
pub fn storage_root<'a>(
&self,
delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>
) -> (<H as Hasher>::Out, Self::Transaction) where
<H as Hasher>::Out: Ord,
&self,
delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>
) -> (<H as Hasher>::Out, Self::Transaction) where
<H as Hasher>::Out: Ord,
Calculate the storage root, with given delta over what is already stored in the backend, and produce a "transaction" that can be used to commit. Does not include child storage updates.
pub fn child_storage_root<'a>(
&self,
child_info: &ChildInfo,
delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>
) -> (<H as Hasher>::Out, bool, Self::Transaction) where
<H as Hasher>::Out: Ord,
&self,
child_info: &ChildInfo,
delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>
) -> (<H as Hasher>::Out, bool, Self::Transaction) where
<H as Hasher>::Out: Ord,
Calculate the child storage root, with given delta over what is already stored in the backend, and produce a "transaction" that can be used to commit. The second argument is true if child storage root equals default storage root.
pub fn pairs(&self) -> Vec<(Vec<u8, Global>, Vec<u8, Global>), Global>
Get all key/value pairs into a Vec.
pub fn register_overlay_stats(&mut self, _stats: &StateMachineStats)
Register stats from overlay of state machine.
By default nothing is registered.
pub fn usage_info(&self) -> UsageInfo
Query backend usage statistics (i/o, memory)
Not all implementations are expected to be able to do this. In the case when they don't, empty statistics is returned.
Provided methods
pub fn storage_hash(
&self,
key: &[u8]
) -> Result<Option<<H as Hasher>::Out>, Self::Error>
&self,
key: &[u8]
) -> Result<Option<<H as Hasher>::Out>, Self::Error>
Get keyed storage value hash or None if there is nothing associated.
pub fn child_storage_hash(
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<<H as Hasher>::Out>, Self::Error>
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<<H as Hasher>::Out>, Self::Error>
Get child keyed storage value hash or None if there is nothing associated.
pub fn exists_storage(&self, key: &[u8]) -> Result<bool, Self::Error>
true if a key exists in storage.
pub fn exists_child_storage(
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<bool, Self::Error>
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<bool, Self::Error>
true if a key exists in child storage.
pub fn for_keys_with_prefix<F>(&self, prefix: &[u8], f: F) where
F: FnMut(&[u8]),
F: FnMut(&[u8]),
Retrieve all entries keys which start with the given prefix and
call f
for each of those keys.
pub fn keys(&self, prefix: &[u8]) -> Vec<Vec<u8, Global>, Global>
Get all keys with given prefix
pub fn child_keys(
&self,
child_info: &ChildInfo,
prefix: &[u8]
) -> Vec<Vec<u8, Global>, Global>
&self,
child_info: &ChildInfo,
prefix: &[u8]
) -> Vec<Vec<u8, Global>, Global>
Get all keys of child storage with given prefix
pub fn as_trie_backend(
&mut self
) -> Option<&TrieBackend<Self::TrieBackendStorage, H>>
&mut self
) -> Option<&TrieBackend<Self::TrieBackendStorage, H>>
Try convert into trie backend.
pub 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 as Hasher>::Out, Self::Transaction) where
<H as Hasher>::Out: Ord,
<H as Hasher>::Out: Encode,
&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 as Hasher>::Out, Self::Transaction) where
<H as Hasher>::Out: Ord,
<H as Hasher>::Out: Encode,
Calculate the storage root, with given delta over what is already stored in the backend, and produce a "transaction" that can be used to commit. Does include child storage updates.
pub fn wipe(&self) -> Result<(), Self::Error>
Wipe the state database.
pub fn commit(
&self,
<H as Hasher>::Out,
Self::Transaction,
Vec<(Vec<u8, Global>, Option<Vec<u8, Global>>), Global>,
Vec<(Vec<u8, Global>, Vec<(Vec<u8, Global>, Option<Vec<u8, Global>>), Global>), Global>
) -> Result<(), Self::Error>
&self,
<H as Hasher>::Out,
Self::Transaction,
Vec<(Vec<u8, Global>, Option<Vec<u8, Global>>), Global>,
Vec<(Vec<u8, Global>, Vec<(Vec<u8, Global>, Option<Vec<u8, Global>>), Global>), Global>
) -> Result<(), Self::Error>
Commit given transaction to storage.
pub fn read_write_count(&self) -> (u32, u32, u32, u32)
Get the read/write count of the db
pub fn reset_read_write_count(&self)
Get the read/write count of the db
pub fn get_whitelist(&self) -> Vec<TrackedStorageKey, Global>
Get the whitelist for tracking db reads/writes
pub fn set_whitelist(&self, Vec<TrackedStorageKey, Global>)
Update the whitelist for tracking db reads/writes
Implementations on Foreign Types
impl<'a, T, H> Backend<H> for &'a T where
H: Hasher,
T: Backend<H>,
H: Hasher,
T: Backend<H>,
type Error = <T as Backend<H>>::Error
type Transaction = <T as Backend<H>>::Transaction
type TrieBackendStorage = <T as Backend<H>>::TrieBackendStorage
pub fn storage(
&self,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <&'a T as Backend<H>>::Error>
&self,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <&'a T as Backend<H>>::Error>
pub fn child_storage(
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <&'a T as Backend<H>>::Error>
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <&'a T as Backend<H>>::Error>
pub fn for_keys_in_child_storage<F>(&self, child_info: &ChildInfo, f: F) where
F: FnMut(&[u8]),
F: FnMut(&[u8]),
pub fn next_storage_key(
&self,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <&'a T as Backend<H>>::Error>
&self,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <&'a T as Backend<H>>::Error>
pub fn next_child_storage_key(
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <&'a T as Backend<H>>::Error>
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <&'a T as Backend<H>>::Error>
pub fn for_keys_with_prefix<F>(&self, prefix: &[u8], f: F) where
F: FnMut(&[u8]),
F: FnMut(&[u8]),
pub fn for_child_keys_with_prefix<F>(
&self,
child_info: &ChildInfo,
prefix: &[u8],
f: F
) where
F: FnMut(&[u8]),
&self,
child_info: &ChildInfo,
prefix: &[u8],
f: F
) where
F: FnMut(&[u8]),
pub fn storage_root<'b>(
&self,
delta: impl Iterator<Item = (&'b [u8], Option<&'b [u8]>)>
) -> (<H as Hasher>::Out, <&'a T as Backend<H>>::Transaction) where
<H as Hasher>::Out: Ord,
&self,
delta: impl Iterator<Item = (&'b [u8], Option<&'b [u8]>)>
) -> (<H as Hasher>::Out, <&'a T as Backend<H>>::Transaction) where
<H as Hasher>::Out: Ord,
pub fn child_storage_root<'b>(
&self,
child_info: &ChildInfo,
delta: impl Iterator<Item = (&'b [u8], Option<&'b [u8]>)>
) -> (<H as Hasher>::Out, bool, <&'a T as Backend<H>>::Transaction) where
<H as Hasher>::Out: Ord,
&self,
child_info: &ChildInfo,
delta: impl Iterator<Item = (&'b [u8], Option<&'b [u8]>)>
) -> (<H as Hasher>::Out, bool, <&'a T as Backend<H>>::Transaction) where
<H as Hasher>::Out: Ord,
pub fn pairs(&self) -> Vec<(Vec<u8, Global>, Vec<u8, Global>), Global>
pub fn for_key_values_with_prefix<F>(&self, prefix: &[u8], f: F) where
F: FnMut(&[u8], &[u8]),
F: FnMut(&[u8], &[u8]),
pub fn register_overlay_stats(&mut self, _stats: &StateMachineStats)
pub fn usage_info(&self) -> UsageInfo
impl<'a, S, H> Backend<H> for ProvingBackend<'a, S, H> where
H: 'a + Hasher,
S: 'a + TrieBackendStorage<H>,
<H as Hasher>::Out: Ord,
<H as Hasher>::Out: Codec,
H: 'a + Hasher,
S: 'a + TrieBackendStorage<H>,
<H as Hasher>::Out: Ord,
<H as Hasher>::Out: Codec,
type Error = String
type Transaction = <S as TrieBackendStorage<H>>::Overlay
type TrieBackendStorage = S
pub fn storage(
&self,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <ProvingBackend<'a, S, H> as Backend<H>>::Error>
&self,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <ProvingBackend<'a, S, H> as Backend<H>>::Error>
pub fn child_storage(
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <ProvingBackend<'a, S, H> as Backend<H>>::Error>
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <ProvingBackend<'a, S, H> as Backend<H>>::Error>
pub fn for_keys_in_child_storage<F>(&self, child_info: &ChildInfo, f: F) where
F: FnMut(&[u8]),
F: FnMut(&[u8]),
pub fn next_storage_key(
&self,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <ProvingBackend<'a, S, H> as Backend<H>>::Error>
&self,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <ProvingBackend<'a, S, H> as Backend<H>>::Error>
pub fn next_child_storage_key(
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <ProvingBackend<'a, S, H> as Backend<H>>::Error>
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <ProvingBackend<'a, S, H> as Backend<H>>::Error>
pub fn for_keys_with_prefix<F>(&self, prefix: &[u8], f: F) where
F: FnMut(&[u8]),
F: FnMut(&[u8]),
pub fn for_key_values_with_prefix<F>(&self, prefix: &[u8], f: F) where
F: FnMut(&[u8], &[u8]),
F: FnMut(&[u8], &[u8]),
pub fn for_child_keys_with_prefix<F>(
&self,
child_info: &ChildInfo,
prefix: &[u8],
f: F
) where
F: FnMut(&[u8]),
&self,
child_info: &ChildInfo,
prefix: &[u8],
f: F
) where
F: FnMut(&[u8]),
pub fn pairs(&self) -> Vec<(Vec<u8, Global>, Vec<u8, Global>), Global>
pub fn keys(&self, prefix: &[u8]) -> Vec<Vec<u8, Global>, Global>
pub fn child_keys(
&self,
child_info: &ChildInfo,
prefix: &[u8]
) -> Vec<Vec<u8, Global>, Global>
&self,
child_info: &ChildInfo,
prefix: &[u8]
) -> Vec<Vec<u8, Global>, Global>
pub fn storage_root<'b>(
&self,
delta: impl Iterator<Item = (&'b [u8], Option<&'b [u8]>)>
) -> (<H as Hasher>::Out, <ProvingBackend<'a, S, H> as Backend<H>>::Transaction) where
<H as Hasher>::Out: Ord,
&self,
delta: impl Iterator<Item = (&'b [u8], Option<&'b [u8]>)>
) -> (<H as Hasher>::Out, <ProvingBackend<'a, S, H> as Backend<H>>::Transaction) where
<H as Hasher>::Out: Ord,
pub fn child_storage_root<'b>(
&self,
child_info: &ChildInfo,
delta: impl Iterator<Item = (&'b [u8], Option<&'b [u8]>)>
) -> (<H as Hasher>::Out, bool, <ProvingBackend<'a, S, H> as Backend<H>>::Transaction) where
<H as Hasher>::Out: Ord,
&self,
child_info: &ChildInfo,
delta: impl Iterator<Item = (&'b [u8], Option<&'b [u8]>)>
) -> (<H as Hasher>::Out, bool, <ProvingBackend<'a, S, H> as Backend<H>>::Transaction) where
<H as Hasher>::Out: Ord,
pub fn register_overlay_stats(&mut self, _stats: &StateMachineStats)
pub fn usage_info(&self) -> UsageInfo
impl<S, H> Backend<H> for TrieBackend<S, H> where
H: Hasher,
S: TrieBackendStorage<H>,
<H as Hasher>::Out: Ord,
<H as Hasher>::Out: Codec,
H: Hasher,
S: TrieBackendStorage<H>,
<H as Hasher>::Out: Ord,
<H as Hasher>::Out: Codec,
type Error = String
type Transaction = <S as TrieBackendStorage<H>>::Overlay
type TrieBackendStorage = S
pub fn storage(
&self,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <TrieBackend<S, H> as Backend<H>>::Error>
&self,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <TrieBackend<S, H> as Backend<H>>::Error>
pub fn child_storage(
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <TrieBackend<S, H> as Backend<H>>::Error>
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <TrieBackend<S, H> as Backend<H>>::Error>
pub fn next_storage_key(
&self,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <TrieBackend<S, H> as Backend<H>>::Error>
&self,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <TrieBackend<S, H> as Backend<H>>::Error>
pub fn next_child_storage_key(
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <TrieBackend<S, H> as Backend<H>>::Error>
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <TrieBackend<S, H> as Backend<H>>::Error>
pub fn for_keys_with_prefix<F>(&self, prefix: &[u8], f: F) where
F: FnMut(&[u8]),
F: FnMut(&[u8]),
pub fn for_key_values_with_prefix<F>(&self, prefix: &[u8], f: F) where
F: FnMut(&[u8], &[u8]),
F: FnMut(&[u8], &[u8]),
pub fn for_keys_in_child_storage<F>(&self, child_info: &ChildInfo, f: F) where
F: FnMut(&[u8]),
F: FnMut(&[u8]),
pub fn for_child_keys_with_prefix<F>(
&self,
child_info: &ChildInfo,
prefix: &[u8],
f: F
) where
F: FnMut(&[u8]),
&self,
child_info: &ChildInfo,
prefix: &[u8],
f: F
) where
F: FnMut(&[u8]),
pub fn pairs(&self) -> Vec<(Vec<u8, Global>, Vec<u8, Global>), Global>
pub fn keys(&self, prefix: &[u8]) -> Vec<Vec<u8, Global>, Global>
pub fn storage_root<'a>(
&self,
delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>
) -> (<H as Hasher>::Out, <TrieBackend<S, H> as Backend<H>>::Transaction) where
<H as Hasher>::Out: Ord,
&self,
delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>
) -> (<H as Hasher>::Out, <TrieBackend<S, H> as Backend<H>>::Transaction) where
<H as Hasher>::Out: Ord,
pub fn child_storage_root<'a>(
&self,
child_info: &ChildInfo,
delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>
) -> (<H as Hasher>::Out, bool, <TrieBackend<S, H> as Backend<H>>::Transaction) where
<H as Hasher>::Out: Ord,
&self,
child_info: &ChildInfo,
delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>
) -> (<H as Hasher>::Out, bool, <TrieBackend<S, H> as Backend<H>>::Transaction) where
<H as Hasher>::Out: Ord,
pub fn as_trie_backend(
&mut self
) -> Option<&TrieBackend<<TrieBackend<S, H> as Backend<H>>::TrieBackendStorage, H>>
&mut self
) -> Option<&TrieBackend<<TrieBackend<S, H> as Backend<H>>::TrieBackendStorage, H>>
pub fn register_overlay_stats(&mut self, _stats: &StateMachineStats)
pub fn usage_info(&self) -> UsageInfo
pub fn wipe(&self) -> Result<(), <TrieBackend<S, H> as Backend<H>>::Error>
impl<B> Backend<<<B as Block>::Header as Header>::Hashing> for RefTrackingState<B> where
B: Block,
B: Block,
type Error = <TrieBackend<Arc<dyn Storage<<<B as Block>::Header as Header>::Hashing> + 'static>, <<B as Block>::Header as Header>::Hashing> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error
type Transaction = <TrieBackend<Arc<dyn Storage<<<B as Block>::Header as Header>::Hashing> + 'static>, <<B as Block>::Header as Header>::Hashing> as Backend<<<B as Block>::Header as Header>::Hashing>>::Transaction
type TrieBackendStorage = <TrieBackend<Arc<dyn Storage<<<B as Block>::Header as Header>::Hashing> + 'static>, <<B as Block>::Header as Header>::Hashing> as Backend<<<B as Block>::Header as Header>::Hashing>>::TrieBackendStorage
pub fn storage(
&self,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <RefTrackingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
&self,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <RefTrackingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
pub fn storage_hash(
&self,
key: &[u8]
) -> Result<Option<<B as Block>::Hash>, <RefTrackingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
&self,
key: &[u8]
) -> Result<Option<<B as Block>::Hash>, <RefTrackingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
pub fn child_storage(
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <RefTrackingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <RefTrackingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
pub fn exists_storage(
&self,
key: &[u8]
) -> Result<bool, <RefTrackingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
&self,
key: &[u8]
) -> Result<bool, <RefTrackingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
pub fn exists_child_storage(
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<bool, <RefTrackingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<bool, <RefTrackingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
pub fn next_storage_key(
&self,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <RefTrackingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
&self,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <RefTrackingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
pub fn next_child_storage_key(
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <RefTrackingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <RefTrackingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
pub fn for_keys_with_prefix<F>(&self, prefix: &[u8], f: F) where
F: FnMut(&[u8]),
F: FnMut(&[u8]),
pub fn for_key_values_with_prefix<F>(&self, prefix: &[u8], f: F) where
F: FnMut(&[u8], &[u8]),
F: FnMut(&[u8], &[u8]),
pub fn for_keys_in_child_storage<F>(&self, child_info: &ChildInfo, f: F) where
F: FnMut(&[u8]),
F: FnMut(&[u8]),
pub fn for_child_keys_with_prefix<F>(
&self,
child_info: &ChildInfo,
prefix: &[u8],
f: F
) where
F: FnMut(&[u8]),
&self,
child_info: &ChildInfo,
prefix: &[u8],
f: F
) where
F: FnMut(&[u8]),
pub fn storage_root<'a>(
&self,
delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>
) -> (<B as Block>::Hash, <RefTrackingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Transaction) where
<B as Block>::Hash: Ord,
&self,
delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>
) -> (<B as Block>::Hash, <RefTrackingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Transaction) where
<B as Block>::Hash: Ord,
pub fn child_storage_root<'a>(
&self,
child_info: &ChildInfo,
delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>
) -> (<B as Block>::Hash, bool, <RefTrackingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Transaction) where
<B as Block>::Hash: Ord,
&self,
child_info: &ChildInfo,
delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>
) -> (<B as Block>::Hash, bool, <RefTrackingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Transaction) where
<B as Block>::Hash: Ord,
pub fn pairs(&self) -> Vec<(Vec<u8, Global>, Vec<u8, Global>), Global>
pub fn keys(&self, prefix: &[u8]) -> Vec<Vec<u8, Global>, Global>
pub fn child_keys(
&self,
child_info: &ChildInfo,
prefix: &[u8]
) -> Vec<Vec<u8, Global>, Global>
&self,
child_info: &ChildInfo,
prefix: &[u8]
) -> Vec<Vec<u8, Global>, Global>
pub fn as_trie_backend(
&mut self
) -> Option<&TrieBackend<<RefTrackingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::TrieBackendStorage, <<B as Block>::Header as Header>::Hashing>>
&mut self
) -> Option<&TrieBackend<<RefTrackingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::TrieBackendStorage, <<B as Block>::Header as Header>::Hashing>>
pub fn register_overlay_stats(&mut self, stats: &StateMachineStats)
pub fn usage_info(&self) -> UsageInfo
impl<B> Backend<<<B as Block>::Header as Header>::Hashing> for BenchmarkingState<B> where
B: Block,
B: Block,
type Error = <TrieBackend<Arc<dyn Storage<<<B as Block>::Header as Header>::Hashing> + 'static>, <<B as Block>::Header as Header>::Hashing> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error
type Transaction = <TrieBackend<Arc<dyn Storage<<<B as Block>::Header as Header>::Hashing> + 'static>, <<B as Block>::Header as Header>::Hashing> as Backend<<<B as Block>::Header as Header>::Hashing>>::Transaction
type TrieBackendStorage = <TrieBackend<Arc<dyn Storage<<<B as Block>::Header as Header>::Hashing> + 'static>, <<B as Block>::Header as Header>::Hashing> as Backend<<<B as Block>::Header as Header>::Hashing>>::TrieBackendStorage
pub fn storage(
&self,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <BenchmarkingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
&self,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <BenchmarkingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
pub fn storage_hash(
&self,
key: &[u8]
) -> Result<Option<<B as Block>::Hash>, <BenchmarkingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
&self,
key: &[u8]
) -> Result<Option<<B as Block>::Hash>, <BenchmarkingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
pub fn child_storage(
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <BenchmarkingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <BenchmarkingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
pub fn exists_storage(
&self,
key: &[u8]
) -> Result<bool, <BenchmarkingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
&self,
key: &[u8]
) -> Result<bool, <BenchmarkingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
pub fn exists_child_storage(
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<bool, <BenchmarkingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<bool, <BenchmarkingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
pub fn next_storage_key(
&self,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <BenchmarkingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
&self,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <BenchmarkingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
pub fn next_child_storage_key(
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <BenchmarkingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <BenchmarkingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
pub fn for_keys_with_prefix<F>(&self, prefix: &[u8], f: F) where
F: FnMut(&[u8]),
F: FnMut(&[u8]),
pub fn for_key_values_with_prefix<F>(&self, prefix: &[u8], f: F) where
F: FnMut(&[u8], &[u8]),
F: FnMut(&[u8], &[u8]),
pub fn for_keys_in_child_storage<F>(&self, child_info: &ChildInfo, f: F) where
F: FnMut(&[u8]),
F: FnMut(&[u8]),
pub fn for_child_keys_with_prefix<F>(
&self,
child_info: &ChildInfo,
prefix: &[u8],
f: F
) where
F: FnMut(&[u8]),
&self,
child_info: &ChildInfo,
prefix: &[u8],
f: F
) where
F: FnMut(&[u8]),
pub fn storage_root<'a>(
&self,
delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>
) -> (<B as Block>::Hash, <BenchmarkingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Transaction) where
<B as Block>::Hash: Ord,
&self,
delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>
) -> (<B as Block>::Hash, <BenchmarkingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Transaction) where
<B as Block>::Hash: Ord,
pub fn child_storage_root<'a>(
&self,
child_info: &ChildInfo,
delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>
) -> (<B as Block>::Hash, bool, <BenchmarkingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Transaction) where
<B as Block>::Hash: Ord,
&self,
child_info: &ChildInfo,
delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>
) -> (<B as Block>::Hash, bool, <BenchmarkingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Transaction) where
<B as Block>::Hash: Ord,
pub fn pairs(&self) -> Vec<(Vec<u8, Global>, Vec<u8, Global>), Global>
pub fn keys(&self, prefix: &[u8]) -> Vec<Vec<u8, Global>, Global>
pub fn child_keys(
&self,
child_info: &ChildInfo,
prefix: &[u8]
) -> Vec<Vec<u8, Global>, Global>
&self,
child_info: &ChildInfo,
prefix: &[u8]
) -> Vec<Vec<u8, Global>, Global>
pub fn as_trie_backend(
&mut self
) -> Option<&TrieBackend<<BenchmarkingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::TrieBackendStorage, <<B as Block>::Header as Header>::Hashing>>
&mut self
) -> Option<&TrieBackend<<BenchmarkingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::TrieBackendStorage, <<B as Block>::Header as Header>::Hashing>>
pub fn commit(
&self,
storage_root: <<<B as Block>::Header as Header>::Hashing as Hasher>::Out,
transaction: <BenchmarkingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Transaction,
main_storage_changes: Vec<(Vec<u8, Global>, Option<Vec<u8, Global>>), Global>,
child_storage_changes: Vec<(Vec<u8, Global>, Vec<(Vec<u8, Global>, Option<Vec<u8, Global>>), Global>), Global>
) -> Result<(), <BenchmarkingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
&self,
storage_root: <<<B as Block>::Header as Header>::Hashing as Hasher>::Out,
transaction: <BenchmarkingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Transaction,
main_storage_changes: Vec<(Vec<u8, Global>, Option<Vec<u8, Global>>), Global>,
child_storage_changes: Vec<(Vec<u8, Global>, Vec<(Vec<u8, Global>, Option<Vec<u8, Global>>), Global>), Global>
) -> Result<(), <BenchmarkingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
pub fn wipe(
&self
) -> Result<(), <BenchmarkingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
&self
) -> Result<(), <BenchmarkingState<B> as Backend<<<B as Block>::Header as Header>::Hashing>>::Error>
pub fn read_write_count(&self) -> (u32, u32, u32, u32)
Get the key tracking information for the state db.
pub fn reset_read_write_count(&self)
Reset the key tracking information for the state db.
pub fn get_whitelist(&self) -> Vec<TrackedStorageKey, Global>
pub fn set_whitelist(&self, new: Vec<TrackedStorageKey, Global>)
pub fn register_overlay_stats(&mut self, stats: &StateMachineStats)
pub fn usage_info(&self) -> UsageInfo
impl<H> Backend<H> for GenesisOrUnavailableState<H> where
H: Hasher,
<H as Hasher>::Out: Ord,
<H as Hasher>::Out: Codec,
H: Hasher,
<H as Hasher>::Out: Ord,
<H as Hasher>::Out: Codec,
type Error = Error
type Transaction = <TrieBackend<MemoryDB<H, HashKey<H>, Vec<u8, Global>, NoopTracker<Vec<u8, Global>>>, H> as Backend<H>>::Transaction
type TrieBackendStorage = <TrieBackend<MemoryDB<H, HashKey<H>, Vec<u8, Global>, NoopTracker<Vec<u8, Global>>>, H> as Backend<H>>::TrieBackendStorage
pub fn storage(&self, key: &[u8]) -> Result<Option<Vec<u8, Global>>, Error>
pub fn child_storage(
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, Error>
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, Error>
pub fn next_storage_key(
&self,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <GenesisOrUnavailableState<H> as Backend<H>>::Error>
&self,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <GenesisOrUnavailableState<H> as Backend<H>>::Error>
pub fn next_child_storage_key(
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <GenesisOrUnavailableState<H> as Backend<H>>::Error>
&self,
child_info: &ChildInfo,
key: &[u8]
) -> Result<Option<Vec<u8, Global>>, <GenesisOrUnavailableState<H> as Backend<H>>::Error>
pub fn for_keys_with_prefix<A>(&self, prefix: &[u8], action: A) where
A: FnMut(&[u8]),
A: FnMut(&[u8]),
pub fn for_key_values_with_prefix<A>(&self, prefix: &[u8], action: A) where
A: FnMut(&[u8], &[u8]),
A: FnMut(&[u8], &[u8]),
pub fn for_keys_in_child_storage<A>(&self, child_info: &ChildInfo, action: A) where
A: FnMut(&[u8]),
A: FnMut(&[u8]),
pub fn for_child_keys_with_prefix<A>(
&self,
child_info: &ChildInfo,
prefix: &[u8],
action: A
) where
A: FnMut(&[u8]),
&self,
child_info: &ChildInfo,
prefix: &[u8],
action: A
) where
A: FnMut(&[u8]),
pub fn storage_root<'a>(
&self,
delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>
) -> (<H as Hasher>::Out, <GenesisOrUnavailableState<H> as Backend<H>>::Transaction) where
<H as Hasher>::Out: Ord,
&self,
delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>
) -> (<H as Hasher>::Out, <GenesisOrUnavailableState<H> as Backend<H>>::Transaction) where
<H as Hasher>::Out: Ord,
pub fn child_storage_root<'a>(
&self,
child_info: &ChildInfo,
delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>
) -> (<H as Hasher>::Out, bool, <GenesisOrUnavailableState<H> as Backend<H>>::Transaction) where
<H as Hasher>::Out: Ord,
&self,
child_info: &ChildInfo,
delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>
) -> (<H as Hasher>::Out, bool, <GenesisOrUnavailableState<H> as Backend<H>>::Transaction) where
<H as Hasher>::Out: Ord,
pub fn pairs(&self) -> Vec<(Vec<u8, Global>, Vec<u8, Global>), Global>
pub fn keys(&self, prefix: &[u8]) -> Vec<Vec<u8, Global>, Global>
pub fn register_overlay_stats(&mut self, _stats: &StateMachineStats)
pub fn usage_info(&self) -> UsageInfo
pub fn as_trie_backend(
&mut self
) -> Option<&TrieBackend<<GenesisOrUnavailableState<H> as Backend<H>>::TrieBackendStorage, H>>
&mut self
) -> Option<&TrieBackend<<GenesisOrUnavailableState<H> as Backend<H>>::TrieBackendStorage, H>>