Expand description
open-wal — a focused, embeddable, single-writer append-only write-ahead
log for an LMAX-style, event-sourced system.
Durability-first: a committed record survives process crash and power loss on honest hardware. The WAL stores opaque byte payloads — serialization is entirely the caller’s concern. It is not a database, not multi-writer, and runs no background threads.
The normative design lives in docs/wal_design_v6.md; the durability
invariants D1–D12 there are binding on every change.
This crate is built in milestones (§13). M0 (foundations) provides the
core value types — Lsn, WalConfig, WalError — and the CRC-32C
checksum ([crc32c]). M1 adds the internal record codec (record —
encode/decode of the §5.3 framing). M2 adds the single-segment write
path and replay: Wal::open/append/commit,
a streaming Reader, the DurabilityObserver hook, segment
pre-allocation and fdatasync, and a zero-allocation hot path. M3 adds
intra-segment crash recovery (torn-tail detection + durable zeroing, fatal
mid-log corruption). M4 adds the multi-segment write path — segment roll,
commit-time whole-record split, sealed-segment immutability — and
multi-segment recovery (discovery, cross-segment continuity, crash-during-roll
handling). Checkpoint/retention (M5) arrives later.
Structs§
- Lsn
- Log Sequence Number. Newtype to prevent mixing with byte offsets/counts.
- Null
Observer - The default observer: a verified no-op that inlines to nothing.
- Reader
- Streaming reader over the log, starting at a caller-chosen LSN.
- Recovery
Report - Outcome of recovery, returned by
Wal::open(§6). - Wal
- Single-writer, append-only write-ahead log handle.
- WalConfig
- Configuration for a WAL instance.
Enums§
- Tail
State - State of the active segment’s tail after recovery (§6).
- WalError
- All error conditions surfaced by the WAL.
Traits§
- Durability
Observer - Notified after each successful durability advance, on the writer thread.
Functions§
- crc32c
- Compute the CRC-32C (Castagnoli) checksum of
data.
Type Aliases§
- Result
- Convenience alias for results returned by this crate.