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 Hash
es and [Commitment
]s, and
garbage-collecting those which have been forgotten.
Required Methods§
sourcefn add_hash(
&mut self,
position: Position,
height: u8,
hash: Hash,
essential: bool
) -> Result<(), Self::Error>
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.
sourcefn add_commitment(
&mut self,
position: Position,
commitment: StateCommitment
) -> Result<(), Self::Error>
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.
sourcefn delete_range(
&mut self,
below_height: u8,
positions: Range<Position>
) -> Result<(), Self::Error>
fn delete_range( &mut self, below_height: u8, positions: Range<Position> ) -> Result<(), Self::Error>
sourcefn set_position(&mut self, position: StoredPosition) -> Result<(), Self::Error>
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.
Object Safety§
This trait is not object safe.