penumbra_tct::storage

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

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§