Trait penumbra_tct::storage::Write

source ·
pub trait Write: Read {
    // Required methods
    fn add_hash(
        &mut self,
        position: Position,
        height: u8,
        hash: Hash,
        essential: bool
    ) -> Result<(), Self::Error>;
    fn add_commitment(
        &mut self,
        position: Position,
        commitment: StateCommitment
    ) -> Result<(), Self::Error>;
    fn delete_range(
        &mut self,
        below_height: u8,
        positions: Range<Position>
    ) -> Result<(), Self::Error>;
    fn set_position(
        &mut self,
        position: StoredPosition
    ) -> Result<(), Self::Error>;
    fn set_forgotten(&mut self, forgotten: Forgotten) -> Result<(), Self::Error>;
}
Expand description

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

Required Methods§

source

fn add_hash( &mut self, position: Position, height: u8, hash: Hash, essential: bool ) -> Result<(), Self::Error>

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( &mut self, position: Position, commitment: StateCommitment ) -> Result<(), Self::Error>

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( &mut self, below_height: u8, positions: Range<Position> ) -> Result<(), Self::Error>

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(&mut self, position: StoredPosition) -> Result<(), Self::Error>

Set the stored position of the tree.

This should return an error if the position goes backwards.

source

fn set_forgotten(&mut self, forgotten: Forgotten) -> Result<(), Self::Error>

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§