commonware_storage/qmdb/sync/
mod.rs1use crate::qmdb::sync::engine::Config;
13use commonware_macros::boxed;
14
15pub mod engine;
16pub(crate) use engine::Engine;
17
18mod error;
19pub use error::{EngineError, Error, ServeError};
20
21mod gaps;
22pub(crate) mod journal;
23pub(crate) use journal::Journal;
24
25#[cfg(test)]
26pub(crate) mod harness;
27
28mod metrics;
29pub use metrics::Metrics;
30
31mod database;
32pub use database::Database;
33pub(crate) use database::{Config as DatabaseConfig, journal_covers_range, local_pinned_nodes};
34
35pub mod source;
36pub use source::{Feedback, Request, Response, ResponseOf, Source, max_response_size};
37
38mod target;
39pub use target::{CompactTarget, Target};
40
41mod requests;
42
43pub trait SourceFor<DB: Database>:
45 Source<Family = DB::Family, Op = DB::Op, Digest = DB::Digest> + 'static
46{
47}
48
49impl<DB, S> SourceFor<DB> for S
50where
51 DB: Database,
52 S: Source<Family = DB::Family, Op = DB::Op, Digest = DB::Digest> + 'static,
53{
54}
55
56#[boxed]
58pub async fn sync<DB, S>(
59 config: Config<DB, S>,
60) -> Result<DB, Error<DB::Family, S::Error, DB::Digest>>
61where
62 DB: Database,
63 S: SourceFor<DB>,
64{
65 Engine::new(config).await?.sync().await
66}