pub struct PeerStatus {
pub id: (OffchainPublicKey, PeerId),
pub origin: PeerOrigin,
pub last_seen: SystemTime,
pub last_seen_latency: Duration,
pub heartbeats_sent: u64,
pub heartbeats_succeeded: u64,
pub backoff: f64,
pub ignored_until: Option<SystemTime>,
pub multiaddresses: Vec<Multiaddr>,
pub quality: f64,
pub quality_avg: SingleSumSMA<f64>,
}
Expand description
Status of the peer as recorded by a network component.
Fields§
§id: (OffchainPublicKey, PeerId)
§origin: PeerOrigin
§last_seen: SystemTime
§last_seen_latency: Duration
§heartbeats_sent: u64
§heartbeats_succeeded: u64
§backoff: f64
§ignored_until: Option<SystemTime>
Until when the peer should be ignored.
multiaddresses: Vec<Multiaddr>
§quality: f64
§quality_avg: SingleSumSMA<f64>
Implementations§
Source§impl PeerStatus
impl PeerStatus
pub fn new( id: PeerId, origin: PeerOrigin, backoff: f64, quality_window: u32, ) -> PeerStatus
pub fn update_quality(&mut self, new_value: f64)
Sourcepub fn get_average_quality(&self) -> f64
pub fn get_average_quality(&self) -> f64
Gets the average quality of this peer
Sourcepub fn get_quality(&self) -> f64
pub fn get_quality(&self) -> f64
Gets the immediate node quality
Sourcepub fn is_ignored(&self) -> bool
pub fn is_ignored(&self) -> bool
Determines whether the peer is ignored due to quality concerns, given the current time.
Trait Implementations§
Source§impl Clone for PeerStatus
impl Clone for PeerStatus
Source§fn clone(&self) -> PeerStatus
fn clone(&self) -> PeerStatus
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for PeerStatus
impl Debug for PeerStatus
Source§impl Display for PeerStatus
impl Display for PeerStatus
Source§impl PartialEq for PeerStatus
impl PartialEq for PeerStatus
impl StructuralPartialEq for PeerStatus
Auto Trait Implementations§
impl Freeze for PeerStatus
impl RefUnwindSafe for PeerStatus
impl Send for PeerStatus
impl Sync for PeerStatus
impl Unpin for PeerStatus
impl UnwindSafe for PeerStatus
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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>
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.