@zlink-systems/framework 0.30.0 → 0.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +150 -68
- package/dist/.tsbuildinfo +1 -1
- package/dist/contracts/Actors/ZLinkActorClient.d.ts +2 -1
- package/dist/contracts/Channels/Calls.d.ts +2 -1
- package/dist/contracts/Common/ZLinkMessageMetadata.js +11 -5
- package/dist/contracts/Handlers/Attributes.d.ts +5 -13
- package/dist/contracts/Handlers/Attributes.js +7 -11
- package/dist/contracts/Handlers/JsonContract.d.ts +2 -46
- package/dist/contracts/Handlers/JsonContract.js +4 -153
- package/dist/contracts/Spots/Contracts.d.ts +2 -1
- package/dist/nest-integration.d.ts +1 -1
- package/dist/nest-integration.js +2 -1
- package/dist/runtime/actors/actor-client.d.ts +1 -1
- package/dist/runtime/actors/actor-client.js +14 -12
- package/dist/runtime/actors/actor-handoff.d.ts +1 -1
- package/dist/runtime/actors/actor-handoff.js +7 -4
- package/dist/runtime/actors/actor-join-relocation.d.ts +1 -0
- package/dist/runtime/actors/actor-local-native-join.js +9 -12
- package/dist/runtime/actors/actor-remote-wire.js +15 -0
- package/dist/runtime/actors/actor-routed-join-transport.d.ts +6 -2
- package/dist/runtime/actors/actor-routed-json-request.d.ts +2 -0
- package/dist/runtime/actors/index.d.ts +2 -1
- package/dist/runtime/actors/index.js +18 -6
- package/dist/runtime/actors/spot-actor-dispatch.js +2 -2
- package/dist/runtime/admission.d.ts +1 -1
- package/dist/runtime/admission.js +15 -5
- package/dist/runtime/application-jobs/application-ingress-record-owner.d.ts +6 -8
- package/dist/runtime/application-jobs/application-ingress-record-owner.js +39 -22
- package/dist/runtime/application-jobs/application-job-queue-scope.d.ts +2 -1
- package/dist/runtime/application-jobs/application-job-queue-scope.js +37 -22
- package/dist/runtime/application-jobs/contracts.d.ts +10 -1
- package/dist/runtime/backend/contracts/index.d.ts +18 -9
- package/dist/runtime/backend/mesh-completion-table.d.ts +9 -1
- package/dist/runtime/backend/mesh-completion-table.js +149 -49
- package/dist/runtime/backend/mesh-dispatch-pump.d.ts +3 -0
- package/dist/runtime/backend/mesh-dispatch-pump.js +32 -11
- package/dist/runtime/backend/node/node-backend-adapter-support.d.ts +2 -2
- package/dist/runtime/backend/node/node-backend-adapter-support.js +16 -9
- package/dist/runtime/backend/node/node-dealer-channel-client-transport.d.ts +1 -1
- package/dist/runtime/backend/node/node-dealer-channel-client-transport.js +5 -2
- package/dist/runtime/backend/node/node-raw-binding-port.js +42 -22
- package/dist/runtime/backend/node/node-raw-mesh-backend.d.ts +13 -5
- package/dist/runtime/backend/node/node-raw-mesh-backend.js +69 -51
- package/dist/runtime/backend/node/node-socket-backend-adapter.js +6 -6
- package/dist/runtime/backend/raw-binding-port.d.ts +2 -2
- package/dist/runtime/backend/runtime-message.d.ts +1 -0
- package/dist/runtime/backend/runtime-message.js +5 -0
- package/dist/runtime/backend/runtime-values.d.ts +1 -0
- package/dist/runtime/backend/runtime-values.js +2 -1
- package/dist/runtime/channels/channel-clients.d.ts +1 -0
- package/dist/runtime/channels/channel-clients.js +58 -21
- package/dist/runtime/channels/channel-dispatch-pipeline.d.ts +3 -2
- package/dist/runtime/channels/channel-dispatch-pipeline.js +20 -11
- package/dist/runtime/channels/channel-dispatch-services.d.ts +1 -0
- package/dist/runtime/channels/channel-dispatch-services.js +45 -0
- package/dist/runtime/channels/channel-dispatchers.d.ts +1 -1
- package/dist/runtime/channels/channel-dispatchers.js +27 -26
- package/dist/runtime/channels/channel-envelope-inspection.d.ts +1 -2
- package/dist/runtime/channels/channel-envelope-inspection.js +1 -16
- package/dist/runtime/channels/channel-envelope.d.ts +1 -0
- package/dist/runtime/channels/channel-envelope.js +83 -8
- package/dist/runtime/channels/channel-outbound-operations.d.ts +2 -2
- package/dist/runtime/channels/channel-outbound-operations.js +8 -8
- package/dist/runtime/channels/channel-runtime-manager.d.ts +6 -6
- package/dist/runtime/channels/channel-runtime-manager.js +12 -12
- package/dist/runtime/channels/channel-transports.d.ts +18 -15
- package/dist/runtime/channels/channel-transports.js +48 -31
- package/dist/runtime/channels/local-spot-route-transport.d.ts +1 -1
- package/dist/runtime/channels/local-spot-route-transport.js +2 -1
- package/dist/runtime/channels/router-socket-spot-route-transport.d.ts +2 -2
- package/dist/runtime/channels/router-socket-spot-route-transport.js +4 -4
- package/dist/runtime/channels/source-spot-router.d.ts +2 -2
- package/dist/runtime/channels/source-spot-router.js +4 -4
- package/dist/runtime/channels/spot-node-route-transport.d.ts +2 -2
- package/dist/runtime/channels/spot-node-route-transport.js +4 -4
- package/dist/runtime/channels/spot-route-bridge-transport.d.ts +2 -2
- package/dist/runtime/channels/spot-route-bridge-transport.js +4 -4
- package/dist/runtime/channels/spot-route-dispatch-strategy.d.ts +5 -4
- package/dist/runtime/channels/spot-route-dispatch-strategy.js +18 -18
- package/dist/runtime/execution/serial-execution-queue.d.ts +1 -0
- package/dist/runtime/execution/serial-execution-queue.js +1 -0
- package/dist/runtime/foundation/actor-join-recovery-codec.js +2 -2
- package/dist/runtime/foundation/durable-service-request.d.ts +14 -0
- package/dist/runtime/foundation/durable-service-request.js +98 -0
- package/dist/runtime/foundation/operation-identity.d.ts +1 -0
- package/dist/runtime/foundation/operation-identity.js +5 -1
- package/dist/runtime/foundation/raw-service-mesh-runtime.d.ts +22 -5
- package/dist/runtime/foundation/raw-service-mesh-runtime.js +356 -232
- package/dist/runtime/foundation/service-relocation-object-owner.d.ts +1 -0
- package/dist/runtime/foundation/service-relocation-object-owner.js +1 -0
- package/dist/runtime/foundation/service-relocation-runtime.d.ts +2 -0
- package/dist/runtime/foundation/service-relocation-runtime.js +13 -1
- package/dist/runtime/foundation/service-runtime-contracts.d.ts +2 -0
- package/dist/runtime/foundation/service-stateful-runtime.d.ts +4 -4
- package/dist/runtime/foundation/service-stateful-runtime.js +44 -103
- package/dist/runtime/foundation/service-stateful-wire-codec.d.ts +0 -5
- package/dist/runtime/foundation/service-topology-registry.d.ts +12 -2
- package/dist/runtime/foundation/service-topology-registry.js +61 -27
- package/dist/runtime/foundation/service-wire-m6a-codec.d.ts +3 -3
- package/dist/runtime/foundation/service-wire-m6a-codec.js +36 -38
- package/dist/runtime/handlers/handler-instance-scope.d.ts +8 -0
- package/dist/runtime/handlers/handler-instance-scope.js +54 -11
- package/dist/runtime/host/actor-runtime-options-factory.js +2 -2
- package/dist/runtime/host/application-job-queue.d.ts +19 -7
- package/dist/runtime/host/application-job-queue.js +150 -42
- package/dist/runtime/host/entry-actor-runtime.d.ts +1 -0
- package/dist/runtime/host/entry-actor-runtime.js +3 -0
- package/dist/runtime/host/index.d.ts +7 -1
- package/dist/runtime/host/index.js +142 -118
- package/dist/runtime/host/remote-bound-session-relay.js +2 -18
- package/dist/runtime/host/route-mesh-runtime.js +1 -1
- package/dist/runtime/host/service-relocation-control.d.ts +1 -0
- package/dist/runtime/host/service-relocation-control.js +10 -4
- package/dist/runtime/host/service-relocation-host-runtime.d.ts +6 -8
- package/dist/runtime/host/service-relocation-host-runtime.js +213 -241
- package/dist/runtime/host/spot-address-transport.js +3 -2
- package/dist/runtime/host/spot-runtime-options-factory.js +1 -0
- package/dist/runtime/locations/actor-location-claims.d.ts +2 -2
- package/dist/runtime/locations/actor-location-claims.js +34 -19
- package/dist/runtime/locations/lifecycle.d.ts +1 -2
- package/dist/runtime/locations/lifecycle.js +2 -5
- package/dist/runtime/locations/runtime.d.ts +1 -1
- package/dist/runtime/locations/runtime.js +24 -23
- package/dist/runtime/messaging/framework-json-v1.d.ts +4 -6
- package/dist/runtime/messaging/framework-json-v1.js +38 -294
- package/dist/runtime/messaging/packet-name.d.ts +1 -1
- package/dist/runtime/messaging/packet-name.js +8 -24
- package/dist/runtime/messaging/request-result.d.ts +2 -0
- package/dist/runtime/messaging/request-result.js +54 -0
- package/dist/runtime/messaging/submission-result.d.ts +1 -0
- package/dist/runtime/messaging/submission-result.js +5 -2
- package/dist/runtime/protocol/service_wire_codec.generated.d.ts +15 -0
- package/dist/runtime/protocol/service_wire_codec.generated.js +144 -0
- package/dist/runtime/protocol/service_wire_pilot_codec.generated.d.ts +9 -0
- package/dist/runtime/protocol/service_wire_pilot_codec.generated.js +14 -1
- package/dist/runtime/spots/formal-remote-actor-admission-registry.d.ts +7 -2
- package/dist/runtime/spots/formal-remote-actor-admission-registry.js +33 -19
- package/dist/runtime/spots/index.d.ts +3 -0
- package/dist/runtime/spots/index.js +9 -2
- package/dist/runtime/spots/spot-activation.d.ts +1 -0
- package/dist/runtime/spots/spot-activation.js +17 -8
- package/dist/runtime/spots/spot-entry-activation.js +6 -2
- package/dist/runtime/spots/spot-handler-registry.d.ts +3 -1
- package/dist/runtime/spots/spot-handler-registry.js +18 -8
- package/dist/runtime/spots/spot-node-autoconnect.js +4 -3
- package/dist/runtime/spots/spot-outbound.d.ts +3 -0
- package/dist/runtime/spots/spot-outbound.js +24 -15
- package/dist/runtime/spots/spot-routed-spot-packet-dispatch.d.ts +1 -0
- package/dist/runtime/spots/spot-routed-spot-packet-dispatch.js +1 -1
- package/dist/runtime/spots/spot-runtime-ports.d.ts +1 -0
- package/dist/runtime/spots/spot-subscription-dispatch.js +0 -3
- package/dist/runtime/spots/spot-timer.js +1 -0
- package/dist/runtime/streams/stream-session-runtime.d.ts +1 -1
- package/dist/runtime/streams/stream-session-runtime.js +13 -27
- package/package.json +2 -2
- package/src/contracts/Actors/ZLinkActorClient.ts +2 -1
- package/src/contracts/Channels/Calls.ts +2 -1
- package/src/contracts/Common/ZLinkMessageMetadata.ts +13 -8
- package/src/contracts/Handlers/Attributes.ts +14 -21
- package/src/contracts/Handlers/JsonContract.ts +8 -216
- package/src/contracts/Spots/Contracts.ts +2 -1
- package/src/nest-integration.ts +1 -0
- package/src/runtime/actors/actor-client.ts +40 -16
- package/src/runtime/actors/actor-handoff.ts +9 -4
- package/src/runtime/actors/actor-join-relocation.ts +1 -0
- package/src/runtime/actors/actor-local-native-join.ts +17 -26
- package/src/runtime/actors/actor-remote-wire.ts +17 -0
- package/src/runtime/actors/actor-routed-join-transport.ts +14 -4
- package/src/runtime/actors/actor-routed-json-request.ts +10 -2
- package/src/runtime/actors/index.ts +19 -5
- package/src/runtime/actors/spot-actor-dispatch.ts +4 -2
- package/src/runtime/admission.ts +18 -5
- package/src/runtime/application-jobs/application-ingress-record-owner.ts +41 -25
- package/src/runtime/application-jobs/application-job-queue-scope.ts +51 -22
- package/src/runtime/application-jobs/contracts.ts +14 -1
- package/src/runtime/backend/contracts/index.ts +53 -14
- package/src/runtime/backend/mesh-completion-table.ts +156 -57
- package/src/runtime/backend/mesh-dispatch-pump.ts +40 -10
- package/src/runtime/backend/node/node-backend-adapter-support.ts +17 -8
- package/src/runtime/backend/node/node-dealer-channel-client-transport.ts +12 -2
- package/src/runtime/backend/node/node-raw-binding-port.ts +57 -30
- package/src/runtime/backend/node/node-raw-mesh-backend.ts +128 -65
- package/src/runtime/backend/node/node-socket-backend-adapter.ts +21 -6
- package/src/runtime/backend/raw-binding-port.ts +7 -2
- package/src/runtime/backend/runtime-message.ts +6 -0
- package/src/runtime/backend/runtime-values.ts +1 -0
- package/src/runtime/channels/channel-clients.ts +90 -41
- package/src/runtime/channels/channel-dispatch-pipeline.ts +69 -34
- package/src/runtime/channels/channel-dispatch-services.ts +69 -1
- package/src/runtime/channels/channel-dispatchers.ts +29 -27
- package/src/runtime/channels/channel-envelope-inspection.ts +2 -16
- package/src/runtime/channels/channel-envelope.ts +133 -8
- package/src/runtime/channels/channel-outbound-operations.ts +22 -8
- package/src/runtime/channels/channel-runtime-manager.ts +29 -12
- package/src/runtime/channels/channel-transports.ts +128 -60
- package/src/runtime/channels/local-spot-route-transport.ts +3 -1
- package/src/runtime/channels/router-socket-spot-route-transport.ts +13 -4
- package/src/runtime/channels/source-spot-router.ts +8 -4
- package/src/runtime/channels/spot-node-route-transport.ts +8 -4
- package/src/runtime/channels/spot-route-bridge-transport.ts +6 -4
- package/src/runtime/channels/spot-route-dispatch-strategy.ts +47 -18
- package/src/runtime/execution/serial-execution-queue.ts +2 -0
- package/src/runtime/foundation/actor-join-recovery-codec.ts +2 -2
- package/src/runtime/foundation/durable-service-request.ts +137 -0
- package/src/runtime/foundation/operation-identity.ts +5 -1
- package/src/runtime/foundation/raw-service-mesh-runtime.ts +484 -293
- package/src/runtime/foundation/service-relocation-object-owner.ts +2 -0
- package/src/runtime/foundation/service-relocation-runtime.ts +18 -1
- package/src/runtime/foundation/service-runtime-contracts.ts +7 -1
- package/src/runtime/foundation/service-stateful-runtime.ts +67 -125
- package/src/runtime/foundation/service-stateful-wire-codec.ts +0 -5
- package/src/runtime/foundation/service-topology-registry.ts +91 -36
- package/src/runtime/foundation/service-wire-m6a-codec.ts +57 -38
- package/src/runtime/handlers/handler-instance-scope.ts +67 -16
- package/src/runtime/host/actor-runtime-options-factory.ts +13 -2
- package/src/runtime/host/application-job-queue.ts +175 -41
- package/src/runtime/host/entry-actor-runtime.ts +4 -0
- package/src/runtime/host/index.ts +201 -156
- package/src/runtime/host/remote-bound-session-relay.ts +2 -23
- package/src/runtime/host/route-mesh-runtime.ts +1 -1
- package/src/runtime/host/service-relocation-control.ts +11 -5
- package/src/runtime/host/service-relocation-host-runtime.ts +315 -291
- package/src/runtime/host/spot-address-transport.ts +4 -2
- package/src/runtime/host/spot-runtime-options-factory.ts +2 -0
- package/src/runtime/locations/actor-location-claims.ts +52 -30
- package/src/runtime/locations/lifecycle.ts +8 -26
- package/src/runtime/locations/runtime.ts +28 -24
- package/src/runtime/messaging/framework-json-v1.ts +5 -325
- package/src/runtime/messaging/packet-name.ts +5 -25
- package/src/runtime/messaging/request-result.ts +58 -0
- package/src/runtime/messaging/submission-result.ts +5 -1
- package/src/runtime/protocol/service_wire_codec.generated.ts +131 -1
- package/src/runtime/protocol/service_wire_pilot_codec.generated.ts +4 -4
- package/src/runtime/spots/formal-remote-actor-admission-registry.ts +43 -23
- package/src/runtime/spots/index.ts +14 -2
- package/src/runtime/spots/spot-activation.ts +28 -10
- package/src/runtime/spots/spot-entry-activation.ts +9 -2
- package/src/runtime/spots/spot-handler-registry.ts +41 -8
- package/src/runtime/spots/spot-node-autoconnect.ts +6 -2
- package/src/runtime/spots/spot-outbound.ts +36 -16
- package/src/runtime/spots/spot-routed-spot-packet-dispatch.ts +2 -1
- package/src/runtime/spots/spot-runtime-ports.ts +1 -0
- package/src/runtime/spots/spot-subscription-dispatch.ts +0 -3
- package/src/runtime/spots/spot-timer.ts +5 -1
- package/src/runtime/streams/stream-session-runtime.ts +12 -29
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
import { ZLinkBufferMessage } from '../backend/runtime-message';
|
|
13
13
|
import {
|
|
14
14
|
RequestResult,
|
|
15
|
+
ZLINK_BACKEND_SEND_DONT_WAIT,
|
|
15
16
|
isZLinkBackendResultError,
|
|
16
17
|
type ZLinkBackendMessageLike as MessageLike
|
|
17
18
|
} from '../backend/runtime-values';
|
|
@@ -61,6 +62,8 @@ import {
|
|
|
61
62
|
type ZLinkChannelEnvelopeCodecRegistry
|
|
62
63
|
} from './channel-envelope';
|
|
63
64
|
|
|
65
|
+
const NON_BLOCKING_SEND_OPTIONS = Object.freeze({ flags: ZLINK_BACKEND_SEND_DONT_WAIT });
|
|
66
|
+
|
|
64
67
|
export interface ZLinkChannelClientTransport {
|
|
65
68
|
send(
|
|
66
69
|
channelName: string,
|
|
@@ -74,7 +77,8 @@ export interface ZLinkChannelClientTransport {
|
|
|
74
77
|
request: unknown,
|
|
75
78
|
timeoutMs: number | undefined,
|
|
76
79
|
signal?: AbortSignal,
|
|
77
|
-
metadata?: ReadonlyMap<string, string
|
|
80
|
+
metadata?: ReadonlyMap<string, string>,
|
|
81
|
+
onAdmitted?: () => void
|
|
78
82
|
): Promise<TReply>;
|
|
79
83
|
tryPublish?(
|
|
80
84
|
channelName: string,
|
|
@@ -131,7 +135,8 @@ export interface ZLinkRouteClientTransport {
|
|
|
131
135
|
request: unknown,
|
|
132
136
|
timeoutMs: number | undefined,
|
|
133
137
|
signal?: AbortSignal,
|
|
134
|
-
metadata?: ReadonlyMap<string, string
|
|
138
|
+
metadata?: ReadonlyMap<string, string>,
|
|
139
|
+
onAdmitted?: () => void
|
|
135
140
|
): Promise<TReply>;
|
|
136
141
|
submitToChannel(
|
|
137
142
|
meshName: string,
|
|
@@ -147,7 +152,8 @@ export interface ZLinkRouteClientTransport {
|
|
|
147
152
|
request: unknown,
|
|
148
153
|
timeoutMs: number | undefined,
|
|
149
154
|
signal?: AbortSignal,
|
|
150
|
-
metadata?: ReadonlyMap<string, string
|
|
155
|
+
metadata?: ReadonlyMap<string, string>,
|
|
156
|
+
onAdmitted?: () => void
|
|
151
157
|
): Promise<TReply>;
|
|
152
158
|
sendToSpot?(
|
|
153
159
|
spotRouteTarget: ZLinkSpotRouteTarget,
|
|
@@ -164,6 +170,7 @@ export interface ZLinkRouteClientTransport {
|
|
|
164
170
|
readonly packetName?: string;
|
|
165
171
|
readonly timeoutMs?: number;
|
|
166
172
|
readonly signal?: AbortSignal;
|
|
173
|
+
readonly onAdmitted?: () => void;
|
|
167
174
|
readonly metadata?: ReadonlyMap<string, string>;
|
|
168
175
|
}
|
|
169
176
|
): Promise<TReply>;
|
|
@@ -182,7 +189,8 @@ interface ZLinkChannelTransportRuntime {
|
|
|
182
189
|
request: unknown,
|
|
183
190
|
timeoutMs: number | undefined,
|
|
184
191
|
signal?: AbortSignal,
|
|
185
|
-
metadata?: ReadonlyMap<string, string
|
|
192
|
+
metadata?: ReadonlyMap<string, string>,
|
|
193
|
+
onAdmitted?: () => void
|
|
186
194
|
): Promise<TReply>;
|
|
187
195
|
tryPublish(
|
|
188
196
|
channelName: string,
|
|
@@ -215,7 +223,8 @@ interface ZLinkChannelTransportRuntime {
|
|
|
215
223
|
request: unknown,
|
|
216
224
|
timeoutMs: number | undefined,
|
|
217
225
|
signal?: AbortSignal,
|
|
218
|
-
metadata?: ReadonlyMap<string, string
|
|
226
|
+
metadata?: ReadonlyMap<string, string>,
|
|
227
|
+
onAdmitted?: () => void
|
|
219
228
|
): Promise<TReply>;
|
|
220
229
|
routeSendToSpot(
|
|
221
230
|
spotRouteTarget: ZLinkSpotRouteTarget,
|
|
@@ -236,7 +245,8 @@ interface ZLinkChannelTransportRuntime {
|
|
|
236
245
|
request: unknown,
|
|
237
246
|
timeoutMs: number | undefined,
|
|
238
247
|
signal?: AbortSignal,
|
|
239
|
-
metadata?: ReadonlyMap<string, string
|
|
248
|
+
metadata?: ReadonlyMap<string, string>,
|
|
249
|
+
onAdmitted?: () => void
|
|
240
250
|
): Promise<TReply>;
|
|
241
251
|
routeRequestFromSpotToSpot<TReply>(
|
|
242
252
|
sourceSpot: ZLinkBackendSpot,
|
|
@@ -244,20 +254,23 @@ interface ZLinkChannelTransportRuntime {
|
|
|
244
254
|
packetName: string | undefined,
|
|
245
255
|
request: unknown,
|
|
246
256
|
timeoutMs: number | undefined,
|
|
247
|
-
signal?: AbortSignal
|
|
257
|
+
signal?: AbortSignal,
|
|
258
|
+
onAdmitted?: () => void
|
|
248
259
|
): Promise<TReply>;
|
|
249
260
|
routeRequestRawFromSpotToSpot(
|
|
250
261
|
sourceSpot: ZLinkBackendSpot,
|
|
251
262
|
spotRouteTarget: ZLinkSpotRouteTarget,
|
|
252
263
|
request: Message,
|
|
253
264
|
timeoutMs: number | undefined,
|
|
254
|
-
signal?: AbortSignal
|
|
265
|
+
signal?: AbortSignal,
|
|
266
|
+
onAdmitted?: () => void
|
|
255
267
|
): Promise<readonly Message[]>;
|
|
256
268
|
routeRequestRawToSpot(
|
|
257
269
|
spotRouteTarget: ZLinkSpotRouteTarget,
|
|
258
270
|
request: Message,
|
|
259
271
|
timeoutMs: number | undefined,
|
|
260
|
-
signal?: AbortSignal
|
|
272
|
+
signal?: AbortSignal,
|
|
273
|
+
onAdmitted?: () => void
|
|
261
274
|
): Promise<readonly Message[]>;
|
|
262
275
|
}
|
|
263
276
|
|
|
@@ -269,7 +282,7 @@ export class ZLinkRuntimeRouteTransport implements ZLinkRouteClientTransport {
|
|
|
269
282
|
private readonly meshRuntime:
|
|
270
283
|
| (() =>
|
|
271
284
|
| {
|
|
272
|
-
readonly meshNode
|
|
285
|
+
readonly meshNode?: (meshName: string) => ZLinkBackendMeshNode | undefined;
|
|
273
286
|
readonly meshCompletionTable: (
|
|
274
287
|
meshName: string
|
|
275
288
|
) => ZLinkMeshCompletionTable | undefined;
|
|
@@ -307,40 +320,44 @@ export class ZLinkRuntimeRouteTransport implements ZLinkRouteClientTransport {
|
|
|
307
320
|
);
|
|
308
321
|
}
|
|
309
322
|
|
|
310
|
-
|
|
323
|
+
submit(
|
|
311
324
|
meshName: string,
|
|
312
325
|
targetNodeRid: string,
|
|
313
326
|
packetName: string | undefined,
|
|
314
327
|
message: unknown,
|
|
315
328
|
metadata?: ReadonlyMap<string, string>
|
|
316
|
-
): Promise<ZLinkSubmitResult> {
|
|
329
|
+
): ZLinkSubmitResult | Promise<ZLinkSubmitResult> {
|
|
317
330
|
// Call-scoped flow (spec 27 §4): the envelope flow pair lives only for
|
|
318
331
|
// the duration of this outbound call, never in the caller's context.
|
|
319
|
-
|
|
332
|
+
if (!this.flowCreationEnabled())
|
|
333
|
+
return this.submitNode(meshName, targetNodeRid, packetName, message, metadata, false);
|
|
334
|
+
return runWithOutboundFlow(true, () =>
|
|
320
335
|
this.submitNode(meshName, targetNodeRid, packetName, message, metadata, false)
|
|
321
336
|
);
|
|
322
337
|
}
|
|
323
338
|
|
|
324
|
-
|
|
339
|
+
submitInfrastructure(
|
|
325
340
|
meshName: string,
|
|
326
341
|
targetNodeRid: string,
|
|
327
342
|
packetName: string | undefined,
|
|
328
343
|
message: unknown,
|
|
329
344
|
metadata?: ReadonlyMap<string, string>
|
|
330
|
-
): Promise<ZLinkSubmitResult> {
|
|
331
|
-
|
|
345
|
+
): ZLinkSubmitResult | Promise<ZLinkSubmitResult> {
|
|
346
|
+
if (!this.flowCreationEnabled())
|
|
347
|
+
return this.submitNode(meshName, targetNodeRid, packetName, message, metadata, true);
|
|
348
|
+
return runWithOutboundFlow(true, () =>
|
|
332
349
|
this.submitNode(meshName, targetNodeRid, packetName, message, metadata, true)
|
|
333
350
|
);
|
|
334
351
|
}
|
|
335
352
|
|
|
336
|
-
private
|
|
353
|
+
private submitNode(
|
|
337
354
|
meshName: string,
|
|
338
355
|
targetNodeRid: string,
|
|
339
356
|
packetName: string | undefined,
|
|
340
357
|
message: unknown,
|
|
341
358
|
metadata: ReadonlyMap<string, string> | undefined,
|
|
342
359
|
allowObjectClientTarget: boolean
|
|
343
|
-
): Promise<ZLinkSubmitResult> {
|
|
360
|
+
): ZLinkSubmitResult | Promise<ZLinkSubmitResult> {
|
|
344
361
|
const node = this.meshNode(meshName);
|
|
345
362
|
if (node === undefined) {
|
|
346
363
|
return this.requireManager().routeSubmit(
|
|
@@ -365,22 +382,33 @@ export class ZLinkRuntimeRouteTransport implements ZLinkRouteClientTransport {
|
|
|
365
382
|
undefined,
|
|
366
383
|
metadata
|
|
367
384
|
);
|
|
368
|
-
const
|
|
369
|
-
|
|
370
|
-
|
|
385
|
+
const sourceNodeRid =
|
|
386
|
+
node.routingId ?? (node.status().routingId as unknown as import('../../contracts').RoutingId);
|
|
387
|
+
if (routingIdsEqual(sourceNodeRid, targetNodeRid)) {
|
|
388
|
+
return this.submitLocalNode(meshName, String(sourceNodeRid), parts);
|
|
371
389
|
}
|
|
372
390
|
if (
|
|
373
|
-
|
|
374
|
-
this.
|
|
391
|
+
this.manualNodeTarget?.(meshName, targetNodeRid) === false &&
|
|
392
|
+
!this.isKnownBackendPeer(node, targetNodeRid)
|
|
375
393
|
) {
|
|
376
394
|
return { status: ZLinkSubmitStatus.TargetNotFound };
|
|
377
395
|
}
|
|
378
396
|
try {
|
|
379
|
-
|
|
380
|
-
|
|
397
|
+
const submitted = node.sendToNode(
|
|
398
|
+
toBackendRoutingId(targetNodeRid),
|
|
399
|
+
parts,
|
|
400
|
+
NON_BLOCKING_SEND_OPTIONS
|
|
381
401
|
);
|
|
402
|
+
return submitted instanceof Promise
|
|
403
|
+
? submitted.then(mapMeshSubmitResult, (error) => {
|
|
404
|
+
throw mapMeshSubmissionError(
|
|
405
|
+
error,
|
|
406
|
+
`MeshNode '${meshName}' send to node '${targetNodeRid}'`
|
|
407
|
+
);
|
|
408
|
+
})
|
|
409
|
+
: mapMeshSubmitResult(submitted);
|
|
382
410
|
} catch (error) {
|
|
383
|
-
throw mapMeshSubmissionError(error,
|
|
411
|
+
throw mapMeshSubmissionError(error, `MeshNode '${meshName}' send to node '${targetNodeRid}'`);
|
|
384
412
|
}
|
|
385
413
|
}
|
|
386
414
|
|
|
@@ -391,9 +419,21 @@ export class ZLinkRuntimeRouteTransport implements ZLinkRouteClientTransport {
|
|
|
391
419
|
request: unknown,
|
|
392
420
|
timeoutMs: number | undefined,
|
|
393
421
|
signal?: AbortSignal,
|
|
394
|
-
metadata?: ReadonlyMap<string, string
|
|
422
|
+
metadata?: ReadonlyMap<string, string>,
|
|
423
|
+
onAdmitted?: () => void
|
|
395
424
|
): Promise<TReply> {
|
|
396
|
-
|
|
425
|
+
if (!this.flowCreationEnabled())
|
|
426
|
+
return this.requestScoped<TReply>(
|
|
427
|
+
meshName,
|
|
428
|
+
targetNodeRid,
|
|
429
|
+
packetName,
|
|
430
|
+
request,
|
|
431
|
+
timeoutMs,
|
|
432
|
+
signal,
|
|
433
|
+
metadata,
|
|
434
|
+
onAdmitted
|
|
435
|
+
);
|
|
436
|
+
return runWithOutboundFlow(true, () =>
|
|
397
437
|
this.requestScoped<TReply>(
|
|
398
438
|
meshName,
|
|
399
439
|
targetNodeRid,
|
|
@@ -401,7 +441,8 @@ export class ZLinkRuntimeRouteTransport implements ZLinkRouteClientTransport {
|
|
|
401
441
|
request,
|
|
402
442
|
timeoutMs,
|
|
403
443
|
signal,
|
|
404
|
-
metadata
|
|
444
|
+
metadata,
|
|
445
|
+
onAdmitted
|
|
405
446
|
)
|
|
406
447
|
);
|
|
407
448
|
}
|
|
@@ -413,7 +454,8 @@ export class ZLinkRuntimeRouteTransport implements ZLinkRouteClientTransport {
|
|
|
413
454
|
request: unknown,
|
|
414
455
|
timeoutMs: number | undefined,
|
|
415
456
|
signal?: AbortSignal,
|
|
416
|
-
metadata?: ReadonlyMap<string, string
|
|
457
|
+
metadata?: ReadonlyMap<string, string>,
|
|
458
|
+
onAdmitted?: () => void
|
|
417
459
|
): Promise<TReply> {
|
|
418
460
|
const node = this.meshNode(meshName);
|
|
419
461
|
if (node === undefined) {
|
|
@@ -424,7 +466,8 @@ export class ZLinkRuntimeRouteTransport implements ZLinkRouteClientTransport {
|
|
|
424
466
|
request,
|
|
425
467
|
timeoutMs,
|
|
426
468
|
signal,
|
|
427
|
-
metadata
|
|
469
|
+
metadata,
|
|
470
|
+
onAdmitted
|
|
428
471
|
);
|
|
429
472
|
}
|
|
430
473
|
const correlationId = newChannelCorrelationId();
|
|
@@ -453,6 +496,7 @@ export class ZLinkRuntimeRouteTransport implements ZLinkRouteClientTransport {
|
|
|
453
496
|
(remainingTimeoutMs) => {
|
|
454
497
|
const operationId = node.requestToNode(toBackendRoutingId(targetNodeRid), parts, {
|
|
455
498
|
flags: 1,
|
|
499
|
+
onAdmitted,
|
|
456
500
|
timeoutMs: remainingTimeoutMs
|
|
457
501
|
});
|
|
458
502
|
this.traceNodeRequest(
|
|
@@ -546,7 +590,7 @@ export class ZLinkRuntimeRouteTransport implements ZLinkRouteClientTransport {
|
|
|
546
590
|
const operation = `MeshNode '${meshName}' send to channel '${channelName}'`;
|
|
547
591
|
try {
|
|
548
592
|
const result = mapMeshSubmitResult(
|
|
549
|
-
await node.sendToChannel(channelName, parts,
|
|
593
|
+
await node.sendToChannel(channelName, parts, NON_BLOCKING_SEND_OPTIONS)
|
|
550
594
|
);
|
|
551
595
|
if (result.status === ZLinkSubmitStatus.TargetNotFound) {
|
|
552
596
|
this.metrics?.recordChannelSelectionFailure(meshName, channelName, 'no_ready_target');
|
|
@@ -564,9 +608,21 @@ export class ZLinkRuntimeRouteTransport implements ZLinkRouteClientTransport {
|
|
|
564
608
|
request: unknown,
|
|
565
609
|
timeoutMs: number | undefined,
|
|
566
610
|
signal?: AbortSignal,
|
|
567
|
-
metadata?: ReadonlyMap<string, string
|
|
611
|
+
metadata?: ReadonlyMap<string, string>,
|
|
612
|
+
onAdmitted?: () => void
|
|
568
613
|
): Promise<TReply> {
|
|
569
|
-
|
|
614
|
+
if (!this.flowCreationEnabled())
|
|
615
|
+
return this.requestToChannelScoped<TReply>(
|
|
616
|
+
meshName,
|
|
617
|
+
channelName,
|
|
618
|
+
packetName,
|
|
619
|
+
request,
|
|
620
|
+
timeoutMs,
|
|
621
|
+
signal,
|
|
622
|
+
metadata,
|
|
623
|
+
onAdmitted
|
|
624
|
+
);
|
|
625
|
+
return runWithOutboundFlow(true, () =>
|
|
570
626
|
this.requestToChannelScoped<TReply>(
|
|
571
627
|
meshName,
|
|
572
628
|
channelName,
|
|
@@ -574,7 +630,8 @@ export class ZLinkRuntimeRouteTransport implements ZLinkRouteClientTransport {
|
|
|
574
630
|
request,
|
|
575
631
|
timeoutMs,
|
|
576
632
|
signal,
|
|
577
|
-
metadata
|
|
633
|
+
metadata,
|
|
634
|
+
onAdmitted
|
|
578
635
|
)
|
|
579
636
|
);
|
|
580
637
|
}
|
|
@@ -586,7 +643,8 @@ export class ZLinkRuntimeRouteTransport implements ZLinkRouteClientTransport {
|
|
|
586
643
|
request: unknown,
|
|
587
644
|
timeoutMs: number | undefined,
|
|
588
645
|
signal?: AbortSignal,
|
|
589
|
-
metadata?: ReadonlyMap<string, string
|
|
646
|
+
metadata?: ReadonlyMap<string, string>,
|
|
647
|
+
onAdmitted?: () => void
|
|
590
648
|
): Promise<TReply> {
|
|
591
649
|
throwIfAborted(signal);
|
|
592
650
|
const node = this.requireMeshNode(meshName);
|
|
@@ -606,7 +664,11 @@ export class ZLinkRuntimeRouteTransport implements ZLinkRouteClientTransport {
|
|
|
606
664
|
signal,
|
|
607
665
|
`MeshNode '${meshName}' request to channel '${channelName}'`,
|
|
608
666
|
(remainingTimeoutMs) =>
|
|
609
|
-
node.requestToChannel(channelName, parts, {
|
|
667
|
+
node.requestToChannel(channelName, parts, {
|
|
668
|
+
flags: 1,
|
|
669
|
+
timeoutMs: remainingTimeoutMs,
|
|
670
|
+
onAdmitted
|
|
671
|
+
})
|
|
610
672
|
);
|
|
611
673
|
const reply = this.decodeMeshReply<TReply>(meshName, completion);
|
|
612
674
|
metric?.complete('completed');
|
|
@@ -767,7 +829,8 @@ export class ZLinkRuntimeRouteTransport implements ZLinkRouteClientTransport {
|
|
|
767
829
|
request,
|
|
768
830
|
options.timeoutMs,
|
|
769
831
|
options.signal,
|
|
770
|
-
options.metadata
|
|
832
|
+
options.metadata,
|
|
833
|
+
options.onAdmitted
|
|
771
834
|
);
|
|
772
835
|
}
|
|
773
836
|
throwIfAborted(options.signal);
|
|
@@ -790,7 +853,8 @@ export class ZLinkRuntimeRouteTransport implements ZLinkRouteClientTransport {
|
|
|
790
853
|
options.timeoutMs,
|
|
791
854
|
undefined,
|
|
792
855
|
options.metadata,
|
|
793
|
-
options.instanceSpot
|
|
856
|
+
options.instanceSpot,
|
|
857
|
+
options.onAdmitted
|
|
794
858
|
)
|
|
795
859
|
: node
|
|
796
860
|
.entrySpot()
|
|
@@ -801,6 +865,7 @@ export class ZLinkRuntimeRouteTransport implements ZLinkRouteClientTransport {
|
|
|
801
865
|
encoded,
|
|
802
866
|
{
|
|
803
867
|
flags: 1,
|
|
868
|
+
onAdmitted: options.onAdmitted,
|
|
804
869
|
timeoutMs: options.timeoutMs,
|
|
805
870
|
routeFence: directSpotRouteFence(spotRouteTarget),
|
|
806
871
|
entrySpot: spotRouteTarget.spotKind === ZLinkSpotKind.Entry
|
|
@@ -825,6 +890,7 @@ export class ZLinkRuntimeRouteTransport implements ZLinkRouteClientTransport {
|
|
|
825
890
|
readonly packetName?: string;
|
|
826
891
|
readonly timeoutMs?: number;
|
|
827
892
|
readonly signal?: AbortSignal;
|
|
893
|
+
readonly onAdmitted?: () => void;
|
|
828
894
|
}
|
|
829
895
|
): Promise<TReply> {
|
|
830
896
|
return this.requireManager().routeRequestFromSpotToSpot<TReply>(
|
|
@@ -833,7 +899,8 @@ export class ZLinkRuntimeRouteTransport implements ZLinkRouteClientTransport {
|
|
|
833
899
|
options.packetName,
|
|
834
900
|
request,
|
|
835
901
|
options.timeoutMs,
|
|
836
|
-
options.signal
|
|
902
|
+
options.signal,
|
|
903
|
+
options.onAdmitted
|
|
837
904
|
);
|
|
838
905
|
}
|
|
839
906
|
|
|
@@ -841,21 +908,30 @@ export class ZLinkRuntimeRouteTransport implements ZLinkRouteClientTransport {
|
|
|
841
908
|
sourceSpot: ZLinkBackendSpot,
|
|
842
909
|
spotRouteTarget: ZLinkSpotRouteTarget,
|
|
843
910
|
request: Message,
|
|
844
|
-
options: {
|
|
911
|
+
options: {
|
|
912
|
+
readonly timeoutMs?: number;
|
|
913
|
+
readonly signal?: AbortSignal;
|
|
914
|
+
readonly onAdmitted?: () => void;
|
|
915
|
+
}
|
|
845
916
|
): Promise<readonly Message[]> {
|
|
846
917
|
return this.requireManager().routeRequestRawFromSpotToSpot(
|
|
847
918
|
sourceSpot,
|
|
848
919
|
spotRouteTarget,
|
|
849
920
|
request,
|
|
850
921
|
options.timeoutMs,
|
|
851
|
-
options.signal
|
|
922
|
+
options.signal,
|
|
923
|
+
options.onAdmitted
|
|
852
924
|
);
|
|
853
925
|
}
|
|
854
926
|
|
|
855
927
|
requestRawToSpot(
|
|
856
928
|
spotRouteTarget: ZLinkSpotRouteTarget,
|
|
857
929
|
request: Message,
|
|
858
|
-
options: {
|
|
930
|
+
options: {
|
|
931
|
+
readonly timeoutMs?: number;
|
|
932
|
+
readonly signal?: AbortSignal;
|
|
933
|
+
readonly onAdmitted?: () => void;
|
|
934
|
+
}
|
|
859
935
|
): Promise<readonly Message[]> {
|
|
860
936
|
return runWithOutboundFlow(this.flowCreationEnabled(), () =>
|
|
861
937
|
this.requestRawToSpotScoped(spotRouteTarget, request, options)
|
|
@@ -865,7 +941,11 @@ export class ZLinkRuntimeRouteTransport implements ZLinkRouteClientTransport {
|
|
|
865
941
|
private async requestRawToSpotScoped(
|
|
866
942
|
spotRouteTarget: ZLinkSpotRouteTarget,
|
|
867
943
|
request: Message,
|
|
868
|
-
options: {
|
|
944
|
+
options: {
|
|
945
|
+
readonly timeoutMs?: number;
|
|
946
|
+
readonly signal?: AbortSignal;
|
|
947
|
+
readonly onAdmitted?: () => void;
|
|
948
|
+
}
|
|
869
949
|
): Promise<readonly Message[]> {
|
|
870
950
|
const meshName = spotRouteTarget.routerChannelId;
|
|
871
951
|
const node = this.meshNode(meshName);
|
|
@@ -893,6 +973,7 @@ export class ZLinkRuntimeRouteTransport implements ZLinkRouteClientTransport {
|
|
|
893
973
|
parts,
|
|
894
974
|
{
|
|
895
975
|
flags: 1,
|
|
976
|
+
onAdmitted: options.onAdmitted,
|
|
896
977
|
timeoutMs: options.timeoutMs,
|
|
897
978
|
routeFence: directSpotRouteFence(spotRouteTarget),
|
|
898
979
|
entrySpot: spotRouteTarget.spotKind === ZLinkSpotKind.Entry
|
|
@@ -925,7 +1006,8 @@ export class ZLinkRuntimeRouteTransport implements ZLinkRouteClientTransport {
|
|
|
925
1006
|
spotRouteTarget,
|
|
926
1007
|
request,
|
|
927
1008
|
options.timeoutMs,
|
|
928
|
-
options.signal
|
|
1009
|
+
options.signal,
|
|
1010
|
+
options.onAdmitted
|
|
929
1011
|
);
|
|
930
1012
|
}
|
|
931
1013
|
|
|
@@ -938,21 +1020,7 @@ export class ZLinkRuntimeRouteTransport implements ZLinkRouteClientTransport {
|
|
|
938
1020
|
}
|
|
939
1021
|
|
|
940
1022
|
private meshNode(meshName: string): ZLinkBackendMeshNode | undefined {
|
|
941
|
-
|
|
942
|
-
return (
|
|
943
|
-
runtime as unknown as
|
|
944
|
-
| {
|
|
945
|
-
meshNode?: (meshName: string) => ZLinkBackendMeshNode | undefined;
|
|
946
|
-
}
|
|
947
|
-
| undefined
|
|
948
|
-
)?.meshNode?.(meshName);
|
|
949
|
-
}
|
|
950
|
-
|
|
951
|
-
private isSelfNode(node: ZLinkBackendMeshNode, targetNodeRid: string): boolean {
|
|
952
|
-
return routingIdsEqual(
|
|
953
|
-
node.status().routingId as unknown as import('../../contracts').RoutingId,
|
|
954
|
-
targetNodeRid
|
|
955
|
-
);
|
|
1023
|
+
return this.meshRuntime?.()?.meshNode?.(meshName);
|
|
956
1024
|
}
|
|
957
1025
|
|
|
958
1026
|
private isKnownBackendPeer(node: ZLinkBackendMeshNode, targetNodeRid: string): boolean {
|
|
@@ -32,7 +32,8 @@ export class ZLinkLocalSpotRouteTransport {
|
|
|
32
32
|
packetName: string | undefined,
|
|
33
33
|
request: unknown,
|
|
34
34
|
timeoutMs: number | undefined,
|
|
35
|
-
signal?: AbortSignal
|
|
35
|
+
signal?: AbortSignal,
|
|
36
|
+
onAdmitted?: () => void
|
|
36
37
|
): Promise<TReply> {
|
|
37
38
|
if (this.dispatcher === undefined) {
|
|
38
39
|
throw new ZLinkConfigurationException(
|
|
@@ -41,6 +42,7 @@ export class ZLinkLocalSpotRouteTransport {
|
|
|
41
42
|
}
|
|
42
43
|
const pending = this.dispatcher.request<TReply>(spotId, packetName, request, {
|
|
43
44
|
channelName: routerChannelId,
|
|
45
|
+
onAdmitted,
|
|
44
46
|
signal
|
|
45
47
|
});
|
|
46
48
|
const effectiveTimeoutMs = timeoutMs ?? this.defaultRequestTimeoutMs;
|
|
@@ -31,11 +31,18 @@ export class ZLinkRouterSocketSpotRouteTransport {
|
|
|
31
31
|
codecs: ZLinkChannelEnvelopeCodecRegistry | undefined,
|
|
32
32
|
flags: ZLinkBackendSendFlags,
|
|
33
33
|
timeoutMs: number | undefined,
|
|
34
|
-
signal?: AbortSignal
|
|
34
|
+
signal?: AbortSignal,
|
|
35
|
+
onAdmitted?: () => void
|
|
35
36
|
): Promise<TReply> {
|
|
36
37
|
const router = this.sockets.routeRouter(target.routerChannelId);
|
|
37
38
|
void flags;
|
|
38
|
-
const operation = router.requestToSpot(
|
|
39
|
+
const operation = router.requestToSpot(
|
|
40
|
+
target.targetNodeRid,
|
|
41
|
+
target.spotId,
|
|
42
|
+
parts,
|
|
43
|
+
timeoutMs,
|
|
44
|
+
onAdmitted
|
|
45
|
+
);
|
|
39
46
|
const replyParts = await awaitWithAbort(operation, signal, () => {
|
|
40
47
|
void operation.then(closeMessages, () => undefined);
|
|
41
48
|
});
|
|
@@ -51,14 +58,16 @@ export class ZLinkRouterSocketSpotRouteTransport {
|
|
|
51
58
|
target: ZLinkSpotRouteTarget,
|
|
52
59
|
request: Message,
|
|
53
60
|
timeoutMs: number | undefined,
|
|
54
|
-
signal?: AbortSignal
|
|
61
|
+
signal?: AbortSignal,
|
|
62
|
+
onAdmitted?: () => void
|
|
55
63
|
): Promise<readonly Message[]> {
|
|
56
64
|
const router = this.sockets.routeRouter(target.routerChannelId);
|
|
57
65
|
const operation = router.requestToSpot(
|
|
58
66
|
target.targetNodeRid,
|
|
59
67
|
target.spotId,
|
|
60
68
|
[request],
|
|
61
|
-
timeoutMs
|
|
69
|
+
timeoutMs,
|
|
70
|
+
onAdmitted
|
|
62
71
|
);
|
|
63
72
|
return await awaitWithAbort(operation, signal, () => {
|
|
64
73
|
void operation.then(closeMessages, () => undefined);
|
|
@@ -14,7 +14,8 @@ export class ZLinkSourceSpotRouter {
|
|
|
14
14
|
packetName: string | undefined,
|
|
15
15
|
request: unknown,
|
|
16
16
|
timeoutMs: number | undefined,
|
|
17
|
-
signal?: AbortSignal
|
|
17
|
+
signal?: AbortSignal,
|
|
18
|
+
onAdmitted?: () => void
|
|
18
19
|
): Promise<TReply> {
|
|
19
20
|
throwIfAborted(signal);
|
|
20
21
|
const parts = [
|
|
@@ -29,7 +30,8 @@ export class ZLinkSourceSpotRouter {
|
|
|
29
30
|
target.targetNodeRid,
|
|
30
31
|
target.spotId,
|
|
31
32
|
parts,
|
|
32
|
-
timeoutMs ?? this.defaultRequestTimeoutMs
|
|
33
|
+
timeoutMs ?? this.defaultRequestTimeoutMs,
|
|
34
|
+
onAdmitted
|
|
33
35
|
);
|
|
34
36
|
const replyParts = await awaitWithAbort(operation, signal, () => {
|
|
35
37
|
void operation.then(closeMessages, () => undefined);
|
|
@@ -70,14 +72,16 @@ export class ZLinkSourceSpotRouter {
|
|
|
70
72
|
target: ZLinkSpotRouteTarget,
|
|
71
73
|
request: Message,
|
|
72
74
|
timeoutMs: number | undefined,
|
|
73
|
-
signal?: AbortSignal
|
|
75
|
+
signal?: AbortSignal,
|
|
76
|
+
onAdmitted?: () => void
|
|
74
77
|
): Promise<readonly Message[]> {
|
|
75
78
|
throwIfAborted(signal);
|
|
76
79
|
const operation = sourceSpot.requestToSpot(
|
|
77
80
|
target.targetNodeRid,
|
|
78
81
|
target.spotId,
|
|
79
82
|
request,
|
|
80
|
-
timeoutMs ?? this.defaultRequestTimeoutMs
|
|
83
|
+
timeoutMs ?? this.defaultRequestTimeoutMs,
|
|
84
|
+
onAdmitted
|
|
81
85
|
);
|
|
82
86
|
return await awaitWithAbort(operation, signal, () => {
|
|
83
87
|
void operation.then(closeMessages, () => undefined);
|
|
@@ -34,7 +34,8 @@ export class ZLinkSpotNodeRouteTransport {
|
|
|
34
34
|
parts: readonly Message[],
|
|
35
35
|
codecs: ZLinkChannelEnvelopeCodecRegistry | undefined,
|
|
36
36
|
timeoutMs: number | undefined,
|
|
37
|
-
signal?: AbortSignal
|
|
37
|
+
signal?: AbortSignal,
|
|
38
|
+
onAdmitted?: () => void
|
|
38
39
|
): Promise<TReply> | undefined {
|
|
39
40
|
const router = this.targets.spotNodeRouter(target.routerChannelId);
|
|
40
41
|
if (router === undefined) {
|
|
@@ -47,7 +48,8 @@ export class ZLinkSpotNodeRouteTransport {
|
|
|
47
48
|
target.targetNodeRid,
|
|
48
49
|
target.spotId,
|
|
49
50
|
parts,
|
|
50
|
-
effectiveTimeoutMs
|
|
51
|
+
effectiveTimeoutMs,
|
|
52
|
+
onAdmitted
|
|
51
53
|
);
|
|
52
54
|
return awaitWithAbort(operation, signal, () => {
|
|
53
55
|
void operation.then(closeMessages, () => undefined);
|
|
@@ -65,7 +67,8 @@ export class ZLinkSpotNodeRouteTransport {
|
|
|
65
67
|
target: ZLinkSpotRouteTarget,
|
|
66
68
|
request: Message,
|
|
67
69
|
timeoutMs: number | undefined,
|
|
68
|
-
signal?: AbortSignal
|
|
70
|
+
signal?: AbortSignal,
|
|
71
|
+
onAdmitted?: () => void
|
|
69
72
|
): Promise<readonly Message[]> | undefined {
|
|
70
73
|
const router = this.targets.spotNodeRouter(target.routerChannelId);
|
|
71
74
|
if (router === undefined) {
|
|
@@ -78,7 +81,8 @@ export class ZLinkSpotNodeRouteTransport {
|
|
|
78
81
|
target.targetNodeRid,
|
|
79
82
|
target.spotId,
|
|
80
83
|
request,
|
|
81
|
-
effectiveTimeoutMs
|
|
84
|
+
effectiveTimeoutMs,
|
|
85
|
+
onAdmitted
|
|
82
86
|
);
|
|
83
87
|
return awaitWithAbort(operation, signal, () => {
|
|
84
88
|
void operation.then(closeMessages, () => undefined);
|
|
@@ -37,7 +37,8 @@ export class ZLinkSpotRouteBridgeTransport {
|
|
|
37
37
|
parts: readonly Message[],
|
|
38
38
|
codecs: ZLinkChannelEnvelopeCodecRegistry | undefined,
|
|
39
39
|
timeoutMs: number | undefined,
|
|
40
|
-
signal?: AbortSignal
|
|
40
|
+
signal?: AbortSignal,
|
|
41
|
+
onAdmitted?: () => void
|
|
41
42
|
): Promise<TReply> {
|
|
42
43
|
const bridge = this.requireBridge(target.routerChannelId);
|
|
43
44
|
const operation = appendParts(
|
|
@@ -45,7 +46,7 @@ export class ZLinkSpotRouteBridgeTransport {
|
|
|
45
46
|
parts
|
|
46
47
|
)
|
|
47
48
|
.timeout(timeoutMs ?? 0)
|
|
48
|
-
.submit();
|
|
49
|
+
.submit(onAdmitted);
|
|
49
50
|
const replyParts = await awaitWithAbort(operation, signal, () => {
|
|
50
51
|
void operation.then(closeMessages, () => undefined);
|
|
51
52
|
});
|
|
@@ -61,14 +62,15 @@ export class ZLinkSpotRouteBridgeTransport {
|
|
|
61
62
|
target: ZLinkSpotRouteTarget,
|
|
62
63
|
request: Message,
|
|
63
64
|
timeoutMs: number | undefined,
|
|
64
|
-
signal?: AbortSignal
|
|
65
|
+
signal?: AbortSignal,
|
|
66
|
+
onAdmitted?: () => void
|
|
65
67
|
): Promise<readonly Message[]> {
|
|
66
68
|
const bridge = this.requireBridge(target.routerChannelId);
|
|
67
69
|
const operation = bridge
|
|
68
70
|
.request(target.routerChannelId, target.targetNodeRid, target.spotId)
|
|
69
71
|
.message(request)
|
|
70
72
|
.timeout(timeoutMs ?? this.defaultRequestTimeoutMs ?? 0)
|
|
71
|
-
.submit();
|
|
73
|
+
.submit(onAdmitted);
|
|
72
74
|
return awaitWithAbort(operation, signal, () => {
|
|
73
75
|
void operation.then(closeMessages, () => undefined);
|
|
74
76
|
});
|