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>

source

pub fn essence(&self) -> &TrieBackendEssence<S, H, C, R>

Get backend essence reference.

source

pub fn backend_storage_mut(&mut self) -> &mut S

Get backend storage reference.

source

pub fn backend_storage(&self) -> &S

Get backend storage reference.

source

pub fn set_root(&mut self, root: <H as Hasher>::Out)

Set trie root.

source

pub fn root(&self) -> &<H as Hasher>::Out

Get trie root.

source

pub fn into_storage(self) -> S

Consumes self and returns underlying storage.

source

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,

§

type TrieBackendStorage = S

Type of trie backend storage.
source§

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>

§

type Error = String

An error type when fetching data is not possible.
§

type TrieBackendStorage = S

Type of trie backend storage.
§

type RawIter = RawIter<S, H, C, R>

Type of the raw storage iterator.
source§

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>

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>

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>

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>

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>

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>

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>

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>

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>>)
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.
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>>)
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.
source§

fn register_overlay_stats(&self, _stats: &StateMachineStats)

Register stats from overlay of state machine. Read more
source§

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>

Wipe the state database.
source§

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>

true if a key exists in child storage.
source§

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>

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>>)
where <H as Hasher>::Out: Ord + 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.
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>

Commit given transaction to storage.
source§

fn read_write_count(&self) -> (u32, u32, u32, u32)

Get the read/write count of the db
source§

fn reset_read_write_count(&self)

Get the read/write count of the db
source§

fn get_whitelist(&self) -> Vec<TrackedStorageKey>

Get the whitelist for tracking db reads/writes
source§

fn set_whitelist(&self, _: Vec<TrackedStorageKey>)

Update the whitelist for tracking db reads/writes
source§

fn proof_size(&self) -> Option<u32>

Estimate proof size
source§

fn get_read_and_written_keys(&self) -> Vec<(Vec<u8>, u32, u32, bool)>

Extend storage info for benchmarking db
source§

impl<S, H, C, R> Debug for TrieBackend<S, H, C, R>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more