Syncable

Trait Syncable 

Source
pub trait Syncable {
    type Operation: Clone + Read<Cfg = ()> + Encode + Send + Sync + 'static;

    // Required methods
    fn create_test_operations(count: usize, seed: u64) -> Vec<Self::Operation>;
    fn add_operations(
        database: &mut Self,
        operations: Vec<Self::Operation>,
    ) -> impl Future<Output = Result<(), Error>>;
    fn commit(&mut self) -> impl Future<Output = Result<(), Error>>;
    fn root(&self, hasher: &mut Standard<Sha256>) -> Key;
    fn op_count(&self) -> u64;
    fn lower_bound_ops(&self) -> u64;
    fn historical_proof(
        &self,
        size: u64,
        start_loc: u64,
        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: Clone + Read<Cfg = ()> + Encode + Send + 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.

Source

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

Add operations to the database.

Source

fn commit(&mut self) -> impl Future<Output = Result<(), Error>>

Commit pending operations to the database.

Source

fn root(&self, hasher: &mut Standard<Sha256>) -> Key

Get the database’s root digest.

Source

fn op_count(&self) -> u64

Get the operation count of the database.

Source

fn lower_bound_ops(&self) -> u64

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

Source

fn historical_proof( &self, size: u64, start_loc: u64, 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§

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