penumbra_tct::storage

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§