Type Alias sc_client_db::DbState
source · pub type DbState<H> = TrieBackend<Arc<dyn Storage<H>>, H>;
Expand description
DB-backed patricia trie state, transaction type is an overlay of changes to commit.
Aliased Type§
struct DbState<H> { /* private fields */ }
Implementations
source§impl<S, H, C, R> TrieBackend<S, H, C, R>where
S: TrieBackendStorage<H>,
H: Hasher,
C: TrieCacheProvider<H> + Send + Sync,
R: TrieRecorderProvider<H> + Send + Sync,
<H as Hasher>::Out: Codec,
impl<S, H, C, R> TrieBackend<S, H, C, R>where
S: TrieBackendStorage<H>,
H: Hasher,
C: TrieCacheProvider<H> + Send + Sync,
R: TrieRecorderProvider<H> + Send + Sync,
<H as Hasher>::Out: Codec,
sourcepub fn backend_storage_mut(&mut self) -> &mut S
pub fn backend_storage_mut(&mut self) -> &mut S
Get backend storage reference.
sourcepub fn backend_storage(&self) -> &S
pub fn backend_storage(&self) -> &S
Get backend storage reference.
sourcepub fn into_storage(self) -> S
pub fn into_storage(self) -> S
Consumes self and returns underlying storage.
sourcepub fn extract_proof(self) -> Option<StorageProof>
pub fn extract_proof(self) -> Option<StorageProof>
Extract the StorageProof
.
This only returns Some
when there was a recorder set.
Trait Implementations
source§impl<S, H, C> AsTrieBackend<H, C> for TrieBackend<S, H, C>where
S: TrieBackendStorage<H>,
H: Hasher,
impl<S, H, C> AsTrieBackend<H, C> for TrieBackend<S, H, C>where
S: TrieBackendStorage<H>,
H: Hasher,
§type TrieBackendStorage = S
type TrieBackendStorage = S
Type of trie backend storage.
source§fn as_trie_backend(&self) -> &TrieBackend<S, H, C>
fn as_trie_backend(&self) -> &TrieBackend<S, H, C>
Return the type as
TrieBackend
.source§impl<S, H, C, R> Backend<H> for TrieBackend<S, H, C, R>where
S: TrieBackendStorage<H>,
H: Hasher,
C: TrieCacheProvider<H> + Send + Sync,
R: TrieRecorderProvider<H> + Send + Sync,
<H as Hasher>::Out: Ord + Codec,
impl<S, H, C, R> Backend<H> for TrieBackend<S, H, C, R>where
S: TrieBackendStorage<H>,
H: Hasher,
C: TrieCacheProvider<H> + Send + Sync,
R: TrieRecorderProvider<H> + Send + Sync,
<H as Hasher>::Out: Ord + Codec,
§type TrieBackendStorage = S
type TrieBackendStorage = S
Type of trie backend storage.
source§fn storage_hash(
&self,
key: &[u8],
) -> Result<Option<<H as Hasher>::Out>, <TrieBackend<S, H, C, R> as Backend<H>>::Error>
fn storage_hash( &self, key: &[u8], ) -> Result<Option<<H as Hasher>::Out>, <TrieBackend<S, H, C, R> as Backend<H>>::Error>
Get keyed storage value hash or None if there is nothing associated.
source§fn storage(
&self,
key: &[u8],
) -> Result<Option<Vec<u8>>, <TrieBackend<S, H, C, R> as Backend<H>>::Error>
fn storage( &self, key: &[u8], ) -> Result<Option<Vec<u8>>, <TrieBackend<S, H, C, R> as Backend<H>>::Error>
Get keyed storage or None if there is nothing associated.
source§fn child_storage_hash(
&self,
child_info: &ChildInfo,
key: &[u8],
) -> Result<Option<<H as Hasher>::Out>, <TrieBackend<S, H, C, R> as Backend<H>>::Error>
fn child_storage_hash( &self, child_info: &ChildInfo, key: &[u8], ) -> Result<Option<<H as Hasher>::Out>, <TrieBackend<S, H, C, R> as Backend<H>>::Error>
Get child keyed storage value hash or None if there is nothing associated.
source§fn child_storage(
&self,
child_info: &ChildInfo,
key: &[u8],
) -> Result<Option<Vec<u8>>, <TrieBackend<S, H, C, R> as Backend<H>>::Error>
fn child_storage( &self, child_info: &ChildInfo, key: &[u8], ) -> Result<Option<Vec<u8>>, <TrieBackend<S, H, C, R> as Backend<H>>::Error>
Get child keyed child storage or None if there is nothing associated.
source§fn closest_merkle_value(
&self,
key: &[u8],
) -> Result<Option<MerkleValue<<H as Hasher>::Out>>, <TrieBackend<S, H, C, R> as Backend<H>>::Error>
fn closest_merkle_value( &self, key: &[u8], ) -> Result<Option<MerkleValue<<H as Hasher>::Out>>, <TrieBackend<S, H, C, R> as Backend<H>>::Error>
Get the merkle value or None if there is nothing associated.
source§fn child_closest_merkle_value(
&self,
child_info: &ChildInfo,
key: &[u8],
) -> Result<Option<MerkleValue<<H as Hasher>::Out>>, <TrieBackend<S, H, C, R> as Backend<H>>::Error>
fn child_closest_merkle_value( &self, child_info: &ChildInfo, key: &[u8], ) -> Result<Option<MerkleValue<<H as Hasher>::Out>>, <TrieBackend<S, H, C, R> as Backend<H>>::Error>
Get the child merkle value or None if there is nothing associated.
source§fn next_storage_key(
&self,
key: &[u8],
) -> Result<Option<Vec<u8>>, <TrieBackend<S, H, C, R> as Backend<H>>::Error>
fn next_storage_key( &self, key: &[u8], ) -> Result<Option<Vec<u8>>, <TrieBackend<S, H, C, R> as Backend<H>>::Error>
Return the next key in storage in lexicographic order or
None
if there is no value.source§fn next_child_storage_key(
&self,
child_info: &ChildInfo,
key: &[u8],
) -> Result<Option<Vec<u8>>, <TrieBackend<S, H, C, R> as Backend<H>>::Error>
fn next_child_storage_key( &self, child_info: &ChildInfo, key: &[u8], ) -> Result<Option<Vec<u8>>, <TrieBackend<S, H, C, R> as Backend<H>>::Error>
Return the next key in child storage in lexicographic order or
None
if there is no value.source§fn raw_iter(
&self,
args: IterArgs<'_>,
) -> Result<<TrieBackend<S, H, C, R> as Backend<H>>::RawIter, <TrieBackend<S, H, C, R> as Backend<H>>::Error>
fn raw_iter( &self, args: IterArgs<'_>, ) -> Result<<TrieBackend<S, H, C, R> as Backend<H>>::RawIter, <TrieBackend<S, H, C, R> as Backend<H>>::Error>
Returns a lifetimeless raw storage iterator.
source§fn storage_root<'a>(
&self,
delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>,
state_version: StateVersion,
) -> (<H as Hasher>::Out, MemoryDB<H, PrefixedKey<H>, Vec<u8>>)
fn storage_root<'a>( &self, delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>, state_version: StateVersion, ) -> (<H as Hasher>::Out, MemoryDB<H, PrefixedKey<H>, Vec<u8>>)
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.
source§fn child_storage_root<'a>(
&self,
child_info: &ChildInfo,
delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>,
state_version: StateVersion,
) -> (<H as Hasher>::Out, bool, MemoryDB<H, PrefixedKey<H>, Vec<u8>>)
fn child_storage_root<'a>( &self, child_info: &ChildInfo, delta: impl Iterator<Item = (&'a [u8], Option<&'a [u8]>)>, state_version: StateVersion, ) -> (<H as Hasher>::Out, bool, MemoryDB<H, PrefixedKey<H>, Vec<u8>>)
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.
source§fn register_overlay_stats(&self, _stats: &StateMachineStats)
fn register_overlay_stats(&self, _stats: &StateMachineStats)
Register stats from overlay of state machine. Read more
source§fn usage_info(&self) -> UsageInfo
fn usage_info(&self) -> UsageInfo
Query backend usage statistics (i/o, memory) Read more
source§fn wipe(&self) -> Result<(), <TrieBackend<S, H, C, R> as Backend<H>>::Error>
fn wipe(&self) -> Result<(), <TrieBackend<S, H, C, R> as Backend<H>>::Error>
Wipe the state database.
source§fn exists_storage(&self, key: &[u8]) -> Result<bool, Self::Error>
fn exists_storage(&self, key: &[u8]) -> Result<bool, Self::Error>
true if a key exists in storage.
source§fn exists_child_storage(
&self,
child_info: &ChildInfo,
key: &[u8],
) -> Result<bool, Self::Error>
fn exists_child_storage( &self, child_info: &ChildInfo, key: &[u8], ) -> Result<bool, Self::Error>
true if a key exists in child storage.
source§fn pairs<'a>(
&'a self,
args: IterArgs<'_>,
) -> Result<PairsIter<'a, H, Self::RawIter>, Self::Error>
fn pairs<'a>( &'a self, args: IterArgs<'_>, ) -> Result<PairsIter<'a, H, Self::RawIter>, Self::Error>
Get an iterator over key/value pairs.
source§fn keys<'a>(
&'a self,
args: IterArgs<'_>,
) -> Result<KeysIter<'a, H, Self::RawIter>, Self::Error>
fn keys<'a>( &'a self, args: IterArgs<'_>, ) -> Result<KeysIter<'a, H, Self::RawIter>, Self::Error>
Get an iterator over keys.
source§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]>)>)>,
state_version: StateVersion,
) -> (<H as Hasher>::Out, MemoryDB<H, PrefixedKey<H>, Vec<u8>>)
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]>)>)>, state_version: StateVersion, ) -> (<H as Hasher>::Out, MemoryDB<H, PrefixedKey<H>, Vec<u8>>)
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.
source§fn commit(
&self,
_: <H as Hasher>::Out,
_: MemoryDB<H, PrefixedKey<H>, Vec<u8>>,
_: Vec<(Vec<u8>, Option<Vec<u8>>)>,
_: Vec<(Vec<u8>, Vec<(Vec<u8>, Option<Vec<u8>>)>)>,
) -> Result<(), Self::Error>
fn commit( &self, _: <H as Hasher>::Out, _: MemoryDB<H, PrefixedKey<H>, Vec<u8>>, _: Vec<(Vec<u8>, Option<Vec<u8>>)>, _: Vec<(Vec<u8>, Vec<(Vec<u8>, Option<Vec<u8>>)>)>, ) -> Result<(), Self::Error>
Commit given transaction to storage.
source§fn reset_read_write_count(&self)
fn reset_read_write_count(&self)
Get the read/write count of the db
source§fn get_whitelist(&self) -> Vec<TrackedStorageKey>
fn get_whitelist(&self) -> Vec<TrackedStorageKey>
Get the whitelist for tracking db reads/writes
source§fn set_whitelist(&self, _: Vec<TrackedStorageKey>)
fn set_whitelist(&self, _: Vec<TrackedStorageKey>)
Update the whitelist for tracking db reads/writes
source§fn proof_size(&self) -> Option<u32>
fn proof_size(&self) -> Option<u32>
Estimate proof size