feat(dcl): bounded recursive OPC UA address-space search adapter (T15)

This commit is contained in:
Joseph Doherty
2026-06-18 02:45:01 -04:00
parent 9ec2450ad5
commit c00c8241b3
5 changed files with 308 additions and 1 deletions
@@ -776,6 +776,28 @@ public class RealOpcUaClient : IOpcUaClient
}
}
/// <inheritdoc />
public Task<Commons.Interfaces.Protocol.AddressSpaceSearchResult> SearchAddressSpaceAsync(
string query, int maxDepth, int maxResults, CancellationToken cancellationToken = default)
{
// Fail fast with the typed exception when the link is down — mirrors the
// BrowseChildrenAsync guard. (BrowseChildrenAsync would also throw on the
// first page, but guarding here keeps the empty-query / cap-0 short-circuit
// from masking a disconnected session.)
var session = _session;
if (session is null || !session.Connected)
{
throw new Commons.Interfaces.Protocol.ConnectionNotConnectedException(
"OPC UA session is not connected.");
}
// Bounded BFS over this client's OWN BrowseChildrenAsync — the shared
// helper pages each node's continuation (BrowseNext) to the end, so a
// big folder's later pages are searched too, not just the first page.
return AddressSpaceSearch.SearchAsync(
BrowseChildrenAsync, query, maxDepth, maxResults, cancellationToken);
}
/// <summary>
/// Issues a fresh <see cref="SessionClientExtensions.BrowseAsync"/> of
/// <paramref name="nodeToBrowse"/> and returns its first page, surfacing any