Expand description
Trace assembly: open, attach event, close. Emits dense, monotonic ordinals.
A TraceAssembler is the in-memory bookkeeping for one open trace. It
tracks the trace id, the open status, and the next ordinal to assign.
Attach returns the ordinal an event should be persisted with (in
trace_events.ordinal, BUILD_SPEC §10).
§Ordinal invariants
- The first attached event gets ordinal
0. - Ordinals are dense (no gaps) and strictly monotonic within a trace.
- Closing a trace freezes its ordinals; further attaches return
Err(TraceError::Closed).
These match the UNIQUE (trace_id, ordinal) constraint in
trace_events.
§What this module does NOT do
- Persist anything. The caller composes a
TraceAssemblerwith aJsonlLog(and later, acortex-storerepository) to actually write rows. - Compute hashes. Hash chaining is
crate::hash’s job; the assembler is purely about ordinal bookkeeping and trace lifecycle.
Structs§
- Trace
Assembler - In-memory assembler for one trace.
Enums§
- Trace
Error - Errors raised by
TraceAssembler.