Expand description
Manages data durability through a Write-Ahead Log (WAL) and snapshotting.
This module provides the PersistenceEngine, which is responsible for ensuring
that committed data survives process crashes and restarts. It operates on the
principle of writing all changes to a log before applying them to the main data
store.
§Strategy
-
Write-Ahead Log (WAL): Transactions are serialized and written to a WAL file. This write can be configured to be fully synced to disk or buffered, depending on the chosen
DurabilityLevel. -
WAL Segmentation: The WAL is split into multiple segment files. When a segment fills up, the engine rotates to the next available one.
-
Snapshotting: A background thread consumes full WAL segments and applies their changes to a consolidated snapshot file. This prevents the WAL from growing indefinitely and speeds up the recovery process.
-
Recovery: On startup, the engine first loads the latest snapshot and then replays any subsequent WAL segments to restore the database to its last known consistent state.
Structs§
- Persistence
Engine - The engine responsible for managing durability via WAL and snapshots.
- Persistence
Options - Options for configuring data durability.
Enums§
- Durability
Level - Defines the durability guarantees for the database.
- WalSegment
State