using ZB.MOM.WW.OtOpcUa.Configuration.Enums; namespace ZB.MOM.WW.OtOpcUa.Configuration.Entities; /// /// Per-host connectivity snapshot the Server publishes for each driver's /// IHostConnectivityProbe.GetHostStatuses entry. One row per /// (, , ) triple — /// a redundant 2-node cluster with one Galaxy driver reporting 3 platforms produces 6 /// rows, not 3, because each server node owns its own runtime view. /// /// /// /// Closes the data-layer piece of LMX follow-up #7 (per-AppEngine Admin dashboard /// drill-down). The publisher hosted service on the Server side subscribes to every /// registered driver's OnHostStatusChanged and upserts rows on transitions + /// periodic liveness heartbeats. advances on every /// heartbeat so the Admin UI can flag stale rows from a crashed Server. /// /// /// No foreign-key to — a Server may start reporting host /// status before its ClusterNode row exists (e.g. first-boot bootstrap), and we'd /// rather keep the status row than drop it. The Admin-side service left-joins on /// NodeId when presenting rows. /// /// public sealed class DriverHostStatus { /// Server node that's running the driver. public required string NodeId { get; set; } /// Driver instance's stable id (matches IDriver.DriverInstanceId). public required string DriverInstanceId { get; set; } /// /// Driver-side host identifier — Galaxy Platform / AppEngine name, Modbus /// host:port, whatever the probe returns. Opaque to the Admin UI except as /// a display string. /// public required string HostName { get; set; } public DriverHostState State { get; set; } = DriverHostState.Unknown; /// Timestamp of the last state transition (not of the most recent heartbeat). public DateTime StateChangedUtc { get; set; } /// /// Advances on every publisher heartbeat — the Admin UI uses /// now - LastSeenUtc > threshold to flag rows whose owning Server has /// stopped reporting (crashed, network-partitioned, etc.), independent of /// . /// public DateTime LastSeenUtc { get; set; } /// /// Optional human-readable detail populated when is /// — e.g. the exception message from the /// driver's probe. Null for Running / Stopped / Unknown transitions. /// public string? Detail { get; set; } }