pub struct PeerScore {
pub topic_scores: HashMap<TopicId, f64>,
pub total_score: f64,
pub invalid_messages: u64,
pub valid_messages: u64,
pub last_update: Option<Instant>,
}Expand description
Peer score for mesh quality
Fields§
§topic_scores: HashMap<TopicId, f64>Topic-specific scores
total_score: f64Overall score
invalid_messages: u64Number of invalid messages
valid_messages: u64Number of valid messages
last_update: Option<Instant>Last update time
Implementations§
Source§impl PeerScore
impl PeerScore
Sourcepub fn calculate_total(&mut self)
pub fn calculate_total(&mut self)
Calculate overall score
Sourcepub fn update_topic_score(&mut self, topic: TopicId, score: f64)
pub fn update_topic_score(&mut self, topic: TopicId, score: f64)
Update topic score
Sourcepub fn record_message(&mut self, valid: bool)
pub fn record_message(&mut self, valid: bool)
Record message validation result
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PeerScore
impl RefUnwindSafe for PeerScore
impl Send for PeerScore
impl Sync for PeerScore
impl Unpin for PeerScore
impl UnwindSafe for PeerScore
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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