surreal_sync_core/checkpoint/mod.rs
1//! Checkpoint management API for surreal-sync.
2//!
3//! Storage backends live in separate crates (`surreal_sync_runtime::checkpoint_fs`,
4//! `surreal_sync_surreal` features `v2` / `v3` checkpoint modules). This module holds only the
5//! storage-agnostic types and traits — no `tokio` or `surrealdb`.
6
7mod config;
8mod file;
9mod manager;
10mod phase;
11mod snapshot;
12mod snapshot_checkpointer;
13pub mod store;
14
15pub use config::{CheckpointStorage, SyncConfig};
16pub use file::CheckpointFile;
17pub use manager::{NullStore, NullSyncManager, SyncManager};
18pub use phase::SyncPhase;
19pub use snapshot::{InterleavedSnapshotCheckpoint, SnapshotTableProgress};
20pub use snapshot_checkpointer::SnapshotCheckpointer;
21pub use store::{CheckpointID, CheckpointStore, StoredCheckpoint};
22
23/// Trait that database-specific checkpoints must implement.
24///
25/// This trait defines the interface for checkpoint types, enabling
26/// storage-agnostic checkpoint file handling while preserving
27/// database-specific data structures.
28pub trait Checkpoint: serde::Serialize + for<'de> serde::Deserialize<'de> + Clone {
29 /// Database type identifier (e.g., "mongodb", "neo4j", "postgresql", "mysql").
30 const DATABASE_TYPE: &'static str;
31
32 /// Convert to CLI-friendly string format.
33 fn to_cli_string(&self) -> String;
34
35 /// Parse from CLI string format.
36 fn from_cli_string(s: &str) -> anyhow::Result<Self>
37 where
38 Self: Sized;
39}