Skip to main content

Module writer

Module writer 

Source
Expand description

JSONL append-only writer + rolling rotation.

RAM contract: a single event lands in two allocations (the JSON line that goes to disk + the serde_json::Value clone that goes to the broadcast hook). Rolling rotation streams through BufReader::lines into a temp file rather than slurping the whole file into a String.

Functions§

init_from_config
Initialize (or disable) the persistence writer from config. Idempotent. When enabled, runs a streaming in-place migration of any schema-1 rows in the existing file before resuming appends.
record_event
Emit one event. Always fans out to the broadcast hook + tracing event. If persistence is enabled, also appends a JSON line to disk.
runtime_trace_path
Public accessor for the canonical log file path. Used by the gateway’s /api/logs endpoint to know which file to stream.