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

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

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

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

fn update(&mut self, light_block: &LightBlock, status: Status)

Update the status of the given light_block.

fn insert(&mut self, light_block: LightBlock, status: Status)

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

fn remove(&mut self, height: Height, status: Status)

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

fn latest(&self, status: Status) -> Option<LightBlock>

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

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

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

Loading content...

Provided methods

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

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).

fn latest_trusted_or_verified(&self) -> Option<LightBlock>

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

fn get_trusted_or_verified(&self, height: Height) -> Option<LightBlock>

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...