pub struct PeerManager { /* private fields */ }Expand description
Manager for all peer connections.
Implementations§
Source§impl PeerManager
impl PeerManager
Sourcepub fn new(retry_config: RetryConfig) -> Self
pub fn new(retry_config: RetryConfig) -> Self
Create a new peer manager.
Sourcepub fn add_peer(&self, config: PeerConfig)
pub fn add_peer(&self, config: PeerConfig)
Add a peer from configuration.
Sourcepub fn get(&self, node_id: &str) -> Option<Arc<PeerConnection>>
pub fn get(&self, node_id: &str) -> Option<Arc<PeerConnection>>
Get a peer connection by node ID.
Sourcepub fn all(&self) -> Vec<Arc<PeerConnection>>
pub fn all(&self) -> Vec<Arc<PeerConnection>>
Get all peer connections.
Sourcepub fn remove_peer(&self, node_id: &str)
pub fn remove_peer(&self, node_id: &str)
Remove a peer.
Sourcepub fn shutdown_all(&self)
pub fn shutdown_all(&self)
Shutdown all peers.
Sourcepub async fn connected_count(&self) -> usize
pub async fn connected_count(&self) -> usize
Get count of connected peers.
Auto Trait Implementations§
impl Freeze for PeerManager
impl !RefUnwindSafe for PeerManager
impl Send for PeerManager
impl Sync for PeerManager
impl Unpin for PeerManager
impl !UnwindSafe for PeerManager
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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