pub struct PeerRegistry { /* private fields */ }Expand description
A registry of peers in the distributed fabric
Implementations§
Source§impl PeerRegistry
impl PeerRegistry
Sourcepub fn register(&self, advertisement: PeerAdvertisement) -> Result<(), String>
pub fn register(&self, advertisement: PeerAdvertisement) -> Result<(), String>
Register a peer with its advertisement
Sourcepub fn unregister(
&self,
peer_id: &PeerId,
) -> Result<Option<PeerAdvertisement>, String>
pub fn unregister( &self, peer_id: &PeerId, ) -> Result<Option<PeerAdvertisement>, String>
Unregister a peer
Sourcepub fn get(&self, peer_id: &PeerId) -> Result<Option<PeerAdvertisement>, String>
pub fn get(&self, peer_id: &PeerId) -> Result<Option<PeerAdvertisement>, String>
Get a peer’s advertisement
Sourcepub fn peers_for_namespace(
&self,
namespace: &str,
) -> Result<Vec<PeerAdvertisement>, String>
pub fn peers_for_namespace( &self, namespace: &str, ) -> Result<Vec<PeerAdvertisement>, String>
Find all peers that provide a specific namespace
Sourcepub fn peers_for_capability(
&self,
capability: &str,
) -> Result<Vec<PeerAdvertisement>, String>
pub fn peers_for_capability( &self, capability: &str, ) -> Result<Vec<PeerAdvertisement>, String>
Find all peers that provide a specific capability
Sourcepub fn peer_count(&self) -> Result<usize, String>
pub fn peer_count(&self) -> Result<usize, String>
Get the count of registered peers
Trait Implementations§
Source§impl Clone for PeerRegistry
impl Clone for PeerRegistry
Auto Trait Implementations§
impl Freeze for PeerRegistry
impl RefUnwindSafe for PeerRegistry
impl Send for PeerRegistry
impl Sync for PeerRegistry
impl Unpin for PeerRegistry
impl UnsafeUnpin 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