Trait penumbra_tct::storage::AsyncRead

source ·
pub trait AsyncRead {
    type Error;
    type HashesStream<'a>: Stream<Item = Result<(Position, u8, Hash), Self::Error>> + Unpin + 'a
       where Self: 'a;
    type CommitmentsStream<'a>: Stream<Item = Result<(Position, StateCommitment), Self::Error>> + Unpin + 'a
       where Self: 'a;

    // Required methods
    fn position<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<StoredPosition, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn forgotten<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<Forgotten, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn hash<'life0, 'async_trait>(
        &'life0 mut self,
        position: Position,
        height: u8
    ) -> Pin<Box<dyn Future<Output = Result<Option<Hash>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn hashes(&mut self) -> Self::HashesStream<'_>;
    fn commitment<'life0, 'async_trait>(
        &'life0 mut self,
        position: Position
    ) -> Pin<Box<dyn Future<Output = Result<Option<StateCommitment>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn commitments(&mut self) -> Self::CommitmentsStream<'_>;
}
Expand description

An async 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 HashesStream<'a>: Stream<Item = Result<(Position, u8, Hash), Self::Error>> + Unpin + 'a where Self: 'a

The type of stream returned by AsyncRead::hashes.

source

type CommitmentsStream<'a>: Stream<Item = Result<(Position, StateCommitment), Self::Error>> + Unpin + 'a where Self: 'a

The type of stream returned by AsyncRead::commitments.

Required Methods§

source

fn position<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<StoredPosition, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Fetch the current position stored.

source

fn forgotten<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<Forgotten, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Fetch the current forgotten version.

source

fn hash<'life0, 'async_trait>( &'life0 mut self, position: Position, height: u8 ) -> Pin<Box<dyn Future<Output = Result<Option<Hash>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

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

source

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

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

source

fn commitment<'life0, 'async_trait>( &'life0 mut self, position: Position ) -> Pin<Box<dyn Future<Output = Result<Option<StateCommitment>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

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

source

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

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

Object Safety§

This trait is not object safe.

Implementors§