Skip to main content

engram/sync/
mod.rs

1//! Cloud sync functionality (RML-875)
2//!
3//! Non-blocking S3/R2/GCS sync with debouncing.
4//!
5//! # Feature Flags
6//!
7//! This module requires the `cloud` feature to be enabled for cloud storage backends.
8//! The conflict resolution logic is always available.
9
10#[cfg(feature = "cloud")]
11mod cloud;
12pub mod conflict;
13#[cfg(feature = "cloud")]
14mod worker;
15
16#[cfg(feature = "cloud")]
17pub use cloud::CloudStorage;
18pub use conflict::{
19    Conflict, ConflictDetector, ConflictInfo, ConflictQueue, ConflictResolver, ConflictType,
20    MergeResult, Resolution, ResolutionStrategy, SyncMemoryVersion, ThreeWayMerge,
21};
22#[cfg(feature = "cloud")]
23pub use worker::{get_sync_status, SyncWorker};
24
25use chrono::{DateTime, Utc};
26
27/// Sync direction
28#[derive(Debug, Clone, Copy, PartialEq, Eq)]
29pub enum SyncDirection {
30    Push,
31    Pull,
32    Bidirectional,
33}
34
35/// Sync event for logging/notifications
36#[derive(Debug, Clone)]
37pub struct SyncEvent {
38    pub direction: SyncDirection,
39    pub started_at: DateTime<Utc>,
40    pub completed_at: Option<DateTime<Utc>>,
41    pub bytes_transferred: u64,
42    pub success: bool,
43    pub error: Option<String>,
44}