pub enum PeerReputationEvent {
BlockDelivered {
latency_ms: u64,
},
BlockFailed,
InvalidBlock,
DhtResponseValid {
latency_ms: u64,
},
DhtResponseEmpty,
ConnectionFailed,
ProtocolViolation,
}Expand description
An event that affects a peer’s reputation score.
Variants§
BlockDelivered
Peer successfully delivered a block.
BlockFailed
Peer failed to deliver a requested block.
InvalidBlock
Peer sent a block whose CID or content did not match what was requested.
DhtResponseValid
Peer returned a valid DHT response.
DhtResponseEmpty
Peer’s DHT query returned no results.
ConnectionFailed
Connection to the peer failed.
ProtocolViolation
Peer violated the protocol (severe).
Implementations§
Source§impl PeerReputationEvent
impl PeerReputationEvent
Sourcepub fn score_delta(&self) -> f64
pub fn score_delta(&self) -> f64
Returns the signed score delta this event contributes.
Deltas:
BlockDelivered: +1.0, +0.5 bonus whenlatency_ms < 100BlockFailed: -1.0InvalidBlock: -10.0DhtResponseValid: +0.5, +0.25 bonus whenlatency_ms < 200DhtResponseEmpty: -0.25ConnectionFailed: -2.0ProtocolViolation: -15.0
Trait Implementations§
Source§impl Clone for PeerReputationEvent
impl Clone for PeerReputationEvent
Source§fn clone(&self) -> PeerReputationEvent
fn clone(&self) -> PeerReputationEvent
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 moreimpl Copy for PeerReputationEvent
Source§impl Debug for PeerReputationEvent
impl Debug for PeerReputationEvent
Source§impl PartialEq for PeerReputationEvent
impl PartialEq for PeerReputationEvent
Source§fn eq(&self, other: &PeerReputationEvent) -> bool
fn eq(&self, other: &PeerReputationEvent) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for PeerReputationEvent
Auto Trait Implementations§
impl Freeze for PeerReputationEvent
impl RefUnwindSafe for PeerReputationEvent
impl Send for PeerReputationEvent
impl Sync for PeerReputationEvent
impl Unpin for PeerReputationEvent
impl UnsafeUnpin for PeerReputationEvent
impl UnwindSafe for PeerReputationEvent
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