[][src]Trait tendermint_light_client::store::LightStore

pub trait LightStore: Debug + Send + Sync {
    pub fn get(&self, height: Height, status: Status) -> Option<LightBlock>;
pub fn update(&mut self, light_block: &LightBlock, status: Status);
pub fn insert(&mut self, light_block: LightBlock, status: Status);
pub fn remove(&mut self, height: Height, status: Status);
pub fn latest(&self, status: Status) -> Option<LightBlock>;
pub fn all(&self, status: Status) -> Box<dyn Iterator<Item = LightBlock>>; pub fn get_non_failed(&self, height: Height) -> Option<(LightBlock, Status)> { ... }
pub fn latest_trusted_or_verified(&self) -> Option<LightBlock> { ... }
pub fn get_trusted_or_verified(&self, height: Height) -> Option<LightBlock> { ... } }

Store for light blocks.

The light store records light blocks received from peers, and their verification status. Additionally, the light store will contain one or more trusted light blocks specified at initialization time.

Implements

  • [LCV-DIST-STORE.1]

Required methods

pub fn get(&self, height: Height, status: Status) -> Option<LightBlock>[src]

Get the light block at the given height with the given status, or return None otherwise.

pub fn update(&mut self, light_block: &LightBlock, status: Status)[src]

Update the status of the given light_block.

pub fn insert(&mut self, light_block: LightBlock, status: Status)[src]

Insert a new light block in the store with the given status. Overrides any other block with the same height and status.

pub fn remove(&mut self, height: Height, status: Status)[src]

Remove the light block with the given height and status, if any.

pub fn latest(&self, status: Status) -> Option<LightBlock>[src]

Get the light block of greatest height with the given status.

pub fn all(&self, status: Status) -> Box<dyn Iterator<Item = LightBlock>>[src]

Get an iterator of all light blocks with the given status.

Loading content...

Provided methods

pub fn get_non_failed(&self, height: Height) -> Option<(LightBlock, Status)>[src]

Get a block at a given height whatever its verification status as long as it hasn't failed verification (ie. its status is not Status::Failed).

pub fn latest_trusted_or_verified(&self) -> Option<LightBlock>[src]

Get the light block of greatest height with the trusted or verified status.

pub fn get_trusted_or_verified(&self, height: Height) -> Option<LightBlock>[src]

Get the light block of the given height with the trusted or verified status.

Loading content...

Implementors

impl LightStore for MemoryStore[src]

impl LightStore for SledStore[src]

Loading content...