Expand description
Production-grade Write-Ahead Log (WAL) for crash recovery and durability.
Entries are encoded in a binary format and stored in an in-memory Vec<u8>
segment buffer. The encoding is self-describing and checksum-protected so
that any corruption is detected deterministically during recovery.
§Entry layout
[magic(4)] [seq_num(8)] [tx_id(8)] [op_type(1)] [key_len(4)] [key(n)]
[value_len(4)] [value(m)] [timestamp(8)] [checksum(8)]The checksum is the FNV-1a 64-bit hash of all preceding bytes in the entry.
Structs§
- Recovery
Result - Summary of a recovery scan over a WAL segment buffer.
- Transaction
- An in-memory transaction record tracking accumulated entries.
- WalConfig
- Configuration knobs for
WalWriteAheadLog. - WalEntry
- A single decoded entry in the write-ahead log.
- WalStats
- Live statistics snapshot of a
WalWriteAheadLog. - WalWrite
Ahead Log - In-memory, crash-recovery Write-Ahead Log.
Enums§
- TxState
- Lifecycle state of an in-flight or completed transaction.
- WalError
- Errors returned by
WalWriteAheadLogoperations. - WalOp
Type - Discriminant for WAL entry operations.
Constants§
- WAL_
MAGIC - WAL entry magic bytes — detect non-WAL or truncated data immediately.
Functions§
- fnv1a_
64 - Computes the FNV-1a 64-bit hash of
data.