Files
lmxopcua/src/Core/ZB.MOM.WW.OtOpcUa.Commons/OpcUa/WarmRedundancySettings.cs
T
Joseph Doherty 7829b937d1 feat(717): Warm non-transparent redundancy, default-off (T1-T10)
OpcUa:Redundancy:Mode (Unset default = today's server exactly; None; Warm; Hot and unknown values fail start).
- T1 options + validator + effective-URI check + boot banner; Warm needs the driver role.
- T2 metadata in OnNodeManagerStartedAsync: Warm -> NonTransparentRedundancyType, read-only
  ServerUriArray [self, peers], RedundancySupport=Warm, boot ServiceLevel 1; None -> RedundancySupport=None
  and the SDK's orphan i=11314 deleted; Unset untouched.
- T3 RedundancyStateChanged.Revision (up-number, incarnation tick, sequence); subscribers drop older
  revisions under Warm (OpcUaPublishActor, DriverHostActor); unrevisioned never makes a node Active.
- T4 WarmRoleAuthority + ComputeWarm bands (Standby 90/50, Active 250/200/100), PromoteWhilePrimaryUnreachable.
- T5 IStandbyProjection + DeferredStandbyProjection; OpcUaPublishActor runs promotion/demotion in the spec
  4.7 order (Active level last and retried; Standby level first, data degraded regardless).
- T6 EquipmentVariableState read projection (BadOutOfService/null); Warm Standby refuses writes BadInvalidState.
- T7 D4 mechanism adopted after T0: ordinary-tag marker on MonitoredItemNotification.Message validated by
  (ClientHandle, DataValue); first-delivery decision keyed by (SubscriptionId, SequenceNumber); the SDK's
  cached copy is never mutated.
- T8 queue current/BadOutOfService to live ordinary-tag items ignoring filters.
- T9 alarm stamp/deliver split (suppressed on Standby), Part 9 methods refused on Standby, promotion
  refresh via ISubscription.ConditionRefresh2Async on every live event item.
- T10 deploy-time RedundancyMode cross-check + six instruments.

Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
2026-11-13 03:39:50 -05:00

37 lines
1.9 KiB
C#

namespace ZB.MOM.WW.OtOpcUa.Commons.OpcUa;
/// <summary>
/// The parsed <c>OpcUa:Redundancy:Mode</c> (Gitea #717). Startup-static: changing it requires a restart.
/// </summary>
public enum OpcUaRedundancyMode
{
/// <summary>Not opted in (the default): byte-for-byte the pre-#717 server. Nothing in the redundancy metadata,
/// ServiceLevel bands, projection or alarm delivery changes.</summary>
Unset = 0,
/// <summary>Standalone: advertises <c>RedundancySupport=None</c> with no <c>ServerUriArray</c>; never projects.</summary>
None = 1,
/// <summary>A 2-node pair with a degraded standby (spec §4): non-transparent Warm metadata, Standby bands below
/// every Active level, ordinary-tag values projected <c>BadOutOfService</c> on the Standby, new alarm events
/// suppressed there, and writes / Part 9 methods refused <c>BadInvalidState</c> there.</summary>
Warm = 2,
}
/// <summary>
/// The runtime half of <c>OpcUa:Redundancy</c> (Gitea #717): what the redundancy actors need. The Host builds it
/// from the validated <c>OpcUaApplicationHostOptions</c> and registers it as a singleton; a node that registers
/// none (a harness, an admin-only node) is <see cref="Unset"/>.
/// </summary>
/// <param name="Mode">The redundancy mode.</param>
/// <param name="PromoteWhilePrimaryUnreachable">Warm only: let the survivor go Active while the Primary is
/// unreachable but not yet downed (spec §4.1, owner answer Q2). Default on.</param>
public sealed record WarmRedundancySettings(OpcUaRedundancyMode Mode, bool PromoteWhilePrimaryUnreachable = true)
{
/// <summary>The not-opted-in default.</summary>
public static WarmRedundancySettings Unset { get; } = new(OpcUaRedundancyMode.Unset);
/// <summary>True when this node runs the Warm role contract.</summary>
public bool IsWarm => Mode == OpcUaRedundancyMode.Warm;
}