pub struct Event {
pub ts: DateTime<Utc>,
pub seq: u64,
pub kind: String,
pub run_id: RunId,
pub node_id: Option<NodeId>,
pub idempotency_key: Option<String>,
pub data: Value,
}Expand description
One event-log line (design.md §1.4).
run_id / node_id are the typed id newtypes, so deserializing an
events.jsonl line validates the whole envelope on read: a malformed
run_id or node_id fails the serde parse at the read boundary (the
id newtypes’ validating Deserialize) rather than being carried as an
unvalidated String until some later path helper. The parse failure
surfaces as whatever error the reader maps a bad line to — e.g. a
newline-terminated bad line is Error::CorruptEventLog from both
read_all_events and find_prior_with_key, which share one physical
reader and torn-tail policy. The reducer still performs its own per-event
checks (envelope run_id matches the run it is folded into; data-borne
ids parse), but the envelope ids can no longer be the unvalidated party.
Fields§
§ts: DateTime<Utc>Wall-clock timestamp the event was appended.
seq: u64Monotonic per-run sequence number (recovered on append).
kind: StringEvent kind discriminator (e.g. node.created, discussion.opened).
run_id: RunIdRun the event belongs to. Validated on read.
node_id: Option<NodeId>Node the event concerns, when applicable. Validated on read.
idempotency_key: Option<String>Caller-supplied key used to dedupe retried appends.
data: ValueKind-specific payload applied by the reducer.