Skip to main content

commonware_sync/
lib.rs

1//! Synchronize state between a server and client.
2//!
3//! This example shows how to synchronize a client database to a remote server's database
4//! using either full operation replay or compact state transfer. Full sync uses
5//! [commonware_storage::qmdb::any], [commonware_storage::qmdb::current],
6//! [commonware_storage::qmdb::immutable], or [commonware_storage::qmdb::keyless]. Compact sync
7//! demonstrates the compact-storage variants of
8//! [commonware_storage::qmdb::immutable] and [commonware_storage::qmdb::keyless].
9//! The CLI selects the logical database family with `--family`; in compact mode, only the server
10//! chooses backing storage with `--storage`.
11//!
12//! It includes network protocols, database configuration, and utilities for creating test data.
13
14#![doc(
15    html_logo_url = "https://commonware.xyz/imgs/rustdoc_logo.svg",
16    html_favicon_url = "https://commonware.xyz/favicon.ico"
17)]
18
19pub mod error;
20pub use error::Error;
21pub mod databases;
22pub mod net;
23pub use databases::{any, current, immutable, immutable_compact, keyless, keyless_compact};
24
25/// Returns the version of the crate.
26pub const fn crate_version() -> &'static str {
27    env!("CARGO_PKG_VERSION")
28}
29
30/// Hasher type used in the database.
31pub type Hasher = commonware_cryptography::sha256::Sha256;
32
33/// Digest type used in the database.
34pub type Digest = commonware_cryptography::sha256::Digest;
35
36/// Key type used in the database.
37pub type Key = commonware_cryptography::sha256::Digest;
38
39/// Value type used in the database.
40pub type Value = commonware_cryptography::sha256::Digest;
41
42/// Translator type for the database.
43pub type Translator = commonware_storage::translator::EightCap;