pub struct NodeState {
pub node_id: Uuid,
pub node_info: NodeInfo,
pub available_nodes: HashMap<Uuid, NodeInfo>,
pub main_node_id: Option<Uuid>,
pub current_status: NodeStatus,
pub cluster_id: Option<Uuid>,
}
Fields§
§node_id: Uuid
§node_info: NodeInfo
§available_nodes: HashMap<Uuid, NodeInfo>
§main_node_id: Option<Uuid>
§current_status: NodeStatus
§cluster_id: Option<Uuid>
Implementations§
Source§impl NodeState
impl NodeState
Sourcepub fn is_follower(&self) -> bool
pub fn is_follower(&self) -> bool
Check if the current node is a follower
Sourcepub fn get_node_addr(&self, node_id: Uuid) -> Result<SocketAddr, String>
pub fn get_node_addr(&self, node_id: Uuid) -> Result<SocketAddr, String>
Get the addr from the available node
Sourcepub fn get_leader_data(&self) -> Option<(Uuid, &NodeInfo)>
pub fn get_leader_data(&self) -> Option<(Uuid, &NodeInfo)>
Get leader_data Returns leader id and leader_info if any
Trait Implementations§
Source§impl<'de> Deserialize<'de> for NodeState
impl<'de> Deserialize<'de> for NodeState
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<NodeState, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<NodeState, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for NodeState
impl Serialize for NodeState
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for NodeState
Auto Trait Implementations§
impl Freeze for NodeState
impl RefUnwindSafe for NodeState
impl Send for NodeState
impl Sync for NodeState
impl Unpin for NodeState
impl UnwindSafe for NodeState
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