pub struct NodeDirectory { /* private fields */ }Expand description
Maps NodeIds to peer connection information.
The NodeDirectory is the runtime’s view of the cluster topology. It tracks which nodes are known, their connection status, and optional endpoint addresses.
Implementations§
Source§impl NodeDirectory
impl NodeDirectory
Sourcepub fn set_status(&mut self, node_id: &NodeId, status: PeerStatus)
pub fn set_status(&mut self, node_id: &NodeId, status: PeerStatus)
Update the status of a peer.
Sourcepub fn remove_peer(&mut self, node_id: &NodeId)
pub fn remove_peer(&mut self, node_id: &NodeId)
Remove a peer from the directory.
Sourcepub fn peer_nodes(&self) -> Vec<NodeId>
pub fn peer_nodes(&self) -> Vec<NodeId>
Get all known peer node IDs.
Sourcepub fn peers_with_status(&self, status: PeerStatus) -> Vec<&PeerInfo>
pub fn peers_with_status(&self, status: PeerStatus) -> Vec<&PeerInfo>
Get all peers with a specific status.
Sourcepub fn peer_count(&self) -> usize
pub fn peer_count(&self) -> usize
Number of known peers.
Sourcepub fn connected_count(&self) -> usize
pub fn connected_count(&self) -> usize
Number of connected peers.
Sourcepub fn is_connected(&self, node_id: &NodeId) -> bool
pub fn is_connected(&self, node_id: &NodeId) -> bool
Check if a node is known and connected.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NodeDirectory
impl RefUnwindSafe for NodeDirectory
impl Send for NodeDirectory
impl Sync for NodeDirectory
impl Unpin for NodeDirectory
impl UnsafeUnpin for NodeDirectory
impl UnwindSafe for NodeDirectory
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