pub struct BrokerSearch { /* private fields */ }alloc only.Expand description
One broker search, with no I/O: the backend’s sightings and the time go in; requeries and, once, the result come out.
The browse covers every broker type, so a broker of a type not accepted is
logged with reason=brokerTransportNotAccepted, and a broker wanted by
device id is found under an accepted transport when only another of its
transports carries the id. The result is set settle_ms after a usable
broker is first seen, so each broker’s every transport has been heard and
the one earliest in BrokerConfig::accepted is chosen; in
DiscoveryWithFallback with a URL, the configured broker becomes the
result fallback_after_ms after the start when no usable broker is
pending. While no usable broker is seen,
BrokerSearch::poll_requery asks for a requery 3 s, 6 s and 36 s after
the start, then every 30 s. Once set, the result never changes.
Implementations§
Source§impl BrokerSearch
impl BrokerSearch
Sourcepub fn new(now: Instant, cfg: BrokerConfig) -> Result<Self, BrokerConfigError>
pub fn new(now: Instant, cfg: BrokerConfig) -> Result<Self, BrokerConfigError>
A search starting at now. In ConfiguredOnly the result is the
configured broker at once.
Sourcepub fn mode(&self) -> BrokerMode
pub fn mode(&self) -> BrokerMode
The mode in effect.
Sourcepub fn browse_types(&self) -> &'static [BrokerType]
pub fn browse_types(&self) -> &'static [BrokerType]
The service types to browse: every broker type.
Sourcepub fn handle_timeout(&mut self, now: Instant)
pub fn handle_timeout(&mut self, now: Instant)
Advance to now: settle, fall back or schedule a requery when due.
Sourcepub fn poll_requery(&mut self) -> bool
pub fn poll_requery(&mut self) -> bool
True once per requery the search asks the backend for.
Sourcepub fn poll_timeout(&self) -> Option<Instant>
pub fn poll_timeout(&self) -> Option<Instant>
The next instant BrokerSearch::handle_timeout has work at.
Sourcepub fn result(&self) -> Option<&BrokerEndpoint>
pub fn result(&self) -> Option<&BrokerEndpoint>
The broker chosen, set once and then fixed.
Sourcepub fn candidates(&self) -> Vec<BrokerEndpoint>
pub fn candidates(&self) -> Vec<BrokerEndpoint>
The accepted brokers now seen, with wanted applied, ranked.