fix(opcuaclient): RefreshEnd signals initial alarm state only for a lossless refresh bracket (#926)
Track RefreshStart..RefreshEnd per alarm subscription. EventQueueOverflow (matched by EventType before the source filter - it comes from the Server object), RefreshRequired, a publish-sequence gap the SDK skipped (EventFieldList.Message.SequenceNumber; SDK 2.0.1's Republish publish-state never fires for a gap that blocks delivery) or a missing RefreshStart suppress the A1 signal and re-run ConditionRefresh, bounded (3, 2/4/8 s); exhausted = conditions stay unknown (Uncertain), never Unsignalable. Alarm event queue 1000 -> 10000; new counters alarm_event_queue_overflow / alarm_refresh_lossy. Unit + real-SDK gap tests, live overflow gate on opc-plc --alm; plan G2 text corrected.
This commit is contained in:
@@ -26,6 +26,10 @@ internal sealed class OpcUaClientDiagnostics
|
||||
public const string KeepAliveRecovered = "keepalive_recovered";
|
||||
/// <summary>A late replayed notification (source time at or below the ref's high-water mark) was dropped inside the post-recovery replay window.</summary>
|
||||
public const string StaleNotificationDropped = "stale_notification_dropped";
|
||||
/// <summary>#926: the upstream reported an <c>EventQueueOverflowEventType</c> on an alarm event item (events lost).</summary>
|
||||
public const string AlarmEventQueueOverflow = "alarm_event_queue_overflow";
|
||||
/// <summary>#926: a RefreshEnd was NOT taken as "initial alarm state delivered" because its replay was lossy.</summary>
|
||||
public const string AlarmRefreshLossy = "alarm_refresh_lossy";
|
||||
|
||||
private readonly string _driverInstanceId;
|
||||
|
||||
|
||||
@@ -2434,6 +2434,16 @@ public sealed class OpcUaClientDriver : IDriver, ITagDiscovery, IReadable, IWrit
|
||||
private const int AlarmFieldAckedState = 8;
|
||||
private const int AlarmFieldBranchId = 9;
|
||||
|
||||
/// <summary>#926: the requested queue size of the alarm event item (was 1000). See its use.</summary>
|
||||
internal const uint AlarmEventQueueSize = 10_000;
|
||||
|
||||
/// <summary>#926 test seam (the live overflow gate shrinks it): the queue size the alarm event item requests.</summary>
|
||||
internal uint AlarmEventItemQueueSize { get; set; } = AlarmEventQueueSize;
|
||||
|
||||
/// <summary>#926 test seam (the live gate flips it to make a lossy replay KEEP its RefreshEnd): the alarm event
|
||||
/// item's DiscardOldest. Production: false (the newest events are dropped on overflow).</summary>
|
||||
internal bool AlarmEventItemDiscardOldest { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IAlarmSubscriptionHandle> SubscribeAlarmsAsync(
|
||||
IReadOnlyList<string> sourceNodeIds, CancellationToken cancellationToken)
|
||||
@@ -2574,8 +2584,12 @@ public sealed class OpcUaClientDriver : IDriver, ITagDiscovery, IReadable, IWrit
|
||||
StartNodeId = ObjectIds.Server,
|
||||
AttributeId = Attributes.EventNotifier,
|
||||
MonitoringMode = MonitoringMode.Reporting,
|
||||
QueueSize = 1000, // deep queue — a server can fire many alarms in bursts
|
||||
DiscardOldest = false,
|
||||
// #926: deep queue — a ConditionRefresh replays EVERY retained upstream condition in one burst, and a
|
||||
// server can fire many alarms at once. An overflow is still detected (EventQueueOverflowEventType ⇒ the
|
||||
// refresh's RefreshEnd does not signal and it is re-run); the depth only makes it rarer. The server
|
||||
// may revise it down (logged with the retry budget's exhaustion).
|
||||
QueueSize = AlarmEventItemQueueSize,
|
||||
DiscardOldest = AlarmEventItemDiscardOldest,
|
||||
Filter = filter,
|
||||
})
|
||||
{
|
||||
@@ -2790,6 +2804,21 @@ public sealed class OpcUaClientDriver : IDriver, ITagDiscovery, IReadable, IWrit
|
||||
// without this it would feed RouteAlarmEvent alongside the real one.
|
||||
if (!_alarmSubscriptions.ContainsKey(handle.Id)) return;
|
||||
RecordLivenessEvidence();
|
||||
RouteAlarmEventFieldList(efl, sourceFilter, handle);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Route one delivered event: first #926's publish-sequence check (a gap inside a refresh bracket makes it
|
||||
/// lossy — checked BEFORE the event, so a RefreshEnd in the first message after the gap is already suppressed),
|
||||
/// then <see cref="RouteAlarmEvent"/>.
|
||||
/// </summary>
|
||||
/// <param name="efl">The delivered event (the SDK sets <c>Message</c> to its notification message).</param>
|
||||
/// <param name="sourceFilter">The subscription's upstream-key → RawPath index.</param>
|
||||
/// <param name="handle">The subscription handle.</param>
|
||||
internal void RouteAlarmEventFieldList(
|
||||
EventFieldList efl, IReadOnlyDictionary<string, string> sourceFilter, IAlarmSubscriptionHandle handle)
|
||||
{
|
||||
NoteAlarmMessageSequence(handle, efl.Message?.SequenceNumber ?? 0);
|
||||
RouteAlarmEvent(efl.EventFields.ToList(), sourceFilter, handle);
|
||||
}
|
||||
|
||||
@@ -2826,25 +2855,10 @@ public sealed class OpcUaClientDriver : IDriver, ITagDiscovery, IReadable, IWrit
|
||||
internal void RouteAlarmEvent(
|
||||
IReadOnlyList<Variant> fields, IReadOnlyDictionary<string, string> sourceFilter, IAlarmSubscriptionHandle handle)
|
||||
{
|
||||
if (IsRefreshRequired(fields))
|
||||
if (fields.Count > AlarmFieldEventType && UpstreamValueMapping.ToClr(fields[AlarmFieldEventType]) is NodeId markerType
|
||||
&& IsBracketEventType(markerType))
|
||||
{
|
||||
// Part 9 §5.11.7: the server lost events (queue overflow / restart) and asks for a refresh.
|
||||
// r2 R2-1: bound to the session's work token, which a shutdown cancels first thing.
|
||||
var sessionWork = _sessionWorkCts.Token;
|
||||
_ = Task.Run(() => RefreshAllAlarmSubscriptionsAsync(sessionWork));
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsRefreshEnd(fields))
|
||||
{
|
||||
// grpc-data A1 (F1): the refresh replay this subscription requested is complete and every refreshed event
|
||||
// before it was routed (sequential publishing, G2). Under the emission lock, so the signal is ordered
|
||||
// behind every emission. Covers the subscription's alarm RawPaths.
|
||||
lock (_alarmStateLock)
|
||||
{
|
||||
if (handle is OpcUaAlarmSubscriptionHandle h && _alarmSubscriptions.TryGetValue(h.Id, out var ras))
|
||||
RaiseInitialAlarmState(ras.AlarmRefs, unsignalable: false);
|
||||
}
|
||||
RouteBracketEvent(markerType, handle);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2893,6 +2907,235 @@ public sealed class OpcUaClientDriver : IDriver, ITagDiscovery, IReadable, IWrit
|
||||
/// <param name="Severity">Exact severity last told (null before any event).</param>
|
||||
private readonly record struct AlarmToldState(bool Active, bool Acked, string? Message, int? Severity);
|
||||
|
||||
/// <summary>#926: the event types that drive the refresh bracket (never alarms): the three ConditionRefresh
|
||||
/// markers and the server's <c>EventQueueOverflowEventType</c>.</summary>
|
||||
/// <param name="t">The event's EventType.</param>
|
||||
/// <returns>Whether it is a bracket event.</returns>
|
||||
private static bool IsBracketEventType(NodeId t) =>
|
||||
t == ObjectTypeIds.RefreshStartEventType || t == ObjectTypeIds.RefreshEndEventType
|
||||
|| t == ObjectTypeIds.RefreshRequiredEventType || t == ObjectTypeIds.EventQueueOverflowEventType;
|
||||
|
||||
/// <summary>
|
||||
/// #926 — route one bracket event. Matched by EventType BEFORE any source filtering: an
|
||||
/// <c>EventQueueOverflowEventType</c> (Part 4) and the refresh markers come from the Server object, never
|
||||
/// from an authored condition source, so the projector's source filter would drop them.
|
||||
/// <list type="bullet">
|
||||
/// <item>RefreshStart opens a bracket and clears the loss record.</item>
|
||||
/// <item>EventQueueOverflow is a definite loss: the bracket's RefreshEnd will not signal, and a bounded driver
|
||||
/// re-refresh is requested (also outside a bracket — a lost live transition is repaired by a replay).</item>
|
||||
/// <item>RefreshRequired is a loss too; it keeps its existing sweep, which IS the re-refresh.</item>
|
||||
/// <item>RefreshEnd signals (grpc-data A1) only for a bracket that was opened and saw no loss; otherwise it
|
||||
/// stays silent — the conditions stay unknown (Uncertain), the safe invariant — and requests the
|
||||
/// re-refresh if none was yet.</item>
|
||||
/// </list>
|
||||
/// </summary>
|
||||
/// <param name="type">The bracket event's EventType.</param>
|
||||
/// <param name="handle">The subscription the event arrived on.</param>
|
||||
private void RouteBracketEvent(NodeId type, IAlarmSubscriptionHandle handle)
|
||||
{
|
||||
RemoteAlarmSubscription? ras = null;
|
||||
if (handle is OpcUaAlarmSubscriptionHandle h) _alarmSubscriptions.TryGetValue(h.Id, out ras);
|
||||
|
||||
if (type == ObjectTypeIds.RefreshRequiredEventType)
|
||||
{
|
||||
if (ras is not null)
|
||||
lock (_alarmStateLock)
|
||||
{
|
||||
// The sweep below re-refreshes this subscription, so no driver retry is requested for it.
|
||||
NoteBracketLoss(ras, "RefreshRequired", requestRetry: false);
|
||||
ras.Bracket.RetryRequestedSinceStart = true;
|
||||
}
|
||||
// Part 9 §5.11.7: the server lost events (queue overflow / restart) and asks for a refresh.
|
||||
// r2 R2-1: bound to the session's work token, which a shutdown cancels first thing.
|
||||
var sessionWork = _sessionWorkCts.Token;
|
||||
_ = Task.Run(() => RefreshAllAlarmSubscriptionsAsync(sessionWork));
|
||||
return;
|
||||
}
|
||||
|
||||
if (ras is null) return; // a released / stray subscription: no bracket, no signal (G5)
|
||||
lock (_alarmStateLock)
|
||||
{
|
||||
var b = ras.Bracket;
|
||||
if (type == ObjectTypeIds.RefreshStartEventType)
|
||||
{
|
||||
b.Open = true;
|
||||
b.LossSinceStart = null;
|
||||
b.RetryRequestedSinceStart = false;
|
||||
}
|
||||
else if (type == ObjectTypeIds.EventQueueOverflowEventType)
|
||||
{
|
||||
_diag.Record(OpcUaClientDiagnostics.AlarmEventQueueOverflow);
|
||||
NoteBracketLoss(ras, "EventQueueOverflow (the upstream discarded events of this subscription)",
|
||||
requestRetry: true);
|
||||
}
|
||||
else if (type == ObjectTypeIds.RefreshEndEventType)
|
||||
{
|
||||
var opened = b.Open;
|
||||
b.Open = false;
|
||||
if (opened && b.LossSinceStart is null)
|
||||
{
|
||||
// grpc-data A1 (F1): the refresh replay this subscription requested is complete, lossless, and every
|
||||
// refreshed event before it was routed (sequential publishing, G2). Under the emission lock, so the
|
||||
// signal is ordered behind every emission. Covers the subscription's alarm RawPaths.
|
||||
b.Retries = 0;
|
||||
b.ExhaustedLogged = false;
|
||||
RaiseInitialAlarmState(ras.AlarmRefs, unsignalable: false);
|
||||
return;
|
||||
}
|
||||
|
||||
var reason = b.LossSinceStart ?? "RefreshEnd without its RefreshStart (the bracket start was lost)";
|
||||
_diag.Record(OpcUaClientDiagnostics.AlarmRefreshLossy);
|
||||
_logger.LogWarning(
|
||||
"OpcUaClientDriver '{DriverInstanceId}': RefreshEnd on alarm subscription {SubscriptionId} NOT taken " +
|
||||
"as 'initial alarm state delivered' — {Reason}; its conditions stay unknown until a lossless refresh.",
|
||||
_driverInstanceId, ras.Handle.DiagnosticId, reason);
|
||||
if (!b.RetryRequestedSinceStart)
|
||||
{
|
||||
b.RetryRequestedSinceStart = true;
|
||||
ScheduleAlarmRefreshRetryLocked(ras, reason);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>#926: record a loss against <paramref name="ras"/>'s bracket and (once per bracket) request a
|
||||
/// bounded re-refresh. Caller holds <c>_alarmStateLock</c>.</summary>
|
||||
/// <param name="ras">The alarm subscription.</param>
|
||||
/// <param name="reason">What was lost (logged).</param>
|
||||
/// <param name="requestRetry">Whether the driver itself should re-run ConditionRefresh.</param>
|
||||
private void NoteBracketLoss(RemoteAlarmSubscription ras, string reason, bool requestRetry)
|
||||
{
|
||||
var b = ras.Bracket;
|
||||
b.LossSinceStart ??= reason;
|
||||
if (!requestRetry || b.RetryRequestedSinceStart) return;
|
||||
b.RetryRequestedSinceStart = true;
|
||||
ScheduleAlarmRefreshRetryLocked(ras, reason);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// #926: the publish-sequence check of alarm subscription <paramref name="handle"/>. The alarm subscription holds
|
||||
/// exactly one (event) monitored item, so every data-bearing notification message it receives carries its
|
||||
/// events and consumes one sequence number (keep-alives consume none). With <c>SequentialPublishing</c> the SDK
|
||||
/// delivers messages in order and waits for a missing one (republish); if the republish fails it SKIPS the gap
|
||||
/// and delivers the next message. That skip is reported to nothing the driver can observe — SDK 2.0.1 raises its
|
||||
/// <c>PublishStateChangedMask.Republish</c> only in a message-worker pass that also delivers a message, which a
|
||||
/// gap holding every later message prevents (pinned by the real-SDK test). So the driver compares sequence
|
||||
/// numbers itself: a message that is not the previous one or its successor means messages were lost, and
|
||||
/// inside a bracket that replay is lossy. Outside a bracket the next bracket replays the full state.
|
||||
/// A StatusChange-only message (transfer / timeout) also consumes a number and reads as a gap: a bounded
|
||||
/// extra refresh, never a wrong signal.
|
||||
/// </summary>
|
||||
/// <param name="handle">The alarm subscription handle.</param>
|
||||
/// <param name="sequenceNumber">The delivered message's sequence number (0 = unknown, ignored).</param>
|
||||
internal void NoteAlarmMessageSequence(IAlarmSubscriptionHandle handle, uint sequenceNumber)
|
||||
{
|
||||
if (sequenceNumber == 0) return;
|
||||
if (handle is not OpcUaAlarmSubscriptionHandle h || !_alarmSubscriptions.TryGetValue(h.Id, out var ras)) return;
|
||||
lock (_alarmStateLock)
|
||||
{
|
||||
var b = ras.Bracket;
|
||||
var last = b.LastSequenceNumber;
|
||||
b.LastSequenceNumber = sequenceNumber;
|
||||
if (last == 0 || sequenceNumber == last) return;
|
||||
var next = last == uint.MaxValue ? 1u : last + 1;
|
||||
if (sequenceNumber == next || !b.Open) return;
|
||||
NoteBracketLoss(ras,
|
||||
$"publish message(s) of the replay were lost (sequence {last} → {sequenceNumber})", requestRetry: true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>#926: the bounded number of driver-initiated re-refreshes per lossy episode (reset by a clean
|
||||
/// RefreshEnd). When spent, the conditions stay unknown (Uncertain) and the host's
|
||||
/// <c>ConditionKnownSignalTimeout</c> diagnostic reports them — never known-inactive.</summary>
|
||||
internal const int MaxAlarmRefreshRetries = 3;
|
||||
|
||||
/// <summary>#926: the first re-refresh delay; each further retry doubles it (2 s, 4 s, 8 s), giving the
|
||||
/// upstream time to drain whatever overflowed. Test seam.</summary>
|
||||
internal TimeSpan AlarmRefreshRetryBaseDelay { get; set; } = TimeSpan.FromSeconds(2);
|
||||
|
||||
/// <summary>#926 test seam: replaces the ConditionRefresh call of a driver re-refresh.</summary>
|
||||
internal Func<Subscription, CancellationToken, Task>? AlarmRefreshRetryInvokerForTest { get; set; }
|
||||
|
||||
/// <summary>#926: schedule one bounded re-refresh of <paramref name="ras"/> (coalesced while one is pending).
|
||||
/// Caller holds <c>_alarmStateLock</c>.</summary>
|
||||
/// <param name="ras">The alarm subscription.</param>
|
||||
/// <param name="reason">Why (logged).</param>
|
||||
private void ScheduleAlarmRefreshRetryLocked(RemoteAlarmSubscription ras, string reason)
|
||||
{
|
||||
var b = ras.Bracket;
|
||||
if (b.RetryPending) return;
|
||||
if (b.Retries >= MaxAlarmRefreshRetries)
|
||||
{
|
||||
if (!b.ExhaustedLogged)
|
||||
{
|
||||
b.ExhaustedLogged = true;
|
||||
_logger.LogWarning(
|
||||
"OpcUaClientDriver '{DriverInstanceId}': alarm subscription {SubscriptionId} lost refresh events " +
|
||||
"{Retries} time(s) in a row ({Reason}); no further re-refresh. Its conditions stay unknown (Uncertain) " +
|
||||
"until a later lossless ConditionRefresh (RefreshRequired, reconnect, resubscribe). The event item's " +
|
||||
"revised queue size is {QueueSize}.",
|
||||
_driverInstanceId, ras.Handle.DiagnosticId, b.Retries, reason, ras.EventItem.Status?.QueueSize);
|
||||
}
|
||||
return;
|
||||
}
|
||||
b.Retries++;
|
||||
b.RetryPending = true;
|
||||
var delay = AlarmRefreshRetryBaseDelay * (1 << (b.Retries - 1));
|
||||
_logger.LogWarning(
|
||||
"OpcUaClientDriver '{DriverInstanceId}': alarm subscription {SubscriptionId}: {Reason}; re-running " +
|
||||
"ConditionRefresh in {Delay} (attempt {Attempt}/{Max}).",
|
||||
_driverInstanceId, ras.Handle.DiagnosticId, reason, delay, b.Retries, MaxAlarmRefreshRetries);
|
||||
var sessionWork = _sessionWorkCts.Token;
|
||||
_ = Task.Run(() => RetryAlarmRefreshAsync(ras, delay, sessionWork));
|
||||
}
|
||||
|
||||
/// <summary>#926: after <paramref name="delay"/>, re-run ConditionRefresh on <paramref name="ras"/> — only while it
|
||||
/// is still the registered subscription for its handle (an unsubscribe / re-init releases it).</summary>
|
||||
/// <param name="ras">The alarm subscription.</param>
|
||||
/// <param name="delay">The back-off.</param>
|
||||
/// <param name="cancellationToken">The session's work token (cancelled by shutdown / re-init).</param>
|
||||
/// <returns>A task completing when the refresh call returned (or was skipped).</returns>
|
||||
private async Task RetryAlarmRefreshAsync(RemoteAlarmSubscription ras, TimeSpan delay, CancellationToken cancellationToken)
|
||||
{
|
||||
var gateHeld = false;
|
||||
try
|
||||
{
|
||||
if (delay > TimeSpan.Zero) await Task.Delay(delay, Clock, cancellationToken).ConfigureAwait(false);
|
||||
await _subscriptionGate.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||
gateHeld = true;
|
||||
if (!_alarmSubscriptions.TryGetValue(ras.Handle.Id, out var current) || !ReferenceEquals(current, ras)) return;
|
||||
// From here a further loss may request the next retry: it belongs to THIS refresh's replay. That matters
|
||||
// when the replay's own RefreshStart is lost too (queue still full) — without the reset, no bracket opens
|
||||
// and nothing could request again. A lossy RefreshEnd of the PREVIOUS replay still in flight can then
|
||||
// request one extra refresh; that is inside the bound.
|
||||
lock (_alarmStateLock)
|
||||
{
|
||||
ras.Bracket.RetryPending = false;
|
||||
ras.Bracket.RetryRequestedSinceStart = false;
|
||||
}
|
||||
if (AlarmRefreshRetryInvokerForTest is { } invoke)
|
||||
await invoke(ras.Subscription, cancellationToken).ConfigureAwait(false);
|
||||
else if (ras.Subscription.Session is not null && ras.Subscription.Created)
|
||||
await TryConditionRefreshAsync(ras.Subscription, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (OperationCanceledException) { /* shutdown / re-init: the subscription is being released */ }
|
||||
catch (ObjectDisposedException) { /* driver disposed */ }
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "OpcUaClientDriver '{DriverInstanceId}': alarm re-refresh of {SubscriptionId} failed; " +
|
||||
"its conditions stay unknown until a later lossless ConditionRefresh.",
|
||||
_driverInstanceId, ras.Handle.DiagnosticId);
|
||||
}
|
||||
finally
|
||||
{
|
||||
lock (_alarmStateLock) ras.Bracket.RetryPending = false;
|
||||
if (gateHeld)
|
||||
{
|
||||
try { _subscriptionGate.Release(); } catch (ObjectDisposedException) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>True for a <c>RefreshRequiredEventType</c> event (the server asks the client to ConditionRefresh).</summary>
|
||||
/// <param name="fields">The event's fields.</param>
|
||||
/// <returns>Whether the event is a RefreshRequired marker.</returns>
|
||||
@@ -3146,6 +3389,9 @@ public sealed class OpcUaClientDriver : IDriver, ITagDiscovery, IReadable, IWrit
|
||||
if (fields.Count <= AlarmFieldConditionId) return null;
|
||||
// ConditionRefresh brackets its re-delivery with RefreshStart/RefreshEnd — markers, never alarms.
|
||||
if (IsRefreshMarker(UpstreamValueMapping.ToClr(fields[AlarmFieldEventType]))) return null;
|
||||
// #926: the server's queue-overflow notice is not an alarm either (pass-through would otherwise project it).
|
||||
if (UpstreamValueMapping.ToClr(fields[AlarmFieldEventType]) is NodeId et && et == ObjectTypeIds.EventQueueOverflowEventType)
|
||||
return null;
|
||||
// A condition BRANCH event reports a previous state with its own EventId: projecting it would flip the
|
||||
// trunk's state, remembering it would make Acknowledge ack the branch.
|
||||
if (fields.Count > AlarmFieldBranchId && UpstreamValueMapping.ToClr(fields[AlarmFieldBranchId]) is NodeId branch && !branch.IsNull)
|
||||
@@ -3238,7 +3484,44 @@ public sealed class OpcUaClientDriver : IDriver, ITagDiscovery, IReadable, IWrit
|
||||
OpcUaAlarmSubscriptionHandle Handle,
|
||||
MonitoredItem EventItem,
|
||||
MonitoredItemNotificationEventHandler Handler,
|
||||
IReadOnlyList<string> AlarmRefs);
|
||||
IReadOnlyList<string> AlarmRefs)
|
||||
{
|
||||
/// <summary>#926: this subscription's ConditionRefresh bracket + bounded re-refresh state. Mutated only
|
||||
/// under <c>_alarmStateLock</c>.</summary>
|
||||
public AlarmRefreshBracket Bracket { get; } = new();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// #926 — the RefreshStart…RefreshEnd bracket of one alarm subscription. A RefreshEnd declares the conditions it
|
||||
/// covers state-known (grpc-data A1), so it may only signal when the replay it closes is provably complete: its
|
||||
/// RefreshStart was seen and no loss (EventQueueOverflow, RefreshRequired, a publish-sequence gap) was
|
||||
/// observed since. Every field is read and written under <c>_alarmStateLock</c>.
|
||||
/// </summary>
|
||||
internal sealed class AlarmRefreshBracket
|
||||
{
|
||||
/// <summary>A RefreshStart was routed and its RefreshEnd not yet.</summary>
|
||||
public bool Open;
|
||||
|
||||
/// <summary>The first loss observed since the last RefreshStart (null = none). A RefreshEnd with a loss
|
||||
/// does not signal.</summary>
|
||||
public string? LossSinceStart;
|
||||
|
||||
/// <summary>A re-refresh was already requested for the loss since the last RefreshStart or the last re-refresh's
|
||||
/// start (so the lossy RefreshEnd that follows does not request a second one).</summary>
|
||||
public bool RetryRequestedSinceStart;
|
||||
|
||||
/// <summary>A driver re-refresh is scheduled and has not started its ConditionRefresh call yet.</summary>
|
||||
public bool RetryPending;
|
||||
|
||||
/// <summary>Driver re-refreshes spent since the last clean (signalled) RefreshEnd.</summary>
|
||||
public int Retries;
|
||||
|
||||
/// <summary>The retry budget is spent and that was logged (once per episode).</summary>
|
||||
public bool ExhaustedLogged;
|
||||
|
||||
/// <summary>Sequence number of the last delivered notification message (0 = none yet).</summary>
|
||||
public uint LastSequenceNumber;
|
||||
}
|
||||
|
||||
private sealed record OpcUaAlarmSubscriptionHandle(long Id) : IAlarmSubscriptionHandle
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user