Syncable

Trait Syncable 

Source
pub trait Syncable: Sized {
    type Operation: Operation + Encode + Sync + 'static;

    // Required methods
    fn create_test_operations(count: usize, seed: u64) -> Vec<Self::Operation>;
    fn add_operations(
        self,
        operations: Vec<Self::Operation>,
    ) -> impl Future<Output = Result<Self, Error>>;
    fn root(&self) -> Key;
    fn op_count(&self) -> Location;
    fn lower_bound(&self) -> Location;
    fn historical_proof(
        &self,
        op_count: Location,
        start_loc: Location,
        max_ops: NonZeroU64,
    ) -> impl Future<Output = Result<(Proof<Key>, Vec<Self::Operation>), Error>> + Send;
    fn name() -> &'static str;
}
Expand description

Helper trait for databases that can be synced.

Required Associated Types§

Source

type Operation: Operation + Encode + Sync + 'static

The type of operations in the database.

Required Methods§

Source

fn create_test_operations(count: usize, seed: u64) -> Vec<Self::Operation>

Create test operations with the given count and seed. The returned operations must end with a commit operation.

Source

fn add_operations( self, operations: Vec<Self::Operation>, ) -> impl Future<Output = Result<Self, Error>>

Add operations to the database and return the clean database, ignoring any input that doesn’t end with a commit operation (since without a commit, we can’t return a clean DB).

Source

fn root(&self) -> Key

Get the database’s root digest.

Source

fn op_count(&self) -> Location

Get the operation count of the database.

Source

fn lower_bound(&self) -> Location

Get the lower bound for operations (inactivity floor or oldest retained location).

Source

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

Get historical proof and operations.

Source

fn name() -> &'static str

Get the database type name for logging.

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> Syncable for commonware_sync::databases::any::Database<E>
where E: Storage + Clock + Metrics,

Source§

type Operation = Operation<Digest, FixedEncoding<Digest>, Update<Digest, FixedEncoding<Digest>>>

Source§

impl<E> Syncable for commonware_sync::databases::immutable::Database<E>
where E: Storage + Clock + Metrics,