Struct sc_peerset::PeersetHandle
source · pub struct PeersetHandle { /* private fields */ }
Expand description
Shared handle to the peer set manager (PSM). Distributed around the code.
Implementations§
source§impl PeersetHandle
impl PeersetHandle
sourcepub fn add_reserved_peer(&self, set_id: SetId, peer_id: PeerId)
pub fn add_reserved_peer(&self, set_id: SetId, peer_id: PeerId)
Adds a new reserved peer. The peerset will make an effort to always remain connected to this peer.
Has no effect if the node was already a reserved peer.
Note: Keep in mind that the networking has to know an address for this node, otherwise it will not be able to connect to it.
sourcepub fn remove_reserved_peer(&self, set_id: SetId, peer_id: PeerId)
pub fn remove_reserved_peer(&self, set_id: SetId, peer_id: PeerId)
Remove a previously-added reserved peer.
Has no effect if the node was not a reserved peer.
sourcepub fn set_reserved_only(&self, set_id: SetId, reserved: bool)
pub fn set_reserved_only(&self, set_id: SetId, reserved: bool)
Sets whether or not the peerset only has connections with nodes marked as reserved for the given set.
sourcepub fn set_reserved_peers(&self, set_id: SetId, peer_ids: HashSet<PeerId>)
pub fn set_reserved_peers(&self, set_id: SetId, peer_ids: HashSet<PeerId>)
Set reserved peers to the new set.
sourcepub fn report_peer(&self, peer_id: PeerId, score_diff: ReputationChange)
pub fn report_peer(&self, peer_id: PeerId, score_diff: ReputationChange)
Reports an adjustment to the reputation of the given peer.
sourcepub fn add_to_peers_set(&self, set_id: SetId, peer_id: PeerId)
pub fn add_to_peers_set(&self, set_id: SetId, peer_id: PeerId)
Add a peer to a set.
sourcepub fn remove_from_peers_set(&self, set_id: SetId, peer_id: PeerId)
pub fn remove_from_peers_set(&self, set_id: SetId, peer_id: PeerId)
Remove a peer from a set.
Trait Implementations§
source§impl Clone for PeersetHandle
impl Clone for PeersetHandle
source§fn clone(&self) -> PeersetHandle
fn clone(&self) -> PeersetHandle
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for PeersetHandle
impl Send for PeersetHandle
impl Sync for PeersetHandle
impl Unpin for PeersetHandle
impl !UnwindSafe for PeersetHandle
Blanket Implementations§
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