pub struct PingState { /* private fields */ }Expand description
Ping/health-check state for all hosts.
Implementations§
Source§impl PingState
impl PingState
pub fn status_map(&self) -> &HashMap<String, PingStatus>
pub fn status_map_mut(&mut self) -> &mut HashMap<String, PingStatus>
pub fn status_of(&self, alias: &str) -> Option<&PingStatus>
pub fn status_contains(&self, alias: &str) -> bool
pub fn status_len(&self) -> usize
pub fn status_is_empty(&self) -> bool
pub fn insert_status(&mut self, alias: String, status: PingStatus)
pub fn remove_status(&mut self, alias: &str)
pub fn last_checked(&self) -> &HashMap<String, Instant>
pub fn last_checked_at(&self, alias: &str) -> Option<&Instant>
pub fn record_check(&mut self, alias: String, at: Instant)
pub fn has_pinged(&self) -> bool
pub fn set_has_pinged(&mut self, value: bool)
pub fn generation(&self) -> u64
pub fn set_generation(&mut self, value: u64)
pub fn slow_threshold_ms(&self) -> u16
pub fn set_slow_threshold_ms(&mut self, value: u16)
pub fn auto_ping(&self) -> bool
pub fn set_auto_ping(&mut self, value: bool)
pub fn filter_down_only(&self) -> bool
pub fn set_filter_down_only(&mut self, value: bool)
pub fn checked_at(&self) -> Option<Instant>
pub fn set_checked_at(&mut self, value: Option<Instant>)
Sourcepub fn from_preferences(paths: Option<&Paths>) -> Self
pub fn from_preferences(paths: Option<&Paths>) -> Self
Construct with slow threshold + auto-ping loaded from preferences.
Sourcepub fn clear_results(&mut self)
pub fn clear_results(&mut self)
Clear all ping results and reset the dynamic filter/timestamp state.
Preserves config (slow_threshold_ms, auto_ping) and has_pinged.
Bumps generation so in-flight ping responses can be discarded.
Sourcepub fn is_stale(&self, alias: &str) -> bool
pub fn is_stale(&self, alias: &str) -> bool
True when no ping result exists for alias, or the result is older
than STALE_REFRESH_AFTER. Used to decide whether selecting a host
should trigger a background refresh.
Sourcepub fn prune_orphans(&mut self, valid_aliases: &HashSet<&str>)
pub fn prune_orphans(&mut self, valid_aliases: &HashSet<&str>)
Drop status and last_checked entries whose alias is no longer
in valid_aliases. Called from App::reload_hosts after the new
host list lands so stale ping entries cannot outlive their host.
Sourcepub fn migrate_alias(&mut self, old: &str, new: &str)
pub fn migrate_alias(&mut self, old: &str, new: &str)
Move status and last_checked entries from old to new.
Called from App::migrate_alias_keyed_caches before
reload_hosts, whose prune step would otherwise drop entries
still under the old alias. No-op when old == new.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PingState
impl RefUnwindSafe for PingState
impl Send for PingState
impl Sync for PingState
impl Unpin for PingState
impl UnsafeUnpin for PingState
impl UnwindSafe for PingState
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> 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