Struct sc_client_db::BlockchainDb
source · pub struct BlockchainDb<Block: BlockT> { /* private fields */ }
Expand description
Block database
Trait Implementations§
source§impl<Block: BlockT> Backend<Block> for BlockchainDb<Block>
impl<Block: BlockT> Backend<Block> for BlockchainDb<Block>
source§fn body(&self, hash: Block::Hash) -> ClientResult<Option<Vec<Block::Extrinsic>>>
fn body(&self, hash: Block::Hash) -> ClientResult<Option<Vec<Block::Extrinsic>>>
Get block body. Returns
None
if block is not found.source§fn justifications(
&self,
hash: Block::Hash
) -> ClientResult<Option<Justifications>>
fn justifications( &self, hash: Block::Hash ) -> ClientResult<Option<Justifications>>
Get block justifications. Returns
None
if no justification exists.source§fn last_finalized(&self) -> ClientResult<Block::Hash>
fn last_finalized(&self) -> ClientResult<Block::Hash>
Get last finalized block hash.
source§fn leaves(&self) -> ClientResult<Vec<Block::Hash>>
fn leaves(&self) -> ClientResult<Vec<Block::Hash>>
Returns hashes of all blocks that are leaves of the block tree.
in other words, that have no children, are chain heads.
Results must be ordered best (longest, highest) chain first.
source§fn displaced_leaves_after_finalizing(
&self,
block_number: NumberFor<Block>
) -> ClientResult<Vec<Block::Hash>>
fn displaced_leaves_after_finalizing( &self, block_number: NumberFor<Block> ) -> ClientResult<Vec<Block::Hash>>
Returns displaced leaves after the given block would be finalized. Read more
source§fn children(&self, parent_hash: Block::Hash) -> ClientResult<Vec<Block::Hash>>
fn children(&self, parent_hash: Block::Hash) -> ClientResult<Vec<Block::Hash>>
Return hashes of all blocks that are children of the block with
parent_hash
.source§fn indexed_transaction(
&self,
hash: Block::Hash
) -> ClientResult<Option<Vec<u8>>>
fn indexed_transaction( &self, hash: Block::Hash ) -> ClientResult<Option<Vec<u8>>>
Get single indexed transaction by content hash. Note that this will only fetch transactions
that are indexed by the runtime with
storage_index_transaction
.source§fn has_indexed_transaction(&self, hash: Block::Hash) -> ClientResult<bool>
fn has_indexed_transaction(&self, hash: Block::Hash) -> ClientResult<bool>
Check if indexed transaction exists.
fn block_indexed_body( &self, hash: Block::Hash ) -> ClientResult<Option<Vec<Vec<u8>>>>
source§impl<Block: BlockT> HeaderBackend<Block> for BlockchainDb<Block>
impl<Block: BlockT> HeaderBackend<Block> for BlockchainDb<Block>
source§fn header(&self, hash: Block::Hash) -> ClientResult<Option<Block::Header>>
fn header(&self, hash: Block::Hash) -> ClientResult<Option<Block::Header>>
Get block header. Returns
None
if block is not found.source§fn status(&self, hash: Block::Hash) -> ClientResult<BlockStatus>
fn status(&self, hash: Block::Hash) -> ClientResult<BlockStatus>
Get block status.
source§fn number(&self, hash: Block::Hash) -> ClientResult<Option<NumberFor<Block>>>
fn number(&self, hash: Block::Hash) -> ClientResult<Option<NumberFor<Block>>>
Get block number by hash. Returns
None
if the header is not in the chain.source§fn hash(&self, number: NumberFor<Block>) -> ClientResult<Option<Block::Hash>>
fn hash(&self, number: NumberFor<Block>) -> ClientResult<Option<Block::Hash>>
Get block hash by number. Returns
None
if the header is not in the chain.source§fn block_hash_from_id(
&self,
id: &BlockId<Block>
) -> Result<Option<<Block as Block>::Hash>, Error>
fn block_hash_from_id( &self, id: &BlockId<Block> ) -> Result<Option<<Block as Block>::Hash>, Error>
Convert an arbitrary block ID into a block hash.
source§fn block_number_from_id(
&self,
id: &BlockId<Block>
) -> Result<Option<<<Block as Block>::Header as Header>::Number>, Error>
fn block_number_from_id( &self, id: &BlockId<Block> ) -> Result<Option<<<Block as Block>::Header as Header>::Number>, Error>
Convert an arbitrary block ID into a block hash.
source§fn expect_header(
&self,
hash: <Block as Block>::Hash
) -> Result<<Block as Block>::Header, Error>
fn expect_header( &self, hash: <Block as Block>::Hash ) -> Result<<Block as Block>::Header, Error>
Get block header. Returns
UnknownBlock
error if block is not found.source§impl<Block: BlockT> HeaderMetadata<Block> for BlockchainDb<Block>
impl<Block: BlockT> HeaderMetadata<Block> for BlockchainDb<Block>
fn header_metadata( &self, hash: Block::Hash ) -> Result<CachedHeaderMetadata<Block>, Self::Error>
fn insert_header_metadata( &self, hash: Block::Hash, metadata: CachedHeaderMetadata<Block> )
fn remove_header_metadata(&self, hash: Block::Hash)
Auto Trait Implementations§
impl<Block> !RefUnwindSafe for BlockchainDb<Block>
impl<Block> Send for BlockchainDb<Block>
impl<Block> Sync for BlockchainDb<Block>
impl<Block> Unpin for BlockchainDb<Block>
impl<Block> !UnwindSafe for BlockchainDb<Block>
Blanket Implementations§
source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
source§impl<Block, T> ForkBackend<Block> for Twhere
Block: Block,
T: HeaderMetadata<Block> + HeaderBackend<Block> + Send + Sync,
impl<Block, T> ForkBackend<Block> for Twhere Block: Block, T: HeaderMetadata<Block> + HeaderBackend<Block> + Send + Sync,
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T, Outer> IsWrappedBy<Outer> for Twhere
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for Twhere Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere Self: UniqueSaturatedFrom<T>,
source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of
T
. Read moresource§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere T: UncheckedFrom<S>,
source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
The counterpart to
unchecked_from
.source§impl<T, S> UniqueSaturatedInto<T> for Swhere
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for Swhere T: Bounded, S: TryInto<T>,
source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of
T
.