feat(grpc-data): A3 IProjectedConditionAccess / IProjectedConditionSink contracts
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
using ZB.MOM.WW.OtOpcUa.Core.Abstractions.DataConnections;
|
||||
using ZB.MOM.WW.OtOpcUa.OpcUaServer.Security;
|
||||
|
||||
namespace ZB.MOM.WW.OtOpcUa.OpcUaServer;
|
||||
|
||||
/// <summary>
|
||||
/// A3 (plan §5.2/§5.5): one current placement of an imported condition on this consumer — realm-consistent: the
|
||||
/// placement address lives in the realm of <see cref="MappingId"/>'s export, and the folder it hangs under is a
|
||||
/// projected node of that same mapping.
|
||||
/// </summary>
|
||||
/// <param name="MappingId">The <c>RemoteNamespaceMapping</c> whose root item listed the placement.</param>
|
||||
/// <param name="Realm">The mapping's (and the placement's) realm.</param>
|
||||
/// <param name="Placement">The origin placement address (a listing view; never a cross-realm id).</param>
|
||||
/// <param name="FolderLocalSubject">
|
||||
/// The LOCAL subject (slash-joined local scope segments) of the projected folder the placement sits under: the
|
||||
/// mapping anchor's own subject when the placement's parent is the remote root. The node manager wires that folder
|
||||
/// when (and only while) it is materialised (N7).
|
||||
/// </param>
|
||||
/// <param name="RelativePath">The placement address relative to the mapping's remote root (display only).</param>
|
||||
public sealed record ImportedConditionPlacement(string MappingId, DataRealm Realm, DataView Placement, string FolderLocalSubject,
|
||||
string RelativePath);
|
||||
|
||||
/// <summary>
|
||||
/// A3: one imported condition as the consumer's condition runtime hands it to the node manager — identity
|
||||
/// (<see cref="ConnectionId"/>, <see cref="DataConditionState.ConditionKey"/>), its current placements (primary first) and
|
||||
/// the origin record to mirror. The node manager mints the NodeId from the identity only (N4).
|
||||
/// </summary>
|
||||
/// <param name="ConnectionId">The deployed <c>DataConnection</c> the condition was imported over.</param>
|
||||
/// <param name="State">The origin record (already version-gated by the runtime).</param>
|
||||
/// <param name="Info">The condition's static facts (type, name, source kind); the latest one the stream carried.</param>
|
||||
/// <param name="Placements">Every current placement on this node, the PRIMARY one first (§5.2: deployed config only).</param>
|
||||
/// <param name="SourceName">The primary placement's display path (§5.2).</param>
|
||||
public sealed record ImportedConditionUpdate(string ConnectionId, DataConditionState State, DataConditionInfo? Info,
|
||||
IReadOnlyList<ImportedConditionPlacement> Placements, string SourceName);
|
||||
|
||||
/// <summary>
|
||||
/// A3 (§5.3/§5.5): what the consumer's condition runtime tells the node manager. Every call is bounded per Lock hold by
|
||||
/// the implementation; none blocks on the network.
|
||||
/// </summary>
|
||||
public interface IProjectedConditionSink
|
||||
{
|
||||
/// <summary>Materialises new conditions and applies records through the shared #656 delta gate.</summary>
|
||||
void ApplyConditions(IReadOnlyList<ImportedConditionUpdate> updates);
|
||||
|
||||
/// <summary>Removes conditions (an origin <c>removed</c> record, or a complete re-snapshot that no longer lists them).</summary>
|
||||
void RemoveConditions(string connectionId, IReadOnlyCollection<string> conditionKeys);
|
||||
|
||||
/// <summary>The connection is gone past its stale timeout: <c>Quality = BadNoCommunication</c>, one event each.</summary>
|
||||
void MarkConnectionStale(string connectionId);
|
||||
|
||||
/// <summary>Sends <c>RefreshRequiredEventType</c> to every item that may see a condition of the connection.</summary>
|
||||
void RequireRefresh(string connectionId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A3 (§5.4/§5.5): the consumer's condition access — the per-caller visibility gate and per-connection demand. SDK-free
|
||||
/// apart from the identity type, like <see cref="IProjectedHistoryAccess"/>.
|
||||
/// </summary>
|
||||
public interface IProjectedConditionAccess
|
||||
{
|
||||
/// <summary>
|
||||
/// The §5.4 gate: whether <paramref name="caller"/> passes the mapping gate for <c>CreateMonitoredItems</c>
|
||||
/// (<see cref="DataOperations.Subscribe"/>) on ANY current placement mapping. Evaluated regardless of
|
||||
/// <c>Security:Acl:Enabled</c>. Null caller ⇒ false.
|
||||
/// </summary>
|
||||
bool CanSee(RoleCarryingUserIdentity? caller, IReadOnlyList<ImportedConditionPlacement> placements);
|
||||
|
||||
/// <summary>A generation that moves whenever anything the gate reads may have changed (verdict caches key on it).</summary>
|
||||
long AuthorityGeneration { get; }
|
||||
|
||||
/// <summary>
|
||||
/// An admitted local event item that could see imported conditions (Server object or a projected notifier). The
|
||||
/// first one opens condition demand for every connection the caller could see; disposing the last starts the linger.
|
||||
/// Null when no connection carries conditions (nothing to open).
|
||||
/// </summary>
|
||||
IDisposable? AcquireEventDemand(RoleCarryingUserIdentity? caller);
|
||||
}
|
||||
Reference in New Issue
Block a user