Trait sc_light::blockchain::BlockchainCache[][src]

pub trait BlockchainCache<Block>: Send + Sync where
    Block: Block
{ pub fn initialize(
        &self,
        key: &[u8; 4],
        value_at_genesis: Vec<u8, Global>
    ) -> Result<(), Error>;
pub fn get_at(
        &self,
        key: &[u8; 4],
        block: &BlockId<Block>
    ) -> Result<Option<((<<Block as Block>::Header as Header>::Number, <Block as Block>::Hash), Option<(<<Block as Block>::Header as Header>::Number, <Block as Block>::Hash)>, Vec<u8, Global>)>, Error>; }

Blockchain optional data cache.

Required methods

pub fn initialize(
    &self,
    key: &[u8; 4],
    value_at_genesis: Vec<u8, Global>
) -> Result<(), Error>
[src]

Initialize genesis value for the given cache.

The operation should be performed once before anything else is inserted in the cache. Otherwise cache may end up in inconsistent state.

pub fn get_at(
    &self,
    key: &[u8; 4],
    block: &BlockId<Block>
) -> Result<Option<((<<Block as Block>::Header as Header>::Number, <Block as Block>::Hash), Option<(<<Block as Block>::Header as Header>::Number, <Block as Block>::Hash)>, Vec<u8, Global>)>, Error>
[src]

Returns cached value by the given key.

Returned tuple is the range where value has been active and the value itself. Fails if read from cache storage fails or if the value for block is discarded (i.e. if block is earlier that best finalized, but it is not in canonical chain).

Loading content...

Implementors

Loading content...