Trait sc_network::peer_store::PeerStoreProvider
source · pub trait PeerStoreProvider: Debug + Send + Sync {
// Required methods
fn is_banned(&self, peer_id: &PeerId) -> bool;
fn register_protocol(&self, protocol_handle: Arc<dyn ProtocolHandle>);
fn report_disconnect(&self, peer_id: PeerId);
fn report_peer(&self, peer_id: PeerId, change: ReputationChange);
fn set_peer_role(&self, peer_id: &PeerId, role: ObservedRole);
fn peer_reputation(&self, peer_id: &PeerId) -> i32;
fn peer_role(&self, peer_id: &PeerId) -> Option<ObservedRole>;
fn outgoing_candidates(
&self,
count: usize,
ignored: HashSet<PeerId>,
) -> Vec<PeerId>;
fn add_known_peer(&self, peer_id: PeerId);
}
Expand description
Trait providing peer reputation management and connection candidates.
Required Methods§
sourcefn register_protocol(&self, protocol_handle: Arc<dyn ProtocolHandle>)
fn register_protocol(&self, protocol_handle: Arc<dyn ProtocolHandle>)
Register a protocol handle to disconnect peers whose reputation drops below the threshold.
sourcefn report_disconnect(&self, peer_id: PeerId)
fn report_disconnect(&self, peer_id: PeerId)
Report peer disconnection for reputation adjustment.
sourcefn report_peer(&self, peer_id: PeerId, change: ReputationChange)
fn report_peer(&self, peer_id: PeerId, change: ReputationChange)
Adjust peer reputation.
sourcefn set_peer_role(&self, peer_id: &PeerId, role: ObservedRole)
fn set_peer_role(&self, peer_id: &PeerId, role: ObservedRole)
Set peer role.
sourcefn peer_reputation(&self, peer_id: &PeerId) -> i32
fn peer_reputation(&self, peer_id: &PeerId) -> i32
Get peer reputation.
sourcefn peer_role(&self, peer_id: &PeerId) -> Option<ObservedRole>
fn peer_role(&self, peer_id: &PeerId) -> Option<ObservedRole>
Get peer role, if available.
sourcefn outgoing_candidates(
&self,
count: usize,
ignored: HashSet<PeerId>,
) -> Vec<PeerId>
fn outgoing_candidates( &self, count: usize, ignored: HashSet<PeerId>, ) -> Vec<PeerId>
Get candidates with highest reputations for initiating outgoing connections.
sourcefn add_known_peer(&self, peer_id: PeerId)
fn add_known_peer(&self, peer_id: PeerId)
Add known peer.