29 lines
1.6 KiB
C#
29 lines
1.6 KiB
C#
using Opc.Ua;
|
|
using Opc.Ua.Server;
|
|
using ZB.MOM.WW.OtOpcUa.OpcUaServer.Security;
|
|
|
|
namespace ZB.MOM.WW.OtOpcUa.OpcUaServer;
|
|
|
|
/// <summary>Borrowed SDK browse state; implementations must not retain or mutate the continuation object.</summary>
|
|
public sealed record ProjectedBrowseContext(NodeId Parent, RoleCarryingUserIdentity? Caller,
|
|
ContinuationPoint Continuation, long RequestStartedTimestamp);
|
|
|
|
/// <summary>A copied, caller-bound request for one projected page.</summary>
|
|
public sealed record ProjectedBrowsePageRequest(NodeId Parent, RoleCarryingUserIdentity Caller, string? Cursor,
|
|
uint MaximumResults, long RequestStartedTimestamp);
|
|
|
|
/// <summary>An immutable page snapshot; authority must remain live through emission.</summary>
|
|
public sealed record ProjectedBrowsePage(ProjectedBrowseReadiness Status, IReadOnlyList<NodeId> Children,
|
|
string? NextCursor, bool Complete, Func<bool> IsCurrent, long RetainedBytes = 0);
|
|
|
|
/// <summary>Per-caller synchronous lookup and bounded scheduling, never network I/O.</summary>
|
|
public interface IProjectedBrowseAccess
|
|
{
|
|
ProjectedBrowseReadiness GetOrSchedule(ProjectedBrowseContext context);
|
|
ProjectedBrowsePage GetOrSchedulePage(ProjectedBrowsePageRequest request) =>
|
|
new(ProjectedBrowseReadiness.Unavailable, [], null, false, static () => false);
|
|
/// <summary>Waits for a bounded coalesced page preparation without occupying an SDK lock.</summary>
|
|
Task<ProjectedBrowsePage> WaitForPageAsync(ProjectedBrowsePageRequest request, CancellationToken cancellationToken) =>
|
|
Task.FromResult(GetOrSchedulePage(request));
|
|
}
|