Trait sc_light::blockchain::Storage
source · [−]pub trait Storage<Block>: AuxStore + HeaderBackend<Block> + HeaderMetadata<Block, Error = Error> + ProvideChtRoots<Block> where
Block: Block, {
fn import_header(
&self,
header: <Block as Block>::Header,
cache: HashMap<[u8; 4], Vec<u8, Global>, RandomState>,
state: NewBlockState,
aux_ops: Vec<(Vec<u8, Global>, Option<Vec<u8, Global>>), Global>
) -> 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 cache(&self) -> Option<Arc<dyn Cache<Block> + 'static>>;
fn usage_info(&self) -> Option<UsageInfo>;
}
Expand description
Light client blockchain storage.
Required methods
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.
Set an existing block as new best block.
Mark historic header as finalized.
fn usage_info(&self) -> Option<UsageInfo>
fn usage_info(&self) -> Option<UsageInfo>
Get storage usage statistics.