namespace ZB.MOM.WW.CBDD.Core.Transactions; /// /// Defines checkpoint modes for WAL (Write-Ahead Log) checkpointing. /// Similar to SQLite's checkpoint strategies. /// public enum CheckpointMode { /// /// Passive checkpoint: non-blocking, best-effort transfer from WAL to database. /// If the checkpoint lock is busy, the operation is skipped. /// WAL content is preserved and a checkpoint marker is appended when work is applied. /// Passive = 0, /// /// Full checkpoint: waits for the checkpoint lock, transfers committed pages to /// the page file, and preserves WAL content by appending a checkpoint marker. /// Full = 1, /// /// Truncate checkpoint: same as but truncates WAL after /// successfully applying committed pages. Use this to reclaim disk space. /// Truncate = 2, /// /// Restart checkpoint: same as and then reinitializes /// the WAL stream for a fresh writer session. /// Restart = 3 } /// /// Result of a checkpoint execution. /// /// Requested checkpoint mode. /// True when checkpoint logic ran; false when skipped (for passive mode contention). /// Number of pages copied from WAL index to page file. /// WAL size before the operation. /// WAL size after the operation. /// True when WAL was truncated by this operation. /// True when WAL stream was restarted by this operation. public readonly record struct CheckpointResult( CheckpointMode Mode, bool Executed, int AppliedPages, long WalBytesBefore, long WalBytesAfter, bool Truncated, bool Restarted);