pub trait CheckpointDriver: Send + Sync {
// Required methods
fn current_wal_bytes(&self) -> u64;
fn last_checkpoint_wal_bytes(&self) -> u64;
fn run_checkpoint(&self) -> CheckpointResult;
}Expand description
Trait the database must implement so the checkpointer can
drive the actual checkpoint without depending on the full
Database struct.
Required Methods§
Sourcefn current_wal_bytes(&self) -> u64
fn current_wal_bytes(&self) -> u64
Current WAL byte position. Used to decide when WAL has grown enough to trigger a checkpoint.
Sourcefn last_checkpoint_wal_bytes(&self) -> u64
fn last_checkpoint_wal_bytes(&self) -> u64
Last completed checkpoint’s WAL byte position.
Sourcefn run_checkpoint(&self) -> CheckpointResult
fn run_checkpoint(&self) -> CheckpointResult
Run a full checkpoint:
- Walk every dirty page, flush via pager.
- Write a Checkpoint WAL record.
- Truncate WAL up to the previous checkpoint’s redo.
Returns (pages_flushed, new_redo_lsn, truncated_bytes).