/** * @module node-opcua-server * * What a session receives of a value a node gives without a session: the change notifications * (value_changed, semantic_changed, the attribute events) carry no session, so before a * subscription hands such a value to the session of an item, it asks the OWNER of the node what a * Read gives that session. The owner is the node itself for a node object, the store for a compact * view, the engine for a stand-in of a node another thread owns. Nothing here reads the fields of * the node (rolePermissions, accessRestrictions, namespace): a view or a stand-in carries none. */ import type { ISessionContext } from "node-opcua-address-space"; import type { AttributeIds } from "node-opcua-data-model"; import { DataValue } from "node-opcua-data-value"; import type { NumericRange } from "node-opcua-numeric-range"; import { type StatusCode } from "node-opcua-status-code"; /** how the owner of a Variable answers what a Read of its Value gives a session: one of these */ export interface ValueReadOwner { /** * the status a Read of the Value gives `context`, at once, without reading the value: Good or the * status a Read returns in place of the value. UAVariable (the node itself) and StoreVariableView * (the store) answer this. */ readValueStatus?(context: ISessionContext): StatusCode; /** * the value as the owner reads it for `context`: a stand-in for a node another thread owns * (RemoteObjectNode), whose owner answers later. */ readValueForSession?(context: ISessionContext, callback: (err: Error | null, dataValue?: DataValue) => void): void; /** * true when every value the node emits was already read for the session of the one item it serves * (FrontMonitoredNode: its owner, the store, tells it which values every session may read; it reads * the others again in the session of its item). */ readonly emitsSessionValues?: boolean; } /** the DataValue a session receives in place of a value it may not read, stamped as a Read stamps it */ export declare function refusedDataValue(status: StatusCode): DataValue; /** * the status a Read of the Value of `node` gives `context`, when the owner answers at once; undefined * when only a read through the owner can tell (see valueForSession). * * - an in-process context (no session) is always given the value: Good; * - a node whose owner cannot answer is refused (BadUserAccessDenied): a value reaches a session only * once the owner of the node has said that a Read gives it. */ export declare function valueReadStatus(node: ValueReadOwner | null | undefined, context: ISessionContext | null): StatusCode | undefined; /** * hands `deliver` what a Read of the Value of `node` gives `context`, for a value the node gave with no * session: the value itself when the session may read it, a stamped refusal in its place when it may not, * the value the owner reads for the session when only the owner can tell (then `deliver` is called later, * and only if `isLive(generation)` still holds: `generation` is the caller's, when the read started). `value` is a DataValue, or a function that reads it, called only * when the value is handed out: a refused session costs no read. `indexRange` (the range a write touched) * is passed on to `deliver` with the value, so that a caller needs no closure per change. * * Synchronous for a node object and a compact view: the change paths of a subscription stay as fast as * before, the value is not read again when only the status is needed. */ export declare function valueForSession(node: ValueReadOwner | null | undefined, context: ISessionContext | null, value: DataValue | (() => DataValue), indexRange: NumericRange | null | undefined, deliver: (dataValue: DataValue, indexRange?: NumericRange | null) => void, isLive: (generation: number) => boolean, generation?: number): void; /** a node whose attributes a Read gives in the context of a session */ export interface AttributeReadOwner { readAttribute(context: ISessionContext | null, attributeId: AttributeIds, indexRange?: NumericRange | null): DataValue; } /** * what a Read of a non-Value attribute of `node` gives `context`, for an attribute value the node emitted * with no session: read again by the node in the context of the session (the Browse check of its owner); * an in-process context keeps the emitted value. */ export declare function attributeForSession(node: AttributeReadOwner | null | undefined, context: ISessionContext | null, attributeId: AttributeIds, emitted: DataValue): DataValue; //# sourceMappingURL=value_for_session.d.ts.map