pub struct ConnectivityState {
pub is_offline: bool,
pub check_pending: bool,
pub poll_pending: bool,
pub consecutive_failures: u32,
pub consecutive_successes: u32,
pub required_failures_to_go_offline: u32,
pub required_successes_to_go_online: u32,
pub offline_poll_interval_ms: u64,
}Expand description
Tracks network connectivity status for offline detection.
This state is used to implement the freeze-and-resume workflow feature:
- When network connectivity is lost, the pipeline enters offline mode
- While offline, all budget-consuming operations are suspended
- When connectivity returns, the pipeline resumes from the frozen checkpoint
§State Transitions
[Online] --(probe failed)--> [Probe Failing] --(threshold reached)--> [Offline]
[Offline] --(probe succeeded)--> [Back Online] --(orchestrator resumes)--> [Online]§Debouncing
To prevent rapid offline/online thrashing on unstable connections:
- Must fail N consecutive probes before entering offline mode (default: 2)
- Must succeed 1 probe before exiting offline mode (default: 1)
Fields§
§is_offline: boolTrue when we have confirmed the pipeline is in offline mode (poll loop active).
check_pending: boolTrue when an InvocationFailed{Network} event was received and we need to verify connectivity before consuming retry budget.
poll_pending: boolTrue when offline is confirmed and we are in the poll-for-reconnect loop.
consecutive_failures: u32Consecutive failed probes (used for debounce threshold before entering offline mode).
consecutive_successes: u32Consecutive successful probes (used for debounce before exiting offline mode).
required_failures_to_go_offline: u32How many consecutive failures before entering offline mode (default: 2).
required_successes_to_go_online: u32How many consecutive successes before exiting offline mode (default: 1).
offline_poll_interval_ms: u64Milliseconds to wait between polls while offline (default: 5000).
Implementations§
Source§impl ConnectivityState
impl ConnectivityState
Sourcepub fn trigger_check(self) -> Self
pub fn trigger_check(self) -> Self
Mark that a connectivity check is needed (triggered by Network error).
Sourcepub fn clear_check_pending(self) -> Self
pub fn clear_check_pending(self) -> Self
Clear the check_pending flag.
Sourcepub fn on_probe_failed(self) -> Self
pub fn on_probe_failed(self) -> Self
Record a failed connectivity probe.
Returns a new state with updated counters. If the failure threshold is reached, transitions to offline mode.
Sourcepub fn on_probe_succeeded(self) -> Self
pub fn on_probe_succeeded(self) -> Self
Record a successful connectivity probe.
Returns a new state with updated counters. If the success threshold is reached while offline, transitions back to online mode.
Sourcepub fn reset_debounce(self) -> Self
pub fn reset_debounce(self) -> Self
Reset debounce counters without changing offline/online status.
Use when a transient state change should reset the debounce counters.
Sourcepub const fn is_offline_mode(&self) -> bool
pub const fn is_offline_mode(&self) -> bool
Returns true if we have entered offline mode (debounce threshold was met).
Sourcepub const fn is_check_pending(&self) -> bool
pub const fn is_check_pending(&self) -> bool
Returns true if a connectivity check is pending.
Sourcepub const fn is_poll_pending(&self) -> bool
pub const fn is_poll_pending(&self) -> bool
Returns true if we are actively polling for connectivity (offline mode).
Trait Implementations§
Source§impl Clone for ConnectivityState
impl Clone for ConnectivityState
Source§fn clone(&self) -> ConnectivityState
fn clone(&self) -> ConnectivityState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ConnectivityState
impl Debug for ConnectivityState
Source§impl Default for ConnectivityState
impl Default for ConnectivityState
Source§impl<'de> Deserialize<'de> for ConnectivityState
impl<'de> Deserialize<'de> for ConnectivityState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ConnectivityState
impl PartialEq for ConnectivityState
Source§impl Serialize for ConnectivityState
impl Serialize for ConnectivityState
impl StructuralPartialEq for ConnectivityState
Auto Trait Implementations§
impl Freeze for ConnectivityState
impl RefUnwindSafe for ConnectivityState
impl Send for ConnectivityState
impl Sync for ConnectivityState
impl Unpin for ConnectivityState
impl UnsafeUnpin for ConnectivityState
impl UnwindSafe for ConnectivityState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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