pub trait Readable: Send + Sync {
type Family: Family;
type Digest: Digest;
type Error;
// Required methods
fn size(&self) -> Position<Self::Family>;
fn get_node(&self, pos: Position<Self::Family>) -> Option<Self::Digest>;
fn root(&self) -> Self::Digest;
fn pruning_boundary(&self) -> Location<Self::Family>;
fn proof(
&self,
hasher: &impl Hasher<Self::Family, Digest = Self::Digest>,
loc: Location<Self::Family>,
) -> Result<Proof<Self::Family, Self::Digest>, Self::Error>;
fn range_proof(
&self,
hasher: &impl Hasher<Self::Family, Digest = Self::Digest>,
range: Range<Location<Self::Family>>,
) -> Result<Proof<Self::Family, Self::Digest>, Self::Error>;
// Provided methods
fn leaves(&self) -> Location<Self::Family> { ... }
fn bounds(&self) -> Range<Location<Self::Family>> { ... }
}Expand description
Read-only interface for a merkleized data structure.
Required Associated Types§
Required Methods§
Sourcefn get_node(&self, pos: Position<Self::Family>) -> Option<Self::Digest>
fn get_node(&self, pos: Position<Self::Family>) -> Option<Self::Digest>
Digest of the node at pos, or None if pruned / out of bounds.
Sourcefn pruning_boundary(&self) -> Location<Self::Family>
fn pruning_boundary(&self) -> Location<Self::Family>
Leaf location up to which pruning has been performed, or 0 if never pruned.
Provided Methods§
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.
Implementations on Foreign Types§
Source§impl<T: Readable> Readable for Arc<T>
impl<T: Readable> Readable for Arc<T>
type Family = <T as Readable>::Family
type Digest = <T as Readable>::Digest
type Error = <T as Readable>::Error
fn size(&self) -> Position<Self::Family>
fn get_node(&self, pos: Position<Self::Family>) -> Option<Self::Digest>
fn root(&self) -> Self::Digest
fn pruning_boundary(&self) -> Location<Self::Family>
fn proof( &self, hasher: &impl Hasher<Self::Family, Digest = Self::Digest>, loc: Location<Self::Family>, ) -> Result<Proof<Self::Family, Self::Digest>, Self::Error>
fn range_proof( &self, hasher: &impl Hasher<Self::Family, Digest = Self::Digest>, range: Range<Location<Self::Family>>, ) -> Result<Proof<Self::Family, Self::Digest>, Self::Error>
Implementors§
Source§impl<F: Family, D: Digest> Readable for commonware_storage::merkle::batch::MerkleizedBatch<F, D>
impl<F: Family, D: Digest> Readable for commonware_storage::merkle::batch::MerkleizedBatch<F, D>
Source§impl<F: Family, D: Digest, Item: Send + Sync> Readable for commonware_storage::journal::authenticated::MerkleizedBatch<F, D, Item>
impl<F: Family, D: Digest, Item: Send + Sync> Readable for commonware_storage::journal::authenticated::MerkleizedBatch<F, D, Item>
Source§impl<F: Family, E: RStorage + Clock + Metrics, D: Digest> Readable for Journaled<F, E, D>
The Readable implementation for the journaled structure operates only on the in-memory
portion. After Journaled::sync, nodes that have been flushed to the journal are no longer
accessible through this interface. In particular, Readable::get_node returns None for
flushed positions, and Readable::pruning_boundary reflects the in-memory boundary (which may
be tighter than the journal’s prune boundary reported by Journaled::bounds). This means
batch operations like update_leaf will correctly reject leaves that have been synced out of
memory with Error::ElementPruned.
impl<F: Family, E: RStorage + Clock + Metrics, D: Digest> Readable for Journaled<F, E, D>
The Readable implementation for the journaled structure operates only on the in-memory
portion. After Journaled::sync, nodes that have been flushed to the journal are no longer
accessible through this interface. In particular, Readable::get_node returns None for
flushed positions, and Readable::pruning_boundary reflects the in-memory boundary (which may
be tighter than the journal’s prune boundary reported by Journaled::bounds). This means
batch operations like update_leaf will correctly reject leaves that have been synced out of
memory with Error::ElementPruned.