Module wal

Module wal 

Source
Expand description

Write-Ahead Log (WAL)

Provides durability guarantees for record operations.

§Architecture

┌─────────────────────────────────────────────────────────────┐
│                   Write-Ahead Log (WAL)                      │
├─────────────────────────────────────────────────────────────┤
│  1. Log entry to WAL (fsync)                                 │
│  2. Apply to in-memory buffer                                │
│  3. Periodically checkpoint to persistent store              │
│  4. Truncate WAL after successful checkpoint                 │
└─────────────────────────────────────────────────────────────┘

§Invariants

  • INV-003: WAL-before-buffer (operations logged before applied)

§Entry Types

  • Insert: Add a new record
  • UpdateStats: Update outcome statistics
  • Delete: Mark record as deleted

Structs§

WalConfig
WAL configuration.
WalEntry
A single WAL entry.
WalReader
WAL file reader.
WalWriter
Write-ahead log writer.

Enums§

WalEntryType
Type of WAL entry.