#[non_exhaustive]pub enum RegisterResult {
#[non_exhaustive] Ok {
daemon_id: DaemonId,
peer_zenoh_endpoints: Vec<String>,
},
Err(String),
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
#[non_exhaustive]Ok
Constructed through RegisterResult::ok, not by literal: the variant
is #[non_exhaustive] so that the next field added here is a minor
change rather than a 2.0. Adding peer_zenoh_endpoints to an exhaustive
variant was itself a major break (enum_struct_variant_field_added);
paying it once, with the attribute, is what keeps it from recurring.
Fields
This variant is marked as non-exhaustive
peer_zenoh_endpoints: Vec<String>Zenoh listen endpoints of the daemons that were already registered when this one joined, for it to dial.
The coordinator is the only component every daemon already talks
to, which makes it the one place a daemon can learn where its peers
are without anyone configuring an address twice. Without this a
multi-machine deployment has to name every daemon’s endpoint on
every other daemon’s command line (--zenoh-connect), or rely on
multicast — which a mesh VPN does not carry.
Only endpoints a daemon verified as bound appear here (see the
info().locators() check in open_zenoh_session_with_listen), so a
dial planned from this list has a listener behind it.
Deliberately only the earlier daemons: zenoh reads
connect/endpoints once at session open and never re-reads it, so a
daemon cannot act on an endpoint that arrives later. It does not
need to — a zenoh transport is bidirectional, so the joining
daemon’s dial carries traffic in both directions. Each daemon
dialing everyone who came before it therefore builds the full
clique, with no daemon ever needing to learn about a later one.
Daemons may start simultaneously: each advertises its endpoint in
its own registration (see
crate::daemon_to_coordinator::DaemonRegisterRequest::zenoh_listen_endpoint),
and the coordinator handles registrations one at a time, so the one
that registers second always sees the first. That ordering is what
removes the need for a daemon to ever act on a later report —
which it could not do anyway, zenoh having no runtime equivalent of
connect/endpoints.
#[serde(default)] keeps a daemon built before this field existed
decodable: it sees no peers and falls back to the multicast/explicit
wiring it already had.
Err(String)
Implementations§
Source§impl RegisterResult
impl RegisterResult
Sourcepub fn ok(daemon_id: DaemonId, peer_zenoh_endpoints: Vec<String>) -> Self
pub fn ok(daemon_id: DaemonId, peer_zenoh_endpoints: Vec<String>) -> Self
A successful registration: the assigned id and the peers to dial.
Sourcepub fn to_result(self) -> Result<DaemonId>
pub fn to_result(self) -> Result<DaemonId>
The assigned id alone, for callers that do not wire zenoh.
Sourcepub fn into_parts(self) -> Result<(DaemonId, Vec<String>)>
pub fn into_parts(self) -> Result<(DaemonId, Vec<String>)>
The assigned id plus the peer endpoints to dial; see
RegisterResult::Ok::peer_zenoh_endpoints.