ReadonlycapacityThe rewind window, in captures.
ReadonlytargetThe simulation this buffer snapshots and rewinds.
The most recent captured step, or undefined when empty.
The oldest step still rewindable, or undefined when empty.
How many snapshots are held. Never exceeds RollbackBuffer.capacity.
The captured steps, ascending — the exact set rollbackTo accepts.
Snapshots the target as the state at the end of fixed step step.
Evicts the oldest snapshot once the ring is full. Steps must arrive strictly ascending: a simulation runs forwards, and a repeat or a going-backwards capture means the caller's own step counter disagrees with the one it rewound to — which is exactly the bug this class exists to make impossible to have silently.
FourError if step is not a non-negative integer, or is not
greater than RollbackBuffer.newestStep
Forgets every snapshot. The target is not touched.
Whether step can still be rolled back to.
Restores the target to the state captured at step and forgets everything
after it, returning how many fixed steps the caller must re-simulate to
get back to where it was.
The returned count is newestStep − step, so re-simulating exactly that
many steps lands on the same step number the simulation was on before the
rewind. rollbackTo(newestStep) restores and returns 0 — a legitimate
call, and the cheap way to discard uncommitted state.
step itself stays in the buffer: rolling back to the same step twice is
ordinary in a network predictor that receives two late inputs for one step.
A bounded, ordered ring of simulation snapshots that can rewind its target to any step it still holds (§33 rollback, §34).
See the module header for why it never re-simulates, and for what else the caller must rewind alongside it.