Trait sc_network::peer_store::PeerStoreProvider
source · pub trait PeerStoreProvider: Debug + Send {
// Required methods
fn is_banned(&self, peer_id: &PeerId) -> bool;
fn register_protocol(&self, protocol_handle: ProtocolHandle);
fn report_disconnect(&mut self, peer_id: PeerId);
fn report_peer(&mut self, peer_id: PeerId, change: ReputationChange);
fn peer_reputation(&self, peer_id: &PeerId) -> i32;
fn outgoing_candidates(
&self,
count: usize,
ignored: HashSet<&PeerId>
) -> Vec<PeerId>;
}
Expand description
Trait providing peer reputation management and connection candidates.
Required Methods§
sourcefn register_protocol(&self, protocol_handle: ProtocolHandle)
fn register_protocol(&self, protocol_handle: ProtocolHandle)
Register a protocol handle to disconnect peers whose reputation drops below the threshold.
sourcefn report_disconnect(&mut self, peer_id: PeerId)
fn report_disconnect(&mut self, peer_id: PeerId)
Report peer disconnection for reputation adjustment.
sourcefn report_peer(&mut self, peer_id: PeerId, change: ReputationChange)
fn report_peer(&mut self, peer_id: PeerId, change: ReputationChange)
Adjust peer reputation.
sourcefn peer_reputation(&self, peer_id: &PeerId) -> i32
fn peer_reputation(&self, peer_id: &PeerId) -> i32
Get peer reputation.