fix(grpc-data): maxAge=0 projected reads served from an awaited origin read; origin refusals are access denials; Write/CreateMonitoredItems renew lapsed leases (#938, #939, #940)
#938: OtOpcUaNodeManager implements IReadAsyncNodeManager. A projected Value read whose maxAge the cache cannot satisfy (0 always: Part 4 "read the source"; ScadaBridge's DCL and the Client CLI send 0) is served from IProjectedDataAccess.ReadNowAsync in the same request — same unary admission, authenticated freshness-checked read and cache publication as ScheduleRead, pumped through the unary budget, at most 5 s / request deadline − 250 ms, no Lock, no blocked thread. A lapsed lease is renewed first and read in the same request. Previously every maxAge=0 read answered BadWaitingForInitialData forever. #939: RemoteNamespaceResolver.RenewExactOutcomeAsync reports Renewed/Refused/Failed. Refused only for the origin's verdict (PERMISSION_DENIED call, Denied item, Metadata not granted, operation not granted / not writable) ⇒ BadUserAccessDenied, held 5 s per node+operation unsent; transport and other failures stay retryable. HistoryRead follows it. #940: RenewLapsed accepts Write (gated on the local write role) and Subscribe. WriteAsync awaits the renewal (≤ 4 s, ≤ half the timeout hint) then dispatches, BadResourceUnavailable unsent otherwise. CreateMonitoredItems awaits renewals once per request (ICreateMonitoredItemsAsyncNodeManager) and classifies each projected item PER ITEM outside Lock (lapse ⇒ BadResourceUnavailable, refusal ⇒ BadUserAccessDenied) — a refusal thrown from the item manager used to fault the whole request. Red/green: 15 wire tests in GrpcDataProjectedOriginAccessWireTests (12 red on the pre-fix source, controls green both ways); 4 existing tests updated where the first read is now Good. Evidence: docs/plans/evidence/grpc-data-ext/938-939-940-948.md.
This commit is contained in:
@@ -35,14 +35,24 @@ continuations must still match current authority, catalog and serving generation
|
||||
|
||||
A projected Value Read first acquires a current scoped demand. A cached sample can be returned
|
||||
only when its proof, serving identity, projection generation and age satisfy the request.
|
||||
`maxAge=0`, a missing sample or an unsuitable sample schedules an asynchronous bounded remote
|
||||
read and returns `BadWaitingForInitialData`; it does not block the SDK callback on the network.
|
||||
The response refreshes the local cache for a later Read. The origin's own local Read remains a
|
||||
cached read rather than a device poll.
|
||||
**Since #938** a `maxAge` the cache cannot satisfy — `maxAge=0` always (Part 4: read the source),
|
||||
a missing sample or an unsuitable one — is served from a bounded origin read **in the same
|
||||
request**: the node manager's async Read (`IReadAsyncNodeManager`, no node-manager `Lock` held, no
|
||||
request thread blocked) reads the origin, serves what it read and publishes it to the cache. The
|
||||
wait is at most 5 s per request (`OtOpcUaNodeManager.ProjectedOriginReadWait`), less the request
|
||||
deadline's margin; the reads are admitted against the same unary budget as before (the default
|
||||
1 MiB `MaxPendingBytes` admits one 1 MiB read at a time) and a batch is pumped through it as reads
|
||||
complete. A read that is not answered in time, or answers nothing servable (unreachable, not
|
||||
ready, older than the mapping's stale timeout), returns `BadWaitingForInitialData` as before; a
|
||||
read never admitted by the deadline is scheduled as before. A lapsed lease is renewed first, in the
|
||||
same request (see [Data connections](DataConnections.md#subscription-freshness-and-exact-item-renewal)).
|
||||
Before #938 `maxAge=0` was never served from the cache and never awaited, so it answered
|
||||
`BadWaitingForInitialData` on every read — which is what ScadaBridge's DCL
|
||||
(`RealOpcUaClient.ReadValuesAsync`, `session.ReadAsync(null, 0, …)`) and the Client CLI default send.
|
||||
The origin's own local Read remains a cached read rather than a device poll.
|
||||
|
||||
For explicit cached reads, the CLI accepts `read --max-age 5000` (milliseconds).
|
||||
Its default remains zero. A cold projection can still return pending; retry after
|
||||
the bounded refresh completes. This matches the [OPC UA Read age parameter](https://reference.opcfoundation.org/specs/OPC-10000-4/5.11.2);
|
||||
For explicit cached reads, the CLI accepts `read --max-age 5000` (milliseconds); its default is
|
||||
zero. This matches the [OPC UA Read age parameter](https://reference.opcfoundation.org/specs/OPC-10000-4/5.11.2);
|
||||
it does not extend a mapping's authority lease or allowed origin-sample age.
|
||||
|
||||
Projected data-change monitored items acquire live demands and share compatible upstream
|
||||
|
||||
Reference in New Issue
Block a user