pub struct Backend<S, H: Hasher> { /* private fields */ }
Expand description
Light client backend.
Implementations
sourceimpl<S, H: Hasher> Backend<S, H>
impl<S, H: Hasher> Backend<S, H>
sourcepub fn new(blockchain: Arc<Blockchain<S>>) -> Self
pub fn new(blockchain: Arc<Blockchain<S>>) -> Self
Create new light backend.
sourcepub fn blockchain(&self) -> &Arc<Blockchain<S>>
pub fn blockchain(&self) -> &Arc<Blockchain<S>>
Get shared blockchain reference.
Trait Implementations
sourceimpl<S: AuxStore, H: Hasher> AuxStore for Backend<S, H>
impl<S: AuxStore, H: Hasher> AuxStore for Backend<S, H>
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<S, Block> Backend<Block> for Backend<S, HashFor<Block>> where
Block: BlockT,
S: BlockchainStorage<Block>,
Block::Hash: Ord,
impl<S, Block> Backend<Block> for Backend<S, HashFor<Block>> where
Block: BlockT,
S: BlockchainStorage<Block>,
Block::Hash: Ord,
type BlockImportOperation = ImportOperation<Block, S>
type BlockImportOperation = ImportOperation<Block, S>
Associated block insertion operation type.
type Blockchain = Blockchain<S>
type Blockchain = Blockchain<S>
Associated blockchain backend type.
type State = GenesisOrUnavailableState<HashFor<Block>>
type State = GenesisOrUnavailableState<HashFor<Block>>
Associated state backend type.
type OffchainStorage = InMemOffchainStorage
type OffchainStorage = InMemOffchainStorage
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 blockchain(&self) -> &Blockchain<S>
fn blockchain(&self) -> &Blockchain<S>
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>) -> ClientResult<Self::State>
fn state_at(&self, block: BlockId<Block>) -> ClientResult<Self::State>
Returns state backend with post-state of given block.
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 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 as Block>::Hash,
_number: <<Block as Block>::Header as Header>::Number
) -> bool
fn have_state_at(
&self,
hash: &<Block as Block>::Hash,
_number: <<Block as Block>::Header as Header>::Number
) -> bool
Returns true if state for given block is available.
sourceimpl<S, Block> RemoteBackend<Block> for Backend<S, HashFor<Block>> where
Block: BlockT,
S: BlockchainStorage<Block> + 'static,
Block::Hash: Ord,
impl<S, Block> RemoteBackend<Block> for Backend<S, HashFor<Block>> where
Block: BlockT,
S: BlockchainStorage<Block> + 'static,
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
Auto Trait Implementations
impl<S, H> !RefUnwindSafe for Backend<S, H>
impl<S, H> Send for Backend<S, H> where
S: Send + Sync,
impl<S, H> Sync for Backend<S, H> where
S: Send + Sync,
impl<S, H> Unpin for Backend<S, H> where
H: Unpin,
<H as Hasher>::Out: Unpin,
impl<S, H> UnwindSafe for Backend<S, H> where
H: UnwindSafe,
S: RefUnwindSafe,
<H as Hasher>::Out: UnwindSafe,
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