Skip to main content

RegisterResult

Enum RegisterResult 

Source
#[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 enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

#[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
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§daemon_id: DaemonId

unique ID assigned by the coordinator

§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

Source

pub fn ok(daemon_id: DaemonId, peer_zenoh_endpoints: Vec<String>) -> Self

A successful registration: the assigned id and the peers to dial.

Source

pub fn to_result(self) -> Result<DaemonId>

The assigned id alone, for callers that do not wire zenoh.

Source

pub fn into_parts(self) -> Result<(DaemonId, Vec<String>)>

The assigned id plus the peer endpoints to dial; see RegisterResult::Ok::peer_zenoh_endpoints.

Trait Implementations§

Source§

impl Debug for RegisterResult

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for RegisterResult

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for RegisterResult

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V