pub struct TeamTrace {
pub run_ids: Vec<String>,
pub roots: Vec<String>,
pub nodes: Vec<TeamTraceNode>,
}Expand description
A cross-journal causal tree assembled from verified journal snapshots (R0.7 wave 3).
Fields§
§run_ids: Vec<String>Every run id that contributed events, sorted — the journals this trace stitched together.
roots: Vec<String>The event ids of the trace’s roots, sorted. A connected
coordination has exactly one root: its CoordinationStart event.
nodes: Vec<TeamTraceNode>Every node, sorted by (run_id, seq) — a total, deterministic
order over the whole assembled tree.
Implementations§
Source§impl TeamTrace
impl TeamTrace
Sourcepub fn assemble(snapshots: &[JournalSnapshot]) -> Self
pub fn assemble(snapshots: &[JournalSnapshot]) -> Self
Assemble one trace from verified journal snapshots.
The algorithm:
- Collect every event of every snapshot into nodes keyed by event id. Duplicate ids (the same journal supplied twice) collapse — the event is one fact.
- Link children: an event whose
parentnames an event inside the assembled set is that node’s child. A parent outside the set does not make the event parentless —parentkeeps naming it — but it does make the event a root of this trace. - Assign depths breadth-first from the roots, with a visited set
so a parent cycle can never loop the walk; cycle members that no
root reaches keep
depth: None.
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
true when the assembled trace is one connected tree: exactly one
root, and every node reachable from it (no detached cycles). A
coordination’s journal set should always assemble connected — the
CoordinationStart event is the single causal root; anything else
means journals are missing from the assembly or events were
corrupted, and the caller should treat the trace as incomplete
evidence rather than as a tree.
Sourcepub fn node(&self, event_id: &str) -> Option<&TeamTraceNode>
pub fn node(&self, event_id: &str) -> Option<&TeamTraceNode>
Look up one node by event id.