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
sourceimpl 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
sourceimpl Clone for PeersetHandle
impl Clone for PeersetHandle
sourcefn clone(&self) -> PeersetHandle
fn clone(&self) -> PeersetHandle
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl !RefUnwindSafe for PeersetHandle
impl Send for PeersetHandle
impl Sync for PeersetHandle
impl Unpin for PeersetHandle
impl !UnwindSafe for PeersetHandle
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more