NeighborProbeStrategy

Trait NeighborProbeStrategy 

Source
pub trait NeighborProbeStrategy: Send + 'static {
    // Required methods
    fn on_tick(&mut self, now: Instant) -> Vec<ProbeRequest>;
    fn on_probe_success(&mut self, rtt: Duration);
    fn on_probe_timeout(&mut self);
    fn trigger(&mut self, event: TriggerEvent);
}
Expand description

Controls the when of hello/probe scheduling.

§Contract

  • [on_tick] is called at a regular interval set by DiscoveryConfig::hello_interval_base. It returns zero or more ProbeRequests to execute this tick.
  • [on_probe_success] is called when a probe response is received. The strategy may use this to reset its backoff interval or annotate quality measurements.
  • [on_probe_timeout] is called when a pending probe times out. The strategy advances its failure counter and may escalate the probe rate.
  • [trigger] is called for out-of-band topology events. The strategy may schedule an immediate probe on the next [on_tick] call.

All methods take &mut self; the protocol wraps the strategy in Mutex<Box<dyn NeighborProbeStrategy>> so it can be replaced at runtime.

Required Methods§

Source

fn on_tick(&mut self, now: Instant) -> Vec<ProbeRequest>

Advance the scheduler’s clock to now.

Returns the set of probes that should be sent this tick. An empty Vec means “nothing to do yet”; the protocol should call this again on the next tick interval.

Source

fn on_probe_success(&mut self, rtt: Duration)

A probe response was received with the given round-trip time.

Reset failure counters and back-off intervals. rtt may be used by adaptive schedulers to tune the next probe interval.

Source

fn on_probe_timeout(&mut self)

A probe timed out (no response within probe_timeout).

Advance failure counters; escalate probe rate if appropriate.

Source

fn trigger(&mut self, event: TriggerEvent)

An external topology event occurred.

The strategy should arrange for a probe to be scheduled (typically on the next [on_tick]) unless rate-limiting applies.

Implementors§