pub struct HealthMonitor { /* private fields */ }Expand description
Health monitor for tracking all peers in the network
Implementations§
Source§impl HealthMonitor
impl HealthMonitor
Sourcepub fn remove_peer(&mut self, peer_id: &PeerId)
pub fn remove_peer(&mut self, peer_id: &PeerId)
Remove a peer from tracking
Sourcepub fn record_ping_success(&mut self, peer_id: &PeerId, rtt: Duration)
pub fn record_ping_success(&mut self, peer_id: &PeerId, rtt: Duration)
Record a successful ping to a peer
Sourcepub fn record_ping_failure(&mut self, peer_id: &PeerId)
pub fn record_ping_failure(&mut self, peer_id: &PeerId)
Record a failed ping to a peer
Sourcepub fn record_transfer(&mut self, peer_id: &PeerId, sent: u64, received: u64)
pub fn record_transfer(&mut self, peer_id: &PeerId, sent: u64, received: u64)
Record data transfer with a peer
Sourcepub fn get_stats(&self, peer_id: &PeerId) -> Option<&PeerStats>
pub fn get_stats(&self, peer_id: &PeerId) -> Option<&PeerStats>
Get statistics for a specific peer
Sourcepub fn get_healthy_peers(&self) -> Vec<PeerId>
pub fn get_healthy_peers(&self) -> Vec<PeerId>
Get all healthy peers, sorted by health score
Sourcepub fn get_local_peers(&self) -> Vec<PeerId>
pub fn get_local_peers(&self) -> Vec<PeerId>
Get peers on local network, sorted by health
Sourcepub fn get_best_peer(&self) -> Option<PeerId>
pub fn get_best_peer(&self) -> Option<PeerId>
Get best peer for data transfer (prioritizes local + healthy)
Sourcepub fn get_all_stats(&self) -> Vec<&PeerStats>
pub fn get_all_stats(&self) -> Vec<&PeerStats>
Get all peers with their statistics
Sourcepub fn cleanup_offline_peers(&mut self)
pub fn cleanup_offline_peers(&mut self)
Remove offline peers
Sourcepub fn get_network_summary(&self) -> NetworkHealthSummary
pub fn get_network_summary(&self) -> NetworkHealthSummary
Get network health summary
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HealthMonitor
impl RefUnwindSafe for HealthMonitor
impl Send for HealthMonitor
impl Sync for HealthMonitor
impl Unpin for HealthMonitor
impl UnwindSafe for HealthMonitor
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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