Expand description
The handoff log: one row per swap, with the numbers at_percent is
tuned from.
A row is written at the swap and completed once its successor has run its first turns: the fill it fired at, the cycle it ended, and how much of the predecessor’s work the successor had to re-derive. That last half is what separates a premature handoff (a successor re-reading everything) from a late one (a compaction that fired first).
Re-exports§
use anyhow::Context;🔒use forge_primitives::HandoffRecord;🔒use forge_primitives::HandoffSuccessor;🔒use forge_primitives::SessionSlot;🔒use redb::ReadableTable;🔒use redb::TableDefinition;🔒use super::Db;🔒
Structs§
- Stored
Handoff 🔒 - One stored row: the record, and what the successor’s re-reads are measured against.
Constants§
- HANDOFFS 🔒
Functions§
- for_
successor - The handoff
occupantwas the successor of, with what its predecessor had read.Nonewhen this occupant did not arrive by a handoff. - put
- Write one handoff.
- row_key 🔒
- One row’s key: the seat, then the instant (RFC 3339 sorts by time), then the successor. The successor is in the key because two handoffs at one instant are still two rows.
- rows_
for_ 🔒slot - A seat’s rows, oldest first. A row that fails to decode is skipped loudly rather than failing the read: a damaged record is not a reason to stop drawing the handoff that did decode.
- seat_
prefix 🔒 - The key every row of one seat shares. Its rows sort by it first, so a seat’s newest row is its last.
- set_
successor - Record how the successor’s first turns went.