#[non_exhaustive]pub enum StreamFrame {
Snapshot {
active_sessions: Vec<ActiveSession>,
reachability: Vec<PeerReachability>,
},
Event {
record: Box<AuditRecord>,
},
Reachability {
peer: PeerReachability,
},
Lagged {
dropped: u64,
},
}Expand description
One frame of the Request::Subscribe stream (pairing liveness & health telemetry). Tagged on
type (snake_case), so a frame is {"type":"snapshot",...} / {"type":"event",...} /
{"type":"lagged",...}. Event.record is the AuditRecord verbatim, so the stream and the
on-disk log carry ONE schema. The daemon serializes these; an embedding consumer deserializes
them (see docs/local-protocol.md “Live event stream”).
#[non_exhaustive]: a future frame kind must not break a downstream match. Adding
Reachability in 0.13.0 DID break exhaustive matches — which is why that release is a MINOR,
per RELEASING.md’s pre-1.0 rule that breaking changes bump the minor. Consumers now write a
_ => arm and later additions are additive for Rust as well as for JSON.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Snapshot
The FIRST frame: a point-in-time picture of the mesh (open sessions + paired-peer reachability) so a fresh subscriber renders immediately without replaying history.
Event
A live audit event (session open/close, request, blob fetch, trust) — the tap on the hub.
Boxed so this (much larger) variant does not bloat every frame; serde delegates through the
Box, so the wire shape is the record’s fields verbatim.
Fields
record: Box<AuditRecord>Reachability
A peer’s reachability TRANSITIONED (#58): it became reachable, became unreachable, or was
probed for the first time. Pushed so an embedder does not have to poll status for a live
online/offline indicator — and so work queued for an unreachable peer can flush the moment
it returns, rather than on the next poll tick.
Emitted on a change of reachable or of path. A refresh with the same verdict AND the
same path emits nothing, so a peer that stays up does not produce a frame per TTL refresh;
rtt_ms/meta/services drift is advisory detail and is not a transition. age_secs is
0 — the observation just completed.
Do not treat this as an up/down toggle. It carried that meaning through 0.18, and this
doc said “on a CHANGE of reachable only” until 1.22 — which stopped being true in 0.19.0
(#92 item 1), when path joined the transition rule. A consumer that assumed same-verdict
frames were impossible was reading a stale guarantee.
Two producers, as of API 1.22:
- a probe completing (
status/subscriberefreshing a stale entry), which carries a measuredrtt_ms; and - a live session whose selected path changed under it (#92 item 2), which carries
rtt_ms: Noneon a first observation — no round trip was measured and none is invented.
The second producer is why path is trustworthy for a long-lived session: a session that
degrades Direct→Relay mid-call now says so when it happens, rather than staying silently
mislabelled until something probes. path is a truth claim about where user data went, so
Unknown means “we do not know” and must never be rendered as private.
Fields
peer: PeerReachabilityLagged
The subscriber fell dropped records behind the broadcast ring; the stream continues (a
fresh reconnect would re-Snapshot). Never drops the subscriber — lag is reported, never fatal.
Trait Implementations§
Source§impl Clone for StreamFrame
impl Clone for StreamFrame
Source§fn clone(&self) -> StreamFrame
fn clone(&self) -> StreamFrame
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more