pub struct AdverseDetector { /* private fields */ }Expand description
The behavioral adverse detector: a deterministic sliding-window state
machine over recent transfer outcomes.
No OS reports adverse — the networks that need it most look “connected” to
every OS API — so it is derived: ≥ promote_at reset/stall/black-hole
outcomes within the last window transfers promote the link to adverse
(which bounds fetch windows and pins staged uploads to the index tier), and a
run of demote_after_clean clean transfers demotes it back. Being event-
driven rather than clock-driven, it is fully deterministic under test.
Implementations§
Source§impl AdverseDetector
impl AdverseDetector
Sourcepub fn new(thresholds: AdverseThresholds) -> Self
pub fn new(thresholds: AdverseThresholds) -> Self
A fresh detector with the given thresholds, starting non-adverse.
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
A detector with the default thresholds.
Sourcepub fn record(&mut self, signal: TransferSignal)
pub fn record(&mut self, signal: TransferSignal)
Fold one transfer outcome into the window and recompute the state.
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Forget every outcome observed so far and return to non-adverse: the link they were
observed on is gone (path::PathMonitor::observe calls this on a new path).
Sourcepub fn is_adverse(&self) -> bool
pub fn is_adverse(&self) -> bool
Whether the link is currently promoted to adverse.
Sourcepub fn classify(&self, base: ConnectionClass) -> ConnectionClass
pub fn classify(&self, base: ConnectionClass) -> ConnectionClass
The effective class: offline is never overridden; any other base class is
promoted to ConnectionClass::Adverse while the detector is tripped.
Trait Implementations§
Source§impl Clone for AdverseDetector
impl Clone for AdverseDetector
Source§fn clone(&self) -> AdverseDetector
fn clone(&self) -> AdverseDetector
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for AdverseDetector
impl RefUnwindSafe for AdverseDetector
impl Send for AdverseDetector
impl Sync for AdverseDetector
impl Unpin for AdverseDetector
impl UnsafeUnpin for AdverseDetector
impl UnwindSafe for AdverseDetector
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
Arc<> Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more