pub struct NodeRegistry { /* private fields */ }
Expand description
Node registry for tracking cluster members
Implementations§
Source§impl NodeRegistry
impl NodeRegistry
Sourcepub fn register_node(&mut self, nodeinfo: NodeInfo) -> CoreResult<bool>
pub fn register_node(&mut self, nodeinfo: NodeInfo) -> CoreResult<bool>
Register a new node in the cluster Returns true if the node is new, false if it was already registered
Sourcepub fn get_all_nodes(&self) -> Vec<NodeInfo>
pub fn get_all_nodes(&self) -> Vec<NodeInfo>
Get all registered nodes
Sourcepub fn get_healthy_nodes(&self) -> Vec<NodeInfo>
pub fn get_healthy_nodes(&self) -> Vec<NodeInfo>
Get only healthy nodes
Sourcepub fn get_nodes_by_status(&self, status: NodeStatus) -> Vec<NodeInfo>
pub fn get_nodes_by_status(&self, status: NodeStatus) -> Vec<NodeInfo>
Get nodes with a specific status
Sourcepub fn get_node_status(&self, nodeid: &str) -> Option<NodeStatus>
pub fn get_node_status(&self, nodeid: &str) -> Option<NodeStatus>
Get the status of a specific node
Sourcepub fn update_node_status(
&mut self,
nodeid: &str,
status: NodeStatus,
) -> CoreResult<()>
pub fn update_node_status( &mut self, nodeid: &str, status: NodeStatus, ) -> CoreResult<()>
Update the status of a specific node
Sourcepub fn remove_node(&mut self, nodeid: &str) -> Option<NodeInfo>
pub fn remove_node(&mut self, nodeid: &str) -> Option<NodeInfo>
Remove a node from the registry
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Get the total number of registered nodes
Sourcepub fn healthy_node_count(&self) -> usize
pub fn healthy_node_count(&self) -> usize
Get the number of healthy nodes
Sourcepub fn contains_node(&self, nodeid: &str) -> bool
pub fn contains_node(&self, nodeid: &str) -> bool
Check if a node is registered
Sourcepub fn get_stale_nodes(&self, max_age: Duration) -> Vec<NodeInfo>
pub fn get_stale_nodes(&self, max_age: Duration) -> Vec<NodeInfo>
Get nodes that haven’t been seen recently
Sourcepub fn update_node_last_seen(&mut self, nodeid: &str)
pub fn update_node_last_seen(&mut self, nodeid: &str)
Update a node’s last seen timestamp
Trait Implementations§
Source§impl Debug for NodeRegistry
impl Debug for NodeRegistry
Auto Trait Implementations§
impl Freeze for NodeRegistry
impl RefUnwindSafe for NodeRegistry
impl Send for NodeRegistry
impl Sync for NodeRegistry
impl Unpin for NodeRegistry
impl UnwindSafe for NodeRegistry
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