Skip to main content

Crate lora_wal

Crate lora_wal 

Source
Expand description

Write-ahead log for LoraDB.

lora-wal is the additive durability layer that sits between lora_store::MutationEvent producers (the in-memory engine) and a durable byte stream on disk. It is deliberately separate from lora-store:

  • lora-store stays storage-only — backends do not learn about logs, segments, or fsync. The mutation surface they already expose (MutationEvent + MutationRecorder) is the only seam.
  • lora-wal owns segment files, framing, replay, and truncation. Consumers depending on the no-WAL story (wasm, embedded read-only) can avoid this crate entirely.
  • lora-database glues the two together: it installs a WalRecorder onto the store and brackets each query with arm / commit / abort markers so replay sees query-atomic units even though the recorder fires per primitive mutation.

See docs/decisions/0004-wal.md for the full design and docs/operations/wal.md for operator-facing semantics.

Structs§

CommittedTx
One committed transaction as read back from the log.
CommittedTxReader
Lazily yields committed transactions whose TxBegin LSN is above after and whose commit LSN is at or below upto.
Lsn
Monotonic log sequence number.
ReplayOutcome
Outcome of a full replay walk.
SegmentId
Monotonic identifier for a WAL segment file.
TornTailInfo
Wal
Live, append-side WAL handle.
WalPoisonError
WalRecorder
Adapter that lets a Wal act as a MutationRecorder on lora_store::InMemoryGraph::set_mutation_recorder.

Enums§

SyncMode
Durability mode for committed transactions.
WalBufferedCommitError
WalCommitError
WalConfig
Configuration for opening a Wal.
WalError
Failure modes for WAL operations.
WroteCommit
Whether super::WalRecorder::commit actually wrote a TxCommit to the log. Read-only queries — those that never trigger MutationRecorder::record — return WroteCommit::No so the host avoids any WAL I/O just to record an empty transaction.

Traits§

WalMirror
Optional side-effect after the WAL has successfully flushed.

Functions§

oldest_retained_lsn
Lowest LSN the WAL in dir still holds a record for: the base_lsn of its oldest segment. None when the directory has no segments.
replay_dir
Convenience: replay every *.wal segment in dir after sorting by the numeric prefix encoded in the file name.