pub struct NodeInfo {
pub id: NodeId,
pub address: String,
pub port: u16,
pub status: NodeStatus,
pub role: NodeRole,
pub joined_at: u64,
pub last_heartbeat: u64,
pub metadata: NodeMetadata,
}Expand description
Information about a node in the cluster.
Fields§
§id: NodeId§address: String§port: u16§status: NodeStatus§role: NodeRole§joined_at: u64§last_heartbeat: u64§metadata: NodeMetadataImplementations§
Source§impl NodeInfo
impl NodeInfo
Sourcepub fn new(id: impl Into<NodeId>, address: impl Into<String>, port: u16) -> Self
pub fn new(id: impl Into<NodeId>, address: impl Into<String>, port: u16) -> Self
Create a new node info.
Sourcepub fn socket_addr(&self) -> Option<SocketAddr>
pub fn socket_addr(&self) -> Option<SocketAddr>
Get the socket address.
Sourcepub fn mark_healthy(&mut self)
pub fn mark_healthy(&mut self)
Mark the node as healthy.
Sourcepub fn mark_suspect(&mut self)
pub fn mark_suspect(&mut self)
Mark the node as suspect.
Sourcepub fn is_available(&self) -> bool
pub fn is_available(&self) -> bool
Check if the node is available for requests.
Sourcepub fn heartbeat_age(&self) -> u64
pub fn heartbeat_age(&self) -> u64
Time since last heartbeat in milliseconds.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for NodeInfo
impl<'de> Deserialize<'de> for NodeInfo
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for NodeInfo
impl RefUnwindSafe for NodeInfo
impl Send for NodeInfo
impl Sync for NodeInfo
impl Unpin for NodeInfo
impl UnsafeUnpin for NodeInfo
impl UnwindSafe for NodeInfo
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