Struct sc_client_db::Backend
source · [−]pub struct Backend<Block: BlockT> { /* private fields */ }
Expand description
Disk backend.
Disk backend keeps data in a key-value store. In archive mode, trie nodes are kept from all blocks. Otherwise, trie nodes are kept only from some recent blocks.
Implementations
sourceimpl<Block: BlockT> Backend<Block>
impl<Block: BlockT> Backend<Block>
sourcepub fn new(
config: DatabaseSettings,
canonicalization_delay: u64
) -> ClientResult<Self>
pub fn new(
config: DatabaseSettings,
canonicalization_delay: u64
) -> ClientResult<Self>
Create a new instance of database backend.
The pruning window is how old a block must be before the state is pruned.
Trait Implementations
sourceimpl<Block> AuxStore for Backend<Block> where
Block: BlockT,
impl<Block> AuxStore for Backend<Block> where
Block: BlockT,
sourcefn insert_aux<'a, 'b: 'a, 'c: 'a, I: IntoIterator<Item = &'a (&'c [u8], &'c [u8])>, D: IntoIterator<Item = &'a &'b [u8]>>(
&self,
insert: I,
delete: D
) -> ClientResult<()>
fn insert_aux<'a, 'b: 'a, 'c: 'a, I: IntoIterator<Item = &'a (&'c [u8], &'c [u8])>, D: IntoIterator<Item = &'a &'b [u8]>>(
&self,
insert: I,
delete: D
) -> ClientResult<()>
Insert auxiliary data into key-value store. Read more
sourceimpl<Block: BlockT> Backend<Block> for Backend<Block>
impl<Block: BlockT> Backend<Block> for Backend<Block>
type BlockImportOperation = BlockImportOperation<Block>
type BlockImportOperation = BlockImportOperation<Block>
Associated block insertion operation type.
type Blockchain = BlockchainDb<Block>
type Blockchain = BlockchainDb<Block>
Associated blockchain backend type.
type State = SyncingCachingState<RefTrackingState<Block>, Block>
type State = SyncingCachingState<RefTrackingState<Block>, Block>
Associated state backend type.
type OffchainStorage = LocalStorage
type OffchainStorage = LocalStorage
Offchain workers local storage.
sourcefn begin_operation(&self) -> ClientResult<Self::BlockImportOperation>
fn begin_operation(&self) -> ClientResult<Self::BlockImportOperation>
Begin a new block insertion transaction with given parent block id. Read more
sourcefn begin_state_operation(
&self,
operation: &mut Self::BlockImportOperation,
block: BlockId<Block>
) -> ClientResult<()>
fn begin_state_operation(
&self,
operation: &mut Self::BlockImportOperation,
block: BlockId<Block>
) -> ClientResult<()>
Note an operation to contain state transition.
sourcefn commit_operation(
&self,
operation: Self::BlockImportOperation
) -> ClientResult<()>
fn commit_operation(
&self,
operation: Self::BlockImportOperation
) -> ClientResult<()>
Commit block insertion.
sourcefn finalize_block(
&self,
block: BlockId<Block>,
justification: Option<Justification>
) -> ClientResult<()>
fn finalize_block(
&self,
block: BlockId<Block>,
justification: Option<Justification>
) -> ClientResult<()>
Finalize block with given Id. Read more
sourcefn changes_trie_storage(
&self
) -> Option<&dyn PrunableStateChangesTrieStorage<Block>>
fn changes_trie_storage(
&self
) -> Option<&dyn PrunableStateChangesTrieStorage<Block>>
Returns reference to changes trie storage.
sourcefn offchain_storage(&self) -> Option<Self::OffchainStorage>
fn offchain_storage(&self) -> Option<Self::OffchainStorage>
Returns a handle to offchain storage.
sourcefn usage_info(&self) -> Option<UsageInfo>
fn usage_info(&self) -> Option<UsageInfo>
Returns current usage statistics.
sourcefn revert(
&self,
n: NumberFor<Block>,
revert_finalized: bool
) -> ClientResult<(NumberFor<Block>, HashSet<Block::Hash>)>
fn revert(
&self,
n: NumberFor<Block>,
revert_finalized: bool
) -> ClientResult<(NumberFor<Block>, HashSet<Block::Hash>)>
Attempts to revert the chain by n
blocks. If revert_finalized
is set it will attempt to
revert past any finalized block, this is unsafe and can potentially leave the node in an
inconsistent state. Read more
sourcefn blockchain(&self) -> &BlockchainDb<Block>
fn blockchain(&self) -> &BlockchainDb<Block>
Returns reference to blockchain backend.
sourcefn state_at(&self, block: BlockId<Block>) -> ClientResult<Self::State>
fn state_at(&self, block: BlockId<Block>) -> ClientResult<Self::State>
Returns state backend with post-state of given block.
sourcefn have_state_at(&self, hash: &Block::Hash, number: NumberFor<Block>) -> bool
fn have_state_at(&self, hash: &Block::Hash, number: NumberFor<Block>) -> bool
Returns true if state for given block is available.
sourcefn get_import_lock(&self) -> &RwLock<()>
fn get_import_lock(&self) -> &RwLock<()>
Gain access to the import lock around this backend. Read more
impl<Block: BlockT> LocalBackend<Block> for Backend<Block>
Auto Trait Implementations
impl<Block> !RefUnwindSafe for Backend<Block>
impl<Block> Send for Backend<Block>
impl<Block> Sync for Backend<Block>
impl<Block> Unpin for Backend<Block> where
<Block as Block>::Hash: Unpin,
<<Block as Block>::Header as Header>::Number: Unpin,
impl<Block> !UnwindSafe for Backend<Block>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CheckedConversion for T
impl<T> CheckedConversion for T
sourcefn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
fn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
Convert from a value of T
into an equivalent instance of Option<Self>
. Read more
sourcefn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
fn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
Consume self to return Some
equivalent value of Option<T>
. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T, Outer> IsWrappedBy<Outer> for T where
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for T where
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
sourceimpl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
sourcefn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
Convert from a value of T
into an equivalent instance of Self
. Read more
sourcefn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of T
. Read more
sourceimpl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
sourcepub fn unchecked_into(self) -> T
pub fn unchecked_into(self) -> T
The counterpart to unchecked_from
.
sourceimpl<T, S> UniqueSaturatedInto<T> for S where
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for S where
T: Bounded,
S: TryInto<T>,
sourcepub fn unique_saturated_into(self) -> T
pub fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of T
.
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more