[][src]Trait sc_client_api::light::Storage

pub trait Storage<Block: BlockT>: AuxStore + HeaderBackend<Block> + HeaderMetadata<Block, Error = ClientError> {
    fn import_header(
        &self,
        header: Block::Header,
        cache: HashMap<Id, Vec<u8>>,
        state: NewBlockState,
        aux_ops: Vec<(Vec<u8>, Option<Vec<u8>>)>
    ) -> ClientResult<()>;
fn set_head(&self, block: BlockId<Block>) -> ClientResult<()>;
fn finalize_header(&self, block: BlockId<Block>) -> ClientResult<()>;
fn last_finalized(&self) -> ClientResult<Block::Hash>;
fn header_cht_root(
        &self,
        cht_size: NumberFor<Block>,
        block: NumberFor<Block>
    ) -> ClientResult<Option<Block::Hash>>;
fn changes_trie_cht_root(
        &self,
        cht_size: NumberFor<Block>,
        block: NumberFor<Block>
    ) -> ClientResult<Option<Block::Hash>>;
fn cache(&self) -> Option<Arc<dyn BlockchainCache<Block>>>;
fn usage_info(&self) -> Option<UsageInfo>; }

Light client blockchain storage.

Required methods

fn import_header(
    &self,
    header: Block::Header,
    cache: HashMap<Id, Vec<u8>>,
    state: NewBlockState,
    aux_ops: Vec<(Vec<u8>, Option<Vec<u8>>)>
) -> ClientResult<()>

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>) -> ClientResult<()>

Set an existing block as new best block.

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

Mark historic header as finalized.

fn last_finalized(&self) -> ClientResult<Block::Hash>

Get last finalized header.

fn header_cht_root(
    &self,
    cht_size: NumberFor<Block>,
    block: NumberFor<Block>
) -> ClientResult<Option<Block::Hash>>

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: NumberFor<Block>,
    block: NumberFor<Block>
) -> ClientResult<Option<Block::Hash>>

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 BlockchainCache<Block>>>

Get storage cache.

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

Get storage usage statistics.

Loading content...

Implementors

Loading content...