CleanStore

Trait CleanStore 

Source
pub trait CleanStore: LogStore {
    type Digest: Digest;
    type Operation;
    type Dirty: DirtyStore<Digest = Self::Digest, Operation = Self::Operation, Clean = Self, Value = Self::Value>;

    // Required methods
    fn root(&self) -> Self::Digest;
    fn proof(
        &self,
        start_loc: Location,
        max_ops: NonZeroU64,
    ) -> impl Future<Output = Result<(Proof<Self::Digest>, Vec<Self::Operation>), Error>>;
    fn historical_proof(
        &self,
        historical_size: Location,
        start_loc: Location,
        max_ops: NonZeroU64,
    ) -> impl Future<Output = Result<(Proof<Self::Digest>, Vec<Self::Operation>), Error>>;
    fn into_dirty(self) -> Self::Dirty;
}
Expand description

A trait for authenticated stores in a “clean” state where the MMR root is computed.

Required Associated Types§

Source

type Digest: Digest

The digest type used for authentication.

Source

type Operation

The operation type stored in the log.

Source

type Dirty: DirtyStore<Digest = Self::Digest, Operation = Self::Operation, Clean = Self, Value = Self::Value>

The dirty state type that this clean store transitions to.

Required Methods§

Source

fn root(&self) -> Self::Digest

Returns the root digest of the authenticated store.

Source

fn proof( &self, start_loc: Location, max_ops: NonZeroU64, ) -> impl Future<Output = Result<(Proof<Self::Digest>, Vec<Self::Operation>), Error>>

Generate and return:

  1. a proof of all operations applied to the store in the range starting at (and including) location start_loc, and ending at the first of either:
    • the last operation performed, or
    • the operation max_ops from the start.
  2. the operations corresponding to the leaves in this range.
§Errors

Returns crate::mmr::Error::LocationOverflow if start_loc > crate::mmr::MAX_LOCATION. Returns crate::mmr::Error::RangeOutOfBounds if start_loc >= op_count.

Source

fn historical_proof( &self, historical_size: Location, start_loc: Location, max_ops: NonZeroU64, ) -> impl Future<Output = Result<(Proof<Self::Digest>, Vec<Self::Operation>), Error>>

Generate and return:

  1. a proof of all operations applied to the store in the range starting at (and including) location start_loc, and ending at the first of either:
    • the last operation performed, or
    • the operation max_ops from the start.
  2. the operations corresponding to the leaves in this range.

for the store when it had historical_size operations.

§Errors

Returns crate::mmr::Error::LocationOverflow if start_loc > crate::mmr::MAX_LOCATION. Returns crate::mmr::Error::RangeOutOfBounds if start_loc >= op_count.

Source

fn into_dirty(self) -> Self::Dirty

Convert this clean store into its dirty counterpart for batched updates.

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§

Source§

impl<E: RStorage + Clock + Metrics, K: Array, V: FixedValue, H: Hasher, T: Translator, const N: usize> CleanStore for commonware_storage::qmdb::current::ordered::fixed::Db<E, K, V, H, T, N, Clean<DigestOf<H>>>

Source§

type Digest = <H as Hasher>::Digest

Source§

type Operation = Operation<K, FixedEncoding<V>, Update<K, FixedEncoding<V>>>

Source§

type Dirty = Db<E, K, V, H, T, N, Dirty>

Source§

impl<E: RStorage + Clock + Metrics, K: Array, V: FixedValue, H: Hasher, T: Translator, const N: usize> CleanStore for commonware_storage::qmdb::current::unordered::fixed::Db<E, K, V, H, T, N, Clean<DigestOf<H>>>

Source§

type Digest = <H as Hasher>::Digest

Source§

type Operation = Operation<K, FixedEncoding<V>, Update<K, FixedEncoding<V>>>

Source§

type Dirty = Db<E, K, V, H, T, N, Dirty>

Source§

impl<E: RStorage + Clock + Metrics, K: Array, V: VariableValue, H: CHasher, T: Translator> CleanStore for Immutable<E, K, V, H, T, Clean<H::Digest>>

Source§

type Digest = <H as Hasher>::Digest

Source§

type Operation = Operation<K, V>

Source§

type Dirty = Immutable<E, K, V, H, T, Dirty>

Source§

impl<E: Storage + Clock + Metrics, V: VariableValue, H: Hasher> CleanStore for Keyless<E, V, H, Clean<H::Digest>>