pub struct QosRegistry { /* private fields */ }Expand description
In-memory map of peer_id → PeerQos for the local node.
Held inside DaemonState under a RwLock:
pub qos: RwLock<QosRegistry>,Implementations§
Source§impl QosRegistry
impl QosRegistry
pub fn new() -> Self
Sourcepub fn entry(&mut self, peer_id: impl Into<String>) -> &mut PeerQos
pub fn entry(&mut self, peer_id: impl Into<String>) -> &mut PeerQos
Return (or lazily create) the QoS record for peer_id.
Sourcepub fn get(&self, peer_id: &str) -> Option<&PeerQos>
pub fn get(&self, peer_id: &str) -> Option<&PeerQos>
Read-only view of a peer’s QoS; returns None if never seen.
Sourcepub fn stability_score(&self, peer_id: &str) -> f64
pub fn stability_score(&self, peer_id: &str) -> f64
Stability score for peer_id. Returns 0.0 if never seen.
Sourcepub fn all_stability_scores(&self) -> Vec<f64>
pub fn all_stability_scores(&self) -> Vec<f64>
Snapshot of all stability scores as a Vec<f64> (order not defined).
This is the primary input to crate::coding::params::compute_coding_params.
Sourcepub fn stability_scores_for<'a>(
&self,
pouch_peer_ids: impl Iterator<Item = &'a str>,
) -> Vec<f64>
pub fn stability_scores_for<'a>( &self, pouch_peer_ids: impl Iterator<Item = &'a str>, ) -> Vec<f64>
Stability scores only for Pouch peers whose peer_id appears in
pouch_peer_ids — used to scope the k-calculation to active Pouches
in a specific network, rather than all connected peers.
Sourcepub fn peer_count(&self) -> usize
pub fn peer_count(&self) -> usize
Total number of tracked peers.
Sourcepub fn fault_status(&self, peer_id: &str) -> &'static str
pub fn fault_status(&self, peer_id: &str) -> &'static str
Fault status of a peer: "ok", "degraded", "suspected", or
"blacklisted". Returns "ok" if the peer has never been seen.
Sourcepub fn fault_score(&self, peer_id: &str) -> u8
pub fn fault_score(&self, peer_id: &str) -> u8
Fault score of a peer in [0, 100]. Returns 0 if never seen.
Trait Implementations§
Source§impl Debug for QosRegistry
impl Debug for QosRegistry
Source§impl Default for QosRegistry
impl Default for QosRegistry
Source§fn default() -> QosRegistry
fn default() -> QosRegistry
Auto Trait Implementations§
impl Freeze for QosRegistry
impl RefUnwindSafe for QosRegistry
impl Send for QosRegistry
impl Sync for QosRegistry
impl Unpin for QosRegistry
impl UnwindSafe for QosRegistry
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
§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>
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