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 byDiscoveryConfig::hello_interval_base. It returns zero or moreProbeRequests 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§
Sourcefn on_tick(&mut self, now: Instant) -> Vec<ProbeRequest>
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.
Sourcefn on_probe_success(&mut self, rtt: Duration)
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.
Sourcefn on_probe_timeout(&mut self)
fn on_probe_timeout(&mut self)
A probe timed out (no response within probe_timeout).
Advance failure counters; escalate probe rate if appropriate.
Sourcefn trigger(&mut self, event: TriggerEvent)
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.