Files
lmxopcua/src/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer/IProjectedDataAccess.cs
T

36 lines
1.8 KiB
C#

using Opc.Ua;
using ZB.MOM.WW.OtOpcUa.Core.Abstractions.DataConnections;
using ZB.MOM.WW.OtOpcUa.OpcUaServer.Security;
namespace ZB.MOM.WW.OtOpcUa.OpcUaServer;
/// <summary>A caller- and item-scoped projection demand, bound to its original local and remote authority.</summary>
public interface IProjectedDemandLease : IDisposable
{
DataView OriginView { get; }
DataRealm Realm { get; }
string LocalIdentifier { get; }
long ProjectionGeneration { get; }
/// <summary>Maximum allowed origin-cache age; zero denies sample delivery.</summary>
TimeSpan MaximumSampleAge => TimeSpan.Zero;
ServingIdentity Serving { get; }
CancellationToken CancellationToken { get; }
bool IsValid { get; }
}
/// <summary>Nonblocking local admission and bounded scheduling for projected data.</summary>
public interface IProjectedDataAccess
{
TimeProvider Clock { get; }
bool TryAcquire(NodeId nodeId, RoleCarryingUserIdentity caller, DataOperations operation, out IProjectedDemandLease? demand);
/// <summary>On success owns the demand through physical completion; otherwise the caller retains it.</summary>
bool ScheduleRead(IProjectedDemandLease demand, DataBudget budget, long requestStartedTimestamp);
Task<DataWriteOutcome> WriteAsync(IProjectedDemandLease demand, object? value, DataBudget budget,
long requestStartedTimestamp, CancellationToken cancellationToken);
bool StartSubscription(IProjectedDemandLease demand, TimeSpan publishingInterval);
/// <summary>Requests a coalesced fresh authenticated snapshot without changing caller ownership.</summary>
bool RequestFreshSnapshot(IProjectedDemandLease demand) => false;
/// <summary>True while a demand or physically retained operation still owns this projection.</summary>
bool HasLiveDemand(DataRealm realm, string localIdentifier) => true;
}