penumbra_tct::storage

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

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§