Struct sc_client_api::in_mem::Backend
source · [−]Expand description
In-memory backend. Keeps all states and blocks in memory.
Warning: Doesn’t support all the features necessary for a proper database. Only use this struct for testing purposes. Do NOT use in production.
Implementations
Trait Implementations
sourceimpl<Block: BlockT> AuxStore for Backend<Block> where
Block::Hash: Ord,
impl<Block: BlockT> AuxStore for Backend<Block> where
Block::Hash: Ord,
sourceimpl<Block: BlockT> Backend<Block> for Backend<Block> where
Block::Hash: Ord,
impl<Block: BlockT> Backend<Block> for Backend<Block> where
Block::Hash: Ord,
type BlockImportOperation = BlockImportOperation<Block>
type BlockImportOperation = BlockImportOperation<Block>
Associated block insertion operation type.
type Blockchain = Blockchain<Block>
type Blockchain = Blockchain<Block>
Associated blockchain backend type.
type State = InMemoryBackend<HashFor<Block>>
type State = InMemoryBackend<HashFor<Block>>
Associated state backend type.
type OffchainStorage = OffchainStorage
type OffchainStorage = OffchainStorage
Offchain workers local storage.
sourcefn begin_operation(&self) -> Result<Self::BlockImportOperation>
fn begin_operation(&self) -> Result<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>
) -> Result<()>
fn begin_state_operation(
&self,
operation: &mut Self::BlockImportOperation,
block: BlockId<Block>
) -> Result<()>
Note an operation to contain state transition.
sourcefn commit_operation(&self, operation: Self::BlockImportOperation) -> Result<()>
fn commit_operation(&self, operation: Self::BlockImportOperation) -> Result<()>
Commit block insertion.
sourcefn finalize_block(
&self,
block: BlockId<Block>,
justification: Option<Justification>
) -> Result<()>
fn finalize_block(
&self,
block: BlockId<Block>,
justification: Option<Justification>
) -> Result<()>
Finalize block with given Id. Read more
sourcefn blockchain(&self) -> &Self::Blockchain
fn blockchain(&self) -> &Self::Blockchain
Returns reference to blockchain backend.
sourcefn usage_info(&self) -> Option<UsageInfo>
fn usage_info(&self) -> Option<UsageInfo>
Returns current usage statistics.
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 state_at(&self, block: BlockId<Block>) -> Result<Self::State>
fn state_at(&self, block: BlockId<Block>) -> Result<Self::State>
Returns state backend with post-state of given block.
sourcefn revert(
&self,
_n: NumberFor<Block>,
_revert_finalized: bool
) -> Result<(NumberFor<Block>, HashSet<Block::Hash>)>
fn revert(
&self,
_n: NumberFor<Block>,
_revert_finalized: bool
) -> Result<(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 get_import_lock(&self) -> &RwLock<()>
fn get_import_lock(&self) -> &RwLock<()>
Gain access to the import lock around this backend. Read more
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.
sourceimpl<Block: BlockT> RemoteBackend<Block> for Backend<Block> where
Block::Hash: Ord,
impl<Block: BlockT> RemoteBackend<Block> for Backend<Block> where
Block::Hash: Ord,
sourcefn is_local_state_available(&self, block: &BlockId<Block>) -> bool
fn is_local_state_available(&self, block: &BlockId<Block>) -> bool
Returns true if the state for given block is available locally.
sourcefn remote_blockchain(&self) -> Arc<dyn RemoteBlockchain<Block>>
fn remote_blockchain(&self) -> Arc<dyn RemoteBlockchain<Block>>
Returns reference to blockchain backend. Read more
impl<Block: BlockT> LocalBackend<Block> for Backend<Block> where
Block::Hash: Ord,
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>::Hashing: 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