Expand description
TSJSON event writer/serializer.
Serializes Event structs to TSJSON (tab-separated) lines. Guarantees:
- Canonical JSON payload (keys sorted, compact, no whitespace).
- One-line invariant: no literal
\nin the serialized JSON. - Deterministic: same event always produces the same output bytes.
- Event hash is BLAKE3 of fields 1–7 joined by tabs, newline-terminated.
§TSJSON Format
{wall_ts_us}\t{agent}\t{itc}\t{parents}\t{type}\t{item_id}\t{data_json}\t{event_hash}\nEnums§
- Write
Error - Errors that can occur during event writing.
Constants§
- FIELD_
COMMENT - The field-description comment line written after the shard header.
- SHARD_
HEADER - The shard header line written at the start of new event log files.
Functions§
- compute_
event_ hash - Compute the BLAKE3 event hash from fields 1–7 of an Event.
- shard_
header - Return the shard header block (header + field comment) for a new event file.
- to_
tsjson_ line - Serialize an
Eventto a single TSJSON line (without trailing newline). - write_
event - Compute the event hash and set it on a mutable Event, then serialize.
- write_
line - Serialize an
Eventto a TSJSON line with trailing newline.