Trait penumbra_tct::storage::AsyncWrite

source ·
pub trait AsyncWrite: AsyncRead {
    // Required methods
    fn add_hash<'life0, 'async_trait>(
        &'life0 mut self,
        position: Position,
        height: u8,
        hash: Hash,
        essential: bool
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn add_commitment<'life0, 'async_trait>(
        &'life0 mut self,
        position: Position,
        commitment: StateCommitment
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete_range<'life0, 'async_trait>(
        &'life0 mut self,
        below_height: u8,
        positions: Range<Position>
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_position<'life0, 'async_trait>(
        &'life0 mut self,
        position: StoredPosition
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_forgotten<'life0, 'async_trait>(
        &'life0 mut self,
        forgotten: Forgotten
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

An async storage backend capable of writing Hashes and [Commitment]s, and garbage-collecting those which have been forgotten.

Required Methods§

source

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

Write a single hash into storage.

Backends are only required to persist hashes marked as essential. They may choose to persist other hashes, and the choice of which non-essential hashes to persist is unconstrained. However, choosing not to persist non-essential hashes imposes computational overhead upon deserialization.

source

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

Write a single commitment into storage.

This should return an error if a commitment is already present at that location; no location’s value should ever be overwritten.

source

fn delete_range<'life0, 'async_trait>( &'life0 mut self, below_height: u8, positions: Range<Position> ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Delete every stored Hash whose height is less than below_height and whose position is within the half-open Range of positions, as well as every [Commitment] whose position is within the range.

source

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

Set the stored position of the tree.

This should return an error if the position goes backwards.

source

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

Set the forgotten version of the tree.

This should return an error if the version goes backwards.

Object Safety§

This trait is not object safe.

Implementors§