feat(grpc-data): A1 origin condition state in the node manager — delta callback, state_known, activation marker, sliced snapshot, MarkConditionsKnown sink seam, IAlarmInitialStateSignal
This commit is contained in:
@@ -88,6 +88,14 @@ public sealed class DeferredAddressSpaceSink : IOpcUaAddressSpaceSink, ISurgical
|
||||
/// <inheritdoc />
|
||||
public void CompleteAddressSpaceApply() => _inner.CompleteAddressSpaceApply();
|
||||
|
||||
/// <inheritdoc />
|
||||
public void MarkConditionsKnown(string source, IReadOnlyList<string> conditionIds, AddressSpaceRealm realm)
|
||||
=> _inner.MarkConditionsKnown(source, conditionIds, realm);
|
||||
|
||||
/// <inheritdoc />
|
||||
public void MarkConditionsUnknown(string source, IReadOnlyList<string> conditionIds, AddressSpaceRealm realm)
|
||||
=> _inner.MarkConditionsUnknown(source, conditionIds, realm);
|
||||
|
||||
/// <inheritdoc />
|
||||
public void RaiseNodesAddedModelChange(string affectedNodeId, AddressSpaceRealm realm) => _inner.RaiseNodesAddedModelChange(affectedNodeId, realm);
|
||||
|
||||
|
||||
@@ -213,6 +213,31 @@ public interface IOpcUaAddressSpaceSink
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A1 (plan §5.1 T1/T2): the state of <paramref name="conditionIds"/> has been ESTABLISHED by
|
||||
/// <paramref name="source"/> (a driver's <c>InitialAlarmStateDelivered</c>, its backstop timer, or a scripted
|
||||
/// alarm whose inputs were all pushed). An SDK-backed sink sets each materialised condition's known flag and
|
||||
/// raises one state-only condition-state record per newly known condition. <c>OpcUaPublishActor</c> applies it
|
||||
/// strictly after the alarm projections the source emitted before it (F2). Default: no-op.
|
||||
/// </summary>
|
||||
/// <param name="source">The source (driver instance id, or the scripted host) — diagnostics only.</param>
|
||||
/// <param name="conditionIds">The condition node ids (RawPath for native, ScriptedAlarmId for scripted).</param>
|
||||
/// <param name="realm">Their realm.</param>
|
||||
void MarkConditionsKnown(string source, IReadOnlyList<string> conditionIds, AddressSpaceRealm realm)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A1: withdraw "known" from conditions whose state can no longer be vouched for (a scripted alarm whose input
|
||||
/// reverted to never-pushed). Raises one state-only record per condition that was known. Default: no-op.
|
||||
/// </summary>
|
||||
/// <param name="source">The source — diagnostics only.</param>
|
||||
/// <param name="conditionIds">The condition node ids.</param>
|
||||
/// <param name="realm">Their realm.</param>
|
||||
void MarkConditionsUnknown(string source, IReadOnlyList<string> conditionIds, AddressSpaceRealm realm)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Announce that nodes were added at runtime (discovered-node injection) under
|
||||
/// <paramref name="affectedNodeId"/> so subscribed clients refresh their browse
|
||||
@@ -316,6 +341,12 @@ public sealed class NullOpcUaAddressSpaceSink : IOpcUaAddressSpaceSink
|
||||
/// <inheritdoc />
|
||||
public void RebuildAddressSpace() { }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void MarkConditionsKnown(string source, IReadOnlyList<string> conditionIds, AddressSpaceRealm realm) { }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void MarkConditionsUnknown(string source, IReadOnlyList<string> conditionIds, AddressSpaceRealm realm) { }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void RaiseNodesAddedModelChange(string affectedNodeId, AddressSpaceRealm realm) { }
|
||||
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
namespace ZB.MOM.WW.OtOpcUa.Core.Abstractions;
|
||||
|
||||
/// <summary>
|
||||
/// Optional companion to <see cref="IAlarmSource"/>: the driver says when the standing state of a set of its
|
||||
/// conditions has been <b>established</b> — the initial replay, refresh, poll or walk that covers them has
|
||||
/// completed and every alarm event it produced has already been raised (plan
|
||||
/// <c>2026-11-23-grpc-data-connections-history-alarms</c> §5.1, F1/F2/G1/G5).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// <b>An ordered callback, never a <see cref="System.Threading.Tasks.Task"/> (F2).</b> Raise
|
||||
/// <see cref="InitialAlarmStateDelivered"/> synchronously, on the same thread and callback path as
|
||||
/// <see cref="IAlarmSource.OnAlarmEvent"/>, <b>after</b> the last alarm event the completed read covers. The
|
||||
/// host marshals both onto the same actor mailbox, so the "known" mark it derives is applied after every
|
||||
/// projection the driver emitted before raising it. A task continuation could overtake queued transitions.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>Carry what it covers (G1).</b> <see cref="AlarmInitialStateEventArgs.ConditionIds"/> lists the driver
|
||||
/// <c>ConditionId</c>s (= the condition's RawPath, the routing key of the alarm event) whose state the
|
||||
/// completed read established — never "the whole driver". An unreachable device's conditions are simply
|
||||
/// left out and stay unknown.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>Raise on every completed read or cycle</b>, not only the first. Repeats are no-ops downstream; they are
|
||||
/// what makes conditions known again after a reconnect or a deploy that adds conditions.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>Suppression gate (G5).</b> Obey exactly the gate <see cref="IAlarmSource.OnAlarmEvent"/> obeys: raise
|
||||
/// only while an alarm subscription is live. A refresh / poll / sentinel that completes while events are
|
||||
/// suppressed raises nothing; the first signal after (re)subscribe follows the post-subscribe replay.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>A source that cannot signal at all</b> (an OPC UA upstream without ConditionRefresh) raises the event
|
||||
/// once with <see cref="AlarmInitialStateEventArgs.Unsignalable"/> set: the host then applies its
|
||||
/// per-driver-type backstop timer to those conditions instead. No other shipped source should use it.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public interface IAlarmInitialStateSignal
|
||||
{
|
||||
/// <summary>The standing state of <see cref="AlarmInitialStateEventArgs.ConditionIds"/> has been delivered.</summary>
|
||||
event EventHandler<AlarmInitialStateEventArgs>? InitialAlarmStateDelivered;
|
||||
}
|
||||
|
||||
/// <summary>Payload of <see cref="IAlarmInitialStateSignal.InitialAlarmStateDelivered"/>.</summary>
|
||||
public sealed class AlarmInitialStateEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>Creates the payload.</summary>
|
||||
/// <param name="conditionIds">The driver condition ids (RawPaths) whose state the completed read established.</param>
|
||||
/// <param name="unsignalable">
|
||||
/// <see langword="true"/> when the source can never signal for these conditions (no refresh upstream);
|
||||
/// the host's backstop timer applies instead of an immediate mark.
|
||||
/// </param>
|
||||
public AlarmInitialStateEventArgs(IReadOnlyList<string> conditionIds, bool unsignalable = false)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(conditionIds);
|
||||
ConditionIds = conditionIds;
|
||||
Unsignalable = unsignalable;
|
||||
}
|
||||
|
||||
/// <summary>The driver condition ids (= RawPaths) the completed read covers. Never "everything".</summary>
|
||||
public IReadOnlyList<string> ConditionIds { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The source reports <c>InitialStateUnsignalable</c> for these conditions: no real signal will ever come,
|
||||
/// so the per-driver-type backstop timer (OpcUaClient only) decides when they become known.
|
||||
/// </summary>
|
||||
public bool Unsignalable { get; }
|
||||
}
|
||||
Reference in New Issue
Block a user