ChainInfo

Trait ChainInfo 

Source
pub trait ChainInfo<Block>:
    Clone
    + Send
    + Sync
    + 'static
where Block: GenericOwnedBlock,
{ // Required methods fn best_root(&self) -> BlockRoot; fn best_header(&self) -> Block::Header; fn best_header_with_details(&self) -> (Block::Header, BlockDetails); fn ancestor_header( &self, ancestor_block_number: BlockNumber, descendant_block_root: &BlockRoot, ) -> Option<Block::Header>; fn header(&self, block_root: &BlockRoot) -> Option<Block::Header>; fn header_with_details( &self, block_root: &BlockRoot, ) -> Option<(Block::Header, BlockDetails)>; fn block( &self, block_root: &BlockRoot, ) -> impl Future<Output = Result<Block, ReadBlockError>> + Send; fn last_segment_header(&self) -> Option<SegmentHeader>; fn max_segment_index(&self) -> Option<SegmentIndex>; fn get_segment_header( &self, segment_index: SegmentIndex, ) -> Option<SegmentHeader>; fn segment_headers_for_block( &self, block_number: BlockNumber, ) -> Vec<SegmentHeader>; }
Expand description

Chain info.

NOTE:

Blocks or their parts returned from these APIs are reference-counted and cheap to clone. However, it is not expected that they will be retained in memory for a long time. Blocks and headers will not be pruned until their reference count goes down to one. This is imported when there is an ongoing block import happening and its parent must exist until the import finishes.

Required Methods§

Source

fn best_root(&self) -> BlockRoot

Best block root

Source

fn best_header(&self) -> Block::Header

Best block header

Source

fn best_header_with_details(&self) -> (Block::Header, BlockDetails)

Returns the best block header like Self::best_header() with additional block details

Source

fn ancestor_header( &self, ancestor_block_number: BlockNumber, descendant_block_root: &BlockRoot, ) -> Option<Block::Header>

Get header of ancestor block number for descendant block root

Source

fn header(&self, block_root: &BlockRoot) -> Option<Block::Header>

Block header

Source

fn header_with_details( &self, block_root: &BlockRoot, ) -> Option<(Block::Header, BlockDetails)>

Returns a block header like Self::header() with additional block details

Source

fn block( &self, block_root: &BlockRoot, ) -> impl Future<Output = Result<Block, ReadBlockError>> + Send

Source

fn last_segment_header(&self) -> Option<SegmentHeader>

Returns last observed segment header

Source

fn max_segment_index(&self) -> Option<SegmentIndex>

Returns last observed segment index

Source

fn get_segment_header( &self, segment_index: SegmentIndex, ) -> Option<SegmentHeader>

Get a single segment header

Source

fn segment_headers_for_block( &self, block_number: BlockNumber, ) -> Vec<SegmentHeader>

Get segment headers that are expected to be included at specified block number.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§