Skip to main content

do_memory_core/sync/
mod.rs

1//! # Storage Synchronization
2//!
3//! Coordinates data synchronization between Turso (durable) and redb (cache) storage layers.
4//!
5//! The synchronizer ensures:
6//! - Two-phase commit for consistency
7//! - Conflict resolution with Turso as source of truth
8//! - Periodic synchronization of cache from durable storage
9//! - Resilience to partial failures
10//!
11//! ## Example
12//!
13//! ```ignore
14//! use do_memory_core::sync::StorageSynchronizer;
15//!
16//! let sync = StorageSynchronizer::new(turso_storage, redb_storage);
17//! sync.start_periodic_sync(Duration::from_secs(300)).await;
18//! ```
19
20pub use self::conflict::{
21    ConflictResolution, resolve_episode_conflict, resolve_heuristic_conflict,
22    resolve_pattern_conflict,
23};
24pub use self::synchronizer::StorageSynchronizer;
25pub use self::two_phase_commit::TwoPhaseCommit;
26pub use self::types::{SyncConfig, SyncState, SyncStats};
27
28mod conflict;
29mod synchronizer;
30mod two_phase_commit;
31mod types;