using ZB.MOM.WW.OtOpcUa.Commons.OpcUa; namespace ZB.MOM.WW.OtOpcUa.OpcUaServer; /// /// The origin-owned activation marker of one condition (plan §5.6 step 3, T3): (serving incarnation, /// per-condition sequence). The sequence moves only on a NEW occurrence — an Active false→true edge or any /// Acked true→false edge — never on a re-projection that leaves Active/Acked unchanged. /// /// The node manager's serving incarnation (one per process lifetime). /// The per-condition occurrence sequence. public readonly record struct ConditionActivationMarker(string Incarnation, ulong Sequence); /// /// One immutable, SDK-free copy of a live condition's state (plan §5.1), produced by the node manager under its /// Lock — either as a delta (raised for every condition state change) or inside a /// . Invisible until A2 puts it on the wire. /// /// The condition's realm (Raw = native RawPath, Uns = ScriptedAlarmId). /// The condition node id within . /// Driver-fed (native) rather than scripted. /// The hub version: the delta's own version, or the slice watermark for a snapshot copy. /// A removal record: the condition left the address space. /// /// The condition's state has actually been established (§5.1 T2). A record with false never changes a /// consumer's last state; it only marks the condition Uncertain. /// /// Part 9 ActiveState. /// Part 9 AckedState. /// Part 9 ConfirmedState. /// Part 9 EnabledState. /// The shelving kind. /// The node's Part 9 severity (1..1000). /// The node's message text. /// The condition's source-data Quality status code. /// The Part 9 ConditionClassName text, if set. /// The condition's Time. /// Part 9 Retain. /// The origin-owned activation marker (T3). /// The condition's Comment text, if any. /// Who left that comment, if recorded. public sealed record ConditionStateRecord( AddressSpaceRealm Realm, string ConditionId, bool IsNative, long Version, bool Removed, bool StateKnown, bool Active, bool Acknowledged, bool Confirmed, bool Enabled, AlarmShelvingKind Shelving, ushort Severity, string Message, uint Quality, string? ConditionClassName, DateTime TimeUtc, bool Retain, ConditionActivationMarker Activation, string? Comment = null, string? ClientUserId = null); /// /// The node manager's SDK-free delta callback (plan §5.1). Implemented by the Runtime's ConditionStateHub. /// /// /// Both members are called under the node manager's Lock, which is what makes a snapshot cut atomic: /// every delta is either inside a slice or after its watermark. Implementations must therefore only enqueue — /// no I/O, never block, never call back into the node manager. /// public interface IConditionStateSink { /// The version of the last appended record (the snapshot watermark). Read under the node manager's Lock. long Watermark { get; } /// Append one delta record. The sink assigns its version; the record's own Version is ignored. /// The record. /// The version assigned. long Append(ConditionStateRecord record); /// /// The node manager's address-space apply state changed: when a rebuild began (the /// condition set is being re-created), when CompleteAddressSpaceApply ran. Part of /// the snapshot_complete readiness (§5.1: apply complete + Primary verdict). /// /// Whether the current apply has completed. void OnApplyStateChanged(bool complete); } /// /// One Lock hold of : at most MaxConditions /// records plus the watermark at that instant. A delta for one of these conditions with a version above /// applies after the slice; one at or below it is already inside. /// /// The sink's watermark taken under the same hold. /// The copied records (each carries as its version). public sealed record ConditionSnapshotSlice(long Watermark, IReadOnlyList Records);