Trait penumbra_tct::storage::Read

source ·
pub trait Read {
    type Error;
    type HashesIter<'a>: Iterator<Item = Result<(Position, u8, Hash), Self::Error>> + 'a
       where Self: 'a;
    type CommitmentsIter<'a>: Iterator<Item = Result<(Position, StateCommitment), Self::Error>> + 'a
       where Self: 'a;

    // Required methods
    fn position(&mut self) -> Result<StoredPosition, Self::Error>;
    fn forgotten(&mut self) -> Result<Forgotten, Self::Error>;
    fn hash(
        &mut self,
        position: Position,
        height: u8
    ) -> Result<Option<Hash>, Self::Error>;
    fn hashes(&mut self) -> Self::HashesIter<'_>;
    fn commitment(
        &mut self,
        position: Position
    ) -> Result<Option<StateCommitment>, Self::Error>;
    fn commitments(&mut self) -> Self::CommitmentsIter<'_>;
}
Expand description

A synchronous storage backend capable of reading stored Hashes and [Commitment]s as well as storing the current Position.

Required Associated Types§

source

type Error

The error returned when something goes wrong in a request.

source

type HashesIter<'a>: Iterator<Item = Result<(Position, u8, Hash), Self::Error>> + 'a where Self: 'a

The type of iterator returned when reading hashes from the database.

source

type CommitmentsIter<'a>: Iterator<Item = Result<(Position, StateCommitment), Self::Error>> + 'a where Self: 'a

The type of iterator returned when reading commitments from the database.

Required Methods§

source

fn position(&mut self) -> Result<StoredPosition, Self::Error>

Fetch the current position stored.

source

fn forgotten(&mut self) -> Result<Forgotten, Self::Error>

Fetch the current forgotten version.

source

fn hash( &mut self, position: Position, height: u8 ) -> Result<Option<Hash>, Self::Error>

Fetch a specific hash at the given position and height, if it exists.

source

fn hashes(&mut self) -> Self::HashesIter<'_>

Get the full list of all internal hashes stored, indexed by position and height.

source

fn commitment( &mut self, position: Position ) -> Result<Option<StateCommitment>, Self::Error>

Fetch a specific commitment at the given position, if it exists.

source

fn commitments(&mut self) -> Self::CommitmentsIter<'_>

Get the full list of all commitments stored, indexed by position.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Read for InMemory

§

type Error = Error

§

type HashesIter<'a> = Box<dyn Iterator<Item = Result<(Position, u8, Hash), <InMemory as Read>::Error>> + Send + 'a>

§

type CommitmentsIter<'a> = Box<dyn Iterator<Item = Result<(Position, StateCommitment), <InMemory as Read>::Error>> + Send + 'a>