using ZB.MOM.WW.OtOpcUa.Commons.Types; namespace ZB.MOM.WW.OtOpcUa.Commons.Interfaces; /// /// Live view of the local node's identity and the cluster's role topology. Implemented by /// ClusterRoleInfo in OtOpcUa.Cluster; consumed by everything that needs to /// distinguish admin-role vs driver-role members or react to role-leader changes (e.g. OPC UA /// ServiceLevel computation). /// public interface IClusterRoleInfo { /// Gets the local cluster node identifier. NodeId LocalNode { get; } /// Gets the set of roles assigned to the local node. IReadOnlySet LocalRoles { get; } /// /// Gets the local node's cluster-scoped role (e.g. cluster-SITE-A), or null when /// the node carries none. Derived from the node's OWN configured roles at construction time — /// NOT from live cluster membership — so it is available before the cluster forms (per-cluster /// mesh, Phase 6). When more than one cluster-scoped role is configured, the first one wins. /// string? ClusterRole { get; } /// /// Gets the ClusterId extracted from (e.g. SITE-A), or /// null when the node carries no cluster-scoped role. /// string? ClusterId { get; } /// Checks if the local node has the specified role. /// Role name to check. /// True if the local node has the role; otherwise, false. bool HasRole(string role); /// Gets all nodes assigned to the specified role. /// Role name to query. /// List of node identifiers with the role. IReadOnlyList MembersWithRole(string role); /// Gets the leader node for the specified role, or null if no leader is elected. /// Role name to query. /// The leader node identifier, or null if no leader exists. NodeId? RoleLeader(string role); /// Occurs when the leader of a role changes. event EventHandler? RoleLeaderChanged; }