5534698d70
Register both v3 namespaces (Raw first, UNS second) on OtOpcUaNodeManager and thread an AddressSpaceRealm discriminator through every node-naming sink method so a bare node id is resolved to the correct namespace by realm — never parsed out of the id string. - IOpcUaAddressSpaceSink / ISurgicalAddressSpaceSink: every node-naming method gains `AddressSpaceRealm realm = AddressSpaceRealm.Uns` (transitional default so un-migrated WP3 call sites still compile; WP3/Wave B makes them explicit and removes the default). Null + SdkAddressSpaceSink impls updated; DeferredAddress- SpaceSink forwards realm through every method (the forwarding trap). - DeferredSinkForwardingReflectionTests: existing exhaustive-forwarding guard auto-covers the new signatures; added an explicit guard that every node-naming sink method carries an AddressSpaceRealm parameter (RebuildAddressSpace exempt). - OtOpcUaNodeManager: register RawNamespaceUri + UnsNamespaceUri; realm->namespace index via NamespaceIndexForRealm; all node maps (_variables/_folders/ _alarmConditions/_nativeAlarmNodeIds/_historizedTagnames/_eventNotifierSources) re-keyed by the full ns-qualified NodeId string so Raw and UNS nodes sharing a bare id stay distinct; _notifierFolders already NodeId-keyed. A historized UNS reference node registers the SAME historian tagname as its backing raw node (both NodeIds -> one tagname). Inbound-write hook routes the full ns-qualified NodeId to the write gateway (realm-aware) and reverts by bare id + realm. HistoryRead seams resolve via NodeId directly. DefaultNamespaceUri kept as a transitional alias to UnsNamespaceUri for the SubscriptionSurvivalTests. - Test doubles across Commons.Tests / OpcUaServer.Tests / Runtime.Tests updated to the new interface signatures; SdkAddressSpaceSinkTests asserts the UNS namespace index for default-realm nodes. Build: dotnet build ZB.MOM.WW.OtOpcUa.slnx = 0 errors. Tests: Commons.Tests 310/310; OpcUaServer.Tests 335 passed / 4 pre-existing skips. Claude-Session: https://claude.ai/code/session_01LVneM3eh1UtJxEisFXgmox
79 lines
7.1 KiB
C#
79 lines
7.1 KiB
C#
namespace ZB.MOM.WW.OtOpcUa.Commons.OpcUa;
|
|
|
|
/// <summary>Optional capability on an address-space sink: surgical in-place attribute updates on an
|
|
/// EXISTING variable node, used by AddressSpaceApplier to avoid a full RebuildAddressSpace for pure-property
|
|
/// tag changes (Writable / Historizing / DataType / array-shape). A sink that does not implement it ⇒ caller
|
|
/// falls back to a full rebuild (safe default).</summary>
|
|
public interface ISurgicalAddressSpaceSink
|
|
{
|
|
/// <summary>Update an existing variable node's surgically-updatable attributes IN PLACE, notifying
|
|
/// subscribers (ClearChangeMasks) without a rebuild — so client MonitoredItems on the node survive.
|
|
/// Covers Writable (AccessLevel + inbound-write handler), Historizing (+ historian-tagname binding),
|
|
/// and the node's presentation shape: <paramref name="dataType"/> (the OPC UA DataType) and
|
|
/// <paramref name="isArray"/>/<paramref name="arrayLength"/> (ValueRank + ArrayDimensions). When the
|
|
/// shape actually changes, the implementation resets the node's value to BadWaitingForInitialData
|
|
/// (no stale wrong-typed value is exposed until the driver republishes) and raises a Part 3
|
|
/// GeneralModelChangeEvent (verb=DataTypeChanged) so model-aware clients re-read the node definition.
|
|
/// Returns false if the node does not exist (caller should rebuild instead).</summary>
|
|
/// <param name="variableNodeId">The folder-scoped node id of the variable to update in place.</param>
|
|
/// <param name="writable">When true the node becomes read/write (with the inbound-write handler); otherwise read-only.</param>
|
|
/// <param name="historianTagname">null ⇒ not historized; non-null ⇒ Historizing with the HistoryRead bit and tagname binding.</param>
|
|
/// <param name="dataType">The OPC UA built-in data type name (e.g. "Boolean", "Int32", "Float").</param>
|
|
/// <param name="isArray">When true the node is a 1-D array (ValueRank=OneDimension); when false scalar.</param>
|
|
/// <param name="arrayLength">The declared length of the 1-D array when <paramref name="isArray"/> is true; ignored for scalars.</param>
|
|
/// <param name="realm">The namespace realm <paramref name="variableNodeId"/> lives in — the sink resolves the
|
|
/// namespace index from the realm rather than parsing it out of the id string.</param>
|
|
/// <returns>True when the in-place update was applied; false when the node is missing (caller rebuilds).</returns>
|
|
// transitional default — B4-WP3/Wave B makes every call site explicit and removes this default.
|
|
bool UpdateTagAttributes(string variableNodeId, bool writable, string? historianTagname, string dataType, bool isArray, uint? arrayLength, AddressSpaceRealm realm = AddressSpaceRealm.Uns);
|
|
|
|
/// <summary>Update an existing folder node's <c>DisplayName</c> IN PLACE, notifying subscribers
|
|
/// (ClearChangeMasks) without a rebuild — used by AddressSpaceApplier to apply a UNS Area / Line
|
|
/// rename without tearing down + repopulating the whole address space (which would drop every
|
|
/// client's MonitoredItems). The folder's NodeId is unchanged (a rename only touches the friendly
|
|
/// browse/display name, not the logical id). Returns false if the folder does not exist (caller
|
|
/// should rebuild instead).</summary>
|
|
/// <param name="folderNodeId">The node id of the folder whose display name to update in place.</param>
|
|
/// <param name="displayName">The new display name to apply.</param>
|
|
/// <param name="realm">The namespace realm <paramref name="folderNodeId"/> lives in.</param>
|
|
/// <returns>True when the in-place update was applied; false when the folder is missing (caller rebuilds).</returns>
|
|
// transitional default — B4-WP3/Wave B makes every call site explicit and removes this default.
|
|
bool UpdateFolderDisplayName(string folderNodeId, string displayName, AddressSpaceRealm realm = AddressSpaceRealm.Uns);
|
|
|
|
/// <summary>Remove ONE existing value-variable node IN PLACE (detach from its parent, drop it from the
|
|
/// predefined-node set, drop any historized-tagname registration), then raise a Part 3
|
|
/// GeneralModelChangeEvent (verb=NodeDeleted) outside the lock — so subscribers of OTHER nodes are
|
|
/// untouched and their MonitoredItems survive. The caller has already written a final Bad quality to the
|
|
/// node so in-flight MonitoredItems on the removed node observe the removal; after the node is gone,
|
|
/// re-subscription attempts get BadNodeIdUnknown from the SDK. Returns false when the node id is unknown
|
|
/// (the node-manager maps drifted from the plan — caller falls back to a full rebuild).</summary>
|
|
/// <param name="variableNodeId">The folder-scoped node id of the variable to remove in place.</param>
|
|
/// <param name="realm">The namespace realm <paramref name="variableNodeId"/> lives in.</param>
|
|
/// <returns>True when the node was removed; false when the id is unknown (caller rebuilds).</returns>
|
|
// transitional default — B4-WP3/Wave B makes every call site explicit and removes this default.
|
|
bool RemoveVariableNode(string variableNodeId, AddressSpaceRealm realm = AddressSpaceRealm.Uns);
|
|
|
|
/// <summary>Remove ONE existing Part 9 alarm-condition node IN PLACE (detach, drop from the
|
|
/// predefined-node set, clear the native-alarm flag), then raise NodeDeleted outside the lock. The
|
|
/// caller has already written the terminal RemovedConditionState (Retain=false) so a removed condition
|
|
/// stops replaying on ConditionRefresh. Returns false when the condition id is unknown (caller
|
|
/// rebuilds).</summary>
|
|
/// <param name="alarmNodeId">The alarm condition node id (== ScriptedAlarmId, or a native alarm tag's folder-scoped id).</param>
|
|
/// <param name="realm">The namespace realm <paramref name="alarmNodeId"/> lives in.</param>
|
|
/// <returns>True when the condition was removed; false when the id is unknown (caller rebuilds).</returns>
|
|
// transitional default — B4-WP3/Wave B makes every call site explicit and removes this default.
|
|
bool RemoveAlarmConditionNode(string alarmNodeId, AddressSpaceRealm realm = AddressSpaceRealm.Uns);
|
|
|
|
/// <summary>Remove an equipment folder AND its entire descendant subtree (sub-folders, value variables,
|
|
/// condition nodes) IN PLACE: per-descendant map/registration cleanup (variables, historized tagnames,
|
|
/// conditions, native flags), notifier demotion (sever the Server↔folder root-notifier ref +
|
|
/// notifier-folder + event-notifier-source registrations for the equipment id), then one NodeDeleted for
|
|
/// the equipment folder outside the lock. Returns false when the folder id is unknown (caller
|
|
/// rebuilds).</summary>
|
|
/// <param name="equipmentNodeId">The equipment folder node id whose entire subtree to remove.</param>
|
|
/// <param name="realm">The namespace realm <paramref name="equipmentNodeId"/> lives in.</param>
|
|
/// <returns>True when the subtree was removed; false when the id is unknown (caller rebuilds).</returns>
|
|
// transitional default — B4-WP3/Wave B makes every call site explicit and removes this default.
|
|
bool RemoveEquipmentSubtree(string equipmentNodeId, AddressSpaceRealm realm = AddressSpaceRealm.Uns);
|
|
}
|