pub struct TopicScore {
pub first_message_deliveries: f64,
pub mesh_message_deliveries: f64,
pub mesh_failure_penalty: f64,
pub invalid_message_deliveries: f64,
pub in_mesh: bool,
pub mesh_time_secs: f64,
}Expand description
Per-peer, per-topic scoring data.
Fields§
§first_message_deliveries: f64Increases when the peer is first to deliver a message on this topic.
mesh_message_deliveries: f64Deliveries counted while the peer is in the mesh for this topic.
mesh_failure_penalty: f64Penalty accumulated when a peer was in the mesh but had poor delivery.
invalid_message_deliveries: f64Counts of invalid messages; penalises the composite score heavily.
in_mesh: boolWhether this peer is currently in the mesh for this topic.
mesh_time_secs: f64Seconds the peer has been in the mesh for this topic.
Implementations§
Source§impl TopicScore
impl TopicScore
Sourcepub fn score(&self, p: &ScoreParameter) -> f64
pub fn score(&self, p: &ScoreParameter) -> f64
Compute the weighted topic score.
Formula:
- P1: first-message-delivery bonus (capped implicitly by values)
- P2: mesh-message-delivery bonus
- P3: mesh-failure penalty (negative)
- P4: invalid-message penalty (negative, weight ×10)
The result is scaled by p.topic_weight.
Trait Implementations§
Source§impl Clone for TopicScore
impl Clone for TopicScore
Source§fn clone(&self) -> TopicScore
fn clone(&self) -> TopicScore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 TopicScore
impl Debug for TopicScore
Source§impl Default for TopicScore
impl Default for TopicScore
Source§fn default() -> TopicScore
fn default() -> TopicScore
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TopicScore
impl RefUnwindSafe for TopicScore
impl Send for TopicScore
impl Sync for TopicScore
impl Unpin for TopicScore
impl UnsafeUnpin for TopicScore
impl UnwindSafe for TopicScore
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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