Skip to main content

CheckpointDriver

Trait CheckpointDriver 

Source
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§

Source

fn current_wal_bytes(&self) -> u64

Current WAL byte position. Used to decide when WAL has grown enough to trigger a checkpoint.

Source

fn last_checkpoint_wal_bytes(&self) -> u64

Last completed checkpoint’s WAL byte position.

Source

fn run_checkpoint(&self) -> CheckpointResult

Run a full checkpoint:

  1. Walk every dirty page, flush via pager.
  2. Write a Checkpoint WAL record.
  3. Truncate WAL up to the previous checkpoint’s redo.

Returns (pages_flushed, new_redo_lsn, truncated_bytes).

Implementors§