pub struct PathMonitor { /* private fields */ }Expand description
The current path, the link behaviour observed on it, and the plan they make, shared by everything that transfers.
Platform shells call observe with each sample, transfers report their
outcomes through record, and a long transfer subscribes
to learn — within the tick the change lands — that the plan it runs under has changed.
A background deadline is aged on the monitor’s MonotonicClock: every plan read through
plan, subscribe, plan_with or
snapshot sees the time left now, not the time left when the app last
reported, so a push started late in a background task holds bulk back without a new report.
Implementations§
Source§impl PathMonitor
impl PathMonitor
Sourcepub fn new(sample: PathSample, bounds: LaneWindows) -> Self
pub fn new(sample: PathSample, bounds: LaneWindows) -> Self
A monitor whose first path is sample, generation 1, with the default adverse
thresholds and bounds as the compiled windows.
Sourcepub fn with_thresholds(
sample: PathSample,
bounds: LaneWindows,
thresholds: AdverseThresholds,
) -> Self
pub fn with_thresholds( sample: PathSample, bounds: LaneWindows, thresholds: AdverseThresholds, ) -> Self
new, with the detector’s thresholds.
Sourcepub fn with_clock(
self,
clock: impl MonotonicClock + Send + Sync + 'static,
) -> Self
pub fn with_clock( self, clock: impl MonotonicClock + Send + Sync + 'static, ) -> Self
Age background deadlines on clock instead of the process’s monotonic clock. The
current sample counts as reported now, on clock.
Sourcepub fn snapshot(&self) -> PathSnapshot
pub fn snapshot(&self) -> PathSnapshot
The latest snapshot, its background deadline aged to now.
Sourcepub fn plan(&self) -> TransferPlan
pub fn plan(&self) -> TransferPlan
The current plan, without advice: re-made at now, so an aged background deadline holds bulk back, and published to subscribers when that changed it.
Sourcepub fn plan_with(&self, advice: HeldAdvice) -> TransferPlan
pub fn plan_with(&self, advice: HeldAdvice) -> TransferPlan
The current plan with advice applied to its windows and chunk size.
Sourcepub fn subscribe(&self) -> Receiver<TransferPlan>
pub fn subscribe(&self) -> Receiver<TransferPlan>
A receiver that wakes each time the plan changes, holding the plan as of now.
Sourcepub fn observe(&self, sample: PathSample) -> PathUpdate
pub fn observe(&self, sample: PathSample) -> PathUpdate
Take a new sample. A change of reachability, interface or cost advances the generation and resets the adverse detector; the plan is remade either way and published when it changed.
Sourcepub fn record(&self, signal: TransferSignal) -> TransferPlan
pub fn record(&self, signal: TransferSignal) -> TransferPlan
Fold one transfer outcome into the adverse detector, and return the plan after it.
Sourcepub fn record_on(
&self,
generation: PathGeneration,
signal: TransferSignal,
) -> Option<TransferPlan>
pub fn record_on( &self, generation: PathGeneration, signal: TransferSignal, ) -> Option<TransferPlan>
record an outcome observed on the path of generation, only while
that is still the current path: a transfer that began on a path since replaced says
nothing about the new one, whose detector has just been reset. None when it was
dropped.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for PathMonitor
impl !RefUnwindSafe for PathMonitor
impl !UnwindSafe for PathMonitor
impl Send for PathMonitor
impl Sync for PathMonitor
impl Unpin for PathMonitor
impl UnsafeUnpin for PathMonitor
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
§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