namespace ZB.MOM.WW.OtOpcUa.Host.OpcUa; /// Lifecycle of this node's OPC UA endpoint as drives it. public enum OpcUaEndpointStatus { /// The hosted service has not run StartAsync yet. NotStarted, /// The SDK is listening and the address-space / ServiceLevel sinks are bound. Started, /// The SDK failed to start (port in use, PKI unwritable, bad OpcUa:* override, …). Failed, /// The hosted service stopped the SDK; the port is released. Stopped, } /// /// The one place the "did the OPC UA SDK actually start?" fact lives (R03:2.1). Before it, a failed /// start was one Error line: /health/ready stayed 200, the node joined its mesh, could be /// elected driver Primary and acked deploys as Applied through the Null sink — while clients got /// connection-refused from the node the fleet called healthy. /// /// /// Consumed by OpcUaEndpointHealthCheck (Ready + Active tiers). The redundancy election and the /// ServiceLevel calculator do not read it yet — they live outside the Host (Cluster / /// Runtime); feeding them is the Wave 3 follow-up the lane report names. Until then a fused /// node whose SDK failed is visible (503) but still Primary-eligible. /// public interface IOpcUaEndpointState { /// The endpoint's current lifecycle status. OpcUaEndpointStatus Status { get; } /// Why the start failed, when is . string? FailureReason { get; } } /// Mutable ; written by the hosted service, read by the health check. public sealed class OpcUaEndpointState : IOpcUaEndpointState { private volatile OpcUaEndpointStatus _status = OpcUaEndpointStatus.NotStarted; private volatile string? _failureReason; /// public OpcUaEndpointStatus Status => _status; /// public string? FailureReason => _failureReason; /// Records a successful SDK start. public void MarkStarted() { _failureReason = null; _status = OpcUaEndpointStatus.Started; } /// Records a failed SDK start. /// The failure, as the health probe should report it. public void MarkFailed(string reason) { _failureReason = reason; _status = OpcUaEndpointStatus.Failed; } /// Records that the hosted service stopped the SDK. public void MarkStopped() { _failureReason = null; _status = OpcUaEndpointStatus.Stopped; } }