Struct snarkos_node_tcp::KnownPeers
source · pub struct KnownPeers(_);
Expand description
Contains statistics related to Tcp’s peers, currently connected or not.
Implementations§
source§impl KnownPeers
impl KnownPeers
sourcepub fn add(&self, addr: SocketAddr)
pub fn add(&self, addr: SocketAddr)
Adds an address to the list of known peers.
sourcepub fn get(&self, addr: SocketAddr) -> Option<Arc<Stats>>
pub fn get(&self, addr: SocketAddr) -> Option<Arc<Stats>>
Returns the stats for the given peer.
sourcepub fn remove(&self, addr: SocketAddr) -> Option<Arc<Stats>>
pub fn remove(&self, addr: SocketAddr) -> Option<Arc<Stats>>
Removes an address to the list of known peers.
sourcepub fn snapshot(&self) -> HashMap<SocketAddr, Arc<Stats>>
pub fn snapshot(&self) -> HashMap<SocketAddr, Arc<Stats>>
Returns the list of all known peers and their stats.
sourcepub fn register_sent_message(&self, to: SocketAddr, size: usize)
pub fn register_sent_message(&self, to: SocketAddr, size: usize)
Registers a submission of a message to the given address.
sourcepub fn register_received_message(&self, from: SocketAddr, size: usize)
pub fn register_received_message(&self, from: SocketAddr, size: usize)
Registers a receipt of a message to the given address.
sourcepub fn register_failure(&self, addr: SocketAddr)
pub fn register_failure(&self, addr: SocketAddr)
Registers a failure associated with the given address.
Trait Implementations§
source§impl Default for KnownPeers
impl Default for KnownPeers
source§fn default() -> KnownPeers
fn default() -> KnownPeers
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for KnownPeers
impl Send for KnownPeers
impl Sync for KnownPeers
impl Unpin for KnownPeers
impl UnwindSafe for KnownPeers
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