surreal_sync_core/checkpoint/snapshot_checkpointer.rs
1//! Trait for persisting resumable interleaved-snapshot progress.
2//!
3//! The watermark loop is decoupled from any concrete storage: it builds an
4//! [`InterleavedSnapshotCheckpoint`] after each chunk and hands it to a
5//! [`SnapshotCheckpointer`]. Concrete backends (no-op, manager bridge, …) live
6//! outside this crate.
7
8use super::InterleavedSnapshotCheckpoint;
9use anyhow::Result;
10
11/// Receives resumable snapshot checkpoints emitted per chunk.
12#[async_trait::async_trait]
13pub trait SnapshotCheckpointer: Send {
14 /// Persist progress made so far. Called after each chunk is durably
15 /// applied to the sink and before the corresponding change-log data is
16 /// freed.
17 async fn save_progress(&mut self, checkpoint: &InterleavedSnapshotCheckpoint) -> Result<()>;
18}