pub struct HealthChecker { /* private fields */ }Expand description
In-memory health checker
Implementations§
Source§impl HealthChecker
impl HealthChecker
pub fn new(config: HealthConfig) -> Self
Sourcepub fn register_node(&self, node_id: NodeId)
pub fn register_node(&self, node_id: NodeId)
Register a node for health tracking
Sourcepub fn deregister_node(&self, node_id: &NodeId)
pub fn deregister_node(&self, node_id: &NodeId)
Remove a node from health tracking
Sourcepub fn report_success(&self, node_id: &NodeId, latency: Duration)
pub fn report_success(&self, node_id: &NodeId, latency: Duration)
Report a successful request (passive health update)
Sourcepub fn report_failure(&self, node_id: &NodeId)
pub fn report_failure(&self, node_id: &NodeId)
Report a failed request (passive health update)
Sourcepub fn all_statuses(&self) -> Vec<HealthStatus>
pub fn all_statuses(&self) -> Vec<HealthStatus>
Get all health statuses
Sourcepub fn is_monitoring(&self) -> bool
pub fn is_monitoring(&self) -> bool
Check if monitoring is active
Sourcepub fn healthy_count(&self) -> usize
pub fn healthy_count(&self) -> usize
Get count of healthy nodes
Sourcepub fn total_count(&self) -> usize
pub fn total_count(&self) -> usize
Get total node count
Trait Implementations§
Source§impl Default for HealthChecker
impl Default for HealthChecker
Source§impl HealthCheckerTrait for HealthChecker
impl HealthCheckerTrait for HealthChecker
Source§fn check_node(
&self,
node_id: &NodeId,
) -> BoxFuture<'_, FederationResult<NodeHealth>>
fn check_node( &self, node_id: &NodeId, ) -> BoxFuture<'_, FederationResult<NodeHealth>>
Check health of a specific node
Source§fn get_cached_health(&self, node_id: &NodeId) -> Option<NodeHealth>
fn get_cached_health(&self, node_id: &NodeId) -> Option<NodeHealth>
Get cached health status (non-blocking)
Source§fn start_monitoring(&self, _interval: Duration) -> BoxFuture<'_, ()>
fn start_monitoring(&self, _interval: Duration) -> BoxFuture<'_, ()>
Start background health monitoring
Source§fn stop_monitoring(&self) -> BoxFuture<'_, ()>
fn stop_monitoring(&self) -> BoxFuture<'_, ()>
Stop health monitoring
Auto Trait Implementations§
impl !Freeze for HealthChecker
impl RefUnwindSafe for HealthChecker
impl Send for HealthChecker
impl Sync for HealthChecker
impl Unpin for HealthChecker
impl UnwindSafe for HealthChecker
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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