zenkey_fleet/report/scout.rs
1//! The scouting plane (RFC 09 §5): what a UDP scout heard, as a document.
2//! Opt-in, and the report says so — an explorer that scouted by default
3//! would be changing the bus it came to observe.
4
5use serde::Serialize;
6
7/// What a scouting round heard, and what it could have heard (#236).
8///
9/// A wrapper rather than a bare `Vec<HelloView>` for one reason, and it is
10/// RFC 09 §5.1 **O5**: scouting reaches the local multicast domain and the
11/// configured gossip, and nothing else. An empty list is a **boundary**, not a
12/// claim that nothing is running — and a bare array cannot say so, which is
13/// why `zenctl scout --format json` used to print that sentence as *prose on
14/// stdout* where a document was promised.
15#[derive(Debug, Clone, Serialize)]
16pub struct ScoutReport {
17 /// The node kinds asked for; empty means all three.
18 pub asked: Vec<String>,
19 /// How long the round listened.
20 pub timeout_s: f64,
21 /// Distinct nodes heard, first sighting winning — a census, not an
22 /// arrival log.
23 pub heard: Vec<crate::report::HelloView>,
24}
25
26/// One Hello, owned — zenoh's [`Hello`](zenoh::scouting::Hello) is a wrapper we flatten so callers
27/// (a CLI row, a widget) hold plain strings, serialized as they render.
28#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize)]
29pub struct HelloView {
30 /// The node's Zenoh id, hex-formatted.
31 pub zid: String,
32 /// What the node says it is: `router`, `peer`, or `client`.
33 pub whatami: String,
34 /// The locators the node advertises, verbatim.
35 pub locators: Vec<String>,
36}