[][src]Trait sc_light::fetcher::BlockchainStorage

pub trait BlockchainStorage<Block>: AuxStore + HeaderBackend<Block> + HeaderMetadata<Block, Error = Error> where
    Block: Block
{ fn import_header(
        &self,
        header: <Block as Block>::Header,
        cache: HashMap<[u8; 4], Vec<u8>, RandomState>,
        state: NewBlockState,
        aux_ops: Vec<(Vec<u8>, Option<Vec<u8>>)>
    ) -> Result<(), Error>;
fn set_head(&self, block: BlockId<Block>) -> Result<(), Error>;
fn finalize_header(&self, block: BlockId<Block>) -> Result<(), Error>;
fn last_finalized(&self) -> Result<<Block as Block>::Hash, Error>;
fn header_cht_root(
        &self,
        cht_size: <<Block as Block>::Header as Header>::Number,
        block: <<Block as Block>::Header as Header>::Number
    ) -> Result<Option<<Block as Block>::Hash>, Error>;
fn changes_trie_cht_root(
        &self,
        cht_size: <<Block as Block>::Header as Header>::Number,
        block: <<Block as Block>::Header as Header>::Number
    ) -> Result<Option<<Block as Block>::Hash>, Error>;
fn cache(&self) -> Option<Arc<dyn Cache<Block> + 'static>>;
fn usage_info(&self) -> Option<UsageInfo>; }

Light client blockchain storage.

Required methods

fn import_header(
    &self,
    header: <Block as Block>::Header,
    cache: HashMap<[u8; 4], Vec<u8>, RandomState>,
    state: NewBlockState,
    aux_ops: Vec<(Vec<u8>, Option<Vec<u8>>)>
) -> Result<(), Error>

Store new header. Should refuse to revert any finalized blocks.

Takes new authorities, the leaf state of the new block, and any auxiliary storage updates to place in the same operation.

fn set_head(&self, block: BlockId<Block>) -> Result<(), Error>

Set an existing block as new best block.

fn finalize_header(&self, block: BlockId<Block>) -> Result<(), Error>

Mark historic header as finalized.

fn last_finalized(&self) -> Result<<Block as Block>::Hash, Error>

Get last finalized header.

fn header_cht_root(
    &self,
    cht_size: <<Block as Block>::Header as Header>::Number,
    block: <<Block as Block>::Header as Header>::Number
) -> Result<Option<<Block as Block>::Hash>, Error>

Get headers CHT root for given block. Returns None if the block is not pruned (not a part of any CHT).

fn changes_trie_cht_root(
    &self,
    cht_size: <<Block as Block>::Header as Header>::Number,
    block: <<Block as Block>::Header as Header>::Number
) -> Result<Option<<Block as Block>::Hash>, Error>

Get changes trie CHT root for given block. Returns None if the block is not pruned (not a part of any CHT).

fn cache(&self) -> Option<Arc<dyn Cache<Block> + 'static>>

Get storage cache.

fn usage_info(&self) -> Option<UsageInfo>

Get storage usage statistics.

Loading content...

Implementations on Foreign Types

impl<Block> Storage<Block> for Blockchain<Block> where
    Block: Block,
    <Block as Block>::Hash: From<[u8; 32]>, 
[src]

Loading content...

Implementors

Loading content...