Expand description
Snapshot capture for readout renders. See SRD-63 §6.
Each event fire captures the rendered output (both
styled and ANSI-stripped) and persists to the session
db’s readout_snapshots table. The latest render per
(slot, subject_kind, subject_id, readout_name, lod)
tuple wins — insert-or-replace upsert keeps the row
count bounded by the scenario tree size.
Push 6 ships:
strip_ansi— utility that turns the styled byte stream into the plain-text fallback column.- [
render_to_snapshot_strings] — convenience that takes aStringSink’s output and returns the(ansi_bytes, plain_text)pair the sqlite writer expects. - The [
SqliteReporter::upsert_readout_snapshot] surface innmbrs-metrics::reporters::sqliteis the actual store.
Wiring the capture into nmbrs-runtime::activity’s
per-event fire sites is intentionally out of scope here
— the activity-side glue lives next to the existing
binder.fire() call sites and threads through whatever
SqliteReporter the session already holds.
Functions§
- capture
- Capture a rendered body to the snapshot store. Best-
effort: a
Nonewriter (snapshots disabled), lock poisoning, or “sqlite init failed” (innerOptionisNone) all collapse to silent no-ops — snapshot capture must never block or corrupt the readout-fire path. - lod_str
- LOD → string serialised for the storage column.
- strip_
ansi - Strip ANSI SGR escape sequences (
\x1b[...m) from a rendered string, leaving the plain text. Used to derive thebody_plaincolumn from the styledbody_ansiblob.
Type Aliases§
- Snapshot
Writer - Handle the activity holds for snapshot writes.