Struct ckb_network::peer_registry::PeerRegistry
source · pub struct PeerRegistry { /* private fields */ }
Expand description
Memory records of opened session information
Implementations§
source§impl PeerRegistry
impl PeerRegistry
sourcepub fn new(
max_inbound: u32,
max_outbound: u32,
whitelist_only: bool,
whitelist_peers: Vec<Multiaddr>
) -> Self
pub fn new( max_inbound: u32, max_outbound: u32, whitelist_only: bool, whitelist_peers: Vec<Multiaddr> ) -> Self
Init registry from config
sourcepub fn add_feeler(&mut self, addr: &Multiaddr)
pub fn add_feeler(&mut self, addr: &Multiaddr)
Add feeler dail task
sourcepub fn remove_feeler(&mut self, addr: &Multiaddr)
pub fn remove_feeler(&mut self, addr: &Multiaddr)
Remove feeler dail task on session disconnects or fails
sourcepub fn get_peer_mut(&mut self, session_id: SessionId) -> Option<&mut Peer>
pub fn get_peer_mut(&mut self, session_id: SessionId) -> Option<&mut Peer>
Get mut peer info
sourcepub fn get_key_by_peer_id(&self, peer_id: &PeerId) -> Option<SessionId>
pub fn get_key_by_peer_id(&self, peer_id: &PeerId) -> Option<SessionId>
Get session id by peer id
sourcepub fn connected_peers(&self) -> Vec<SessionId>
pub fn connected_peers(&self) -> Vec<SessionId>
Get all sessions’ id
Auto Trait Implementations§
impl Freeze for PeerRegistry
impl RefUnwindSafe for PeerRegistry
impl Send for PeerRegistry
impl Sync for PeerRegistry
impl Unpin for PeerRegistry
impl UnwindSafe for PeerRegistry
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
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