#[non_exhaustive]pub struct ClusterState {
pub local_node: NodeId,
pub nodes: Vec<NodeId>,
pub is_leader: bool,
pub wire_version: WireVersion,
pub app_version: Option<String>,
pub peer_versions: HashMap<NodeId, PeerVersionInfo>,
}Expand description
Snapshot of the cluster state at a point in time.
Includes topology (which nodes are known), version information for each peer, and the local node’s own version metadata. This is the primary type for operational visibility during rolling upgrades.
§Invariants
nodesincludes the local node.peer_versionsexcludes the local node (local version info is inwire_versionandapp_version).- Every connected remote node in
nodesshould have a corresponding entry inpeer_versions.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.local_node: NodeIdThe local node’s identity.
nodes: Vec<NodeId>All known nodes in the cluster (including local).
is_leader: boolWhether this node considers itself the leader (if applicable).
wire_version: WireVersionThis node’s wire protocol version.
app_version: Option<String>This node’s application version, if configured. Purely informational — does not affect compatibility.
peer_versions: HashMap<NodeId, PeerVersionInfo>Version metadata for each connected remote peer. Populated from
successful handshake responses. Keyed by NodeId; does not
include the local node.
Implementations§
Source§impl ClusterState
impl ClusterState
Sourcepub fn new(local_node: NodeId, nodes: Vec<NodeId>) -> Self
pub fn new(local_node: NodeId, nodes: Vec<NodeId>) -> Self
Create a new ClusterState with the given local node and defaults.
Sets wire_version to DACTOR_WIRE_VERSION,
app_version to None, is_leader to false, and empty
peer_versions.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Number of nodes in the cluster.
Sourcepub fn peer_version(&self, node_id: &NodeId) -> Option<&PeerVersionInfo>
pub fn peer_version(&self, node_id: &NodeId) -> Option<&PeerVersionInfo>
Look up version information for a remote peer.
Trait Implementations§
Source§impl Clone for ClusterState
impl Clone for ClusterState
Source§fn clone(&self) -> ClusterState
fn clone(&self) -> ClusterState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more