@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
|
@@ -68,10 +68,10 @@ class ZLinkChannelOutboundOperations {
|
|
|
68
68
|
correlationId: undefined
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
|
-
request(channelName, packetName, request, timeoutMs, signal, metadata) {
|
|
72
|
-
return keepChannelRequestAlive((0, flow_context_1.runWithOutboundFlow)(this.dispatchServices.flowCreationEnabled(), () => this.requestScoped(channelName, packetName, request, timeoutMs, signal, metadata)));
|
|
71
|
+
request(channelName, packetName, request, timeoutMs, signal, metadata, onAdmitted) {
|
|
72
|
+
return keepChannelRequestAlive((0, flow_context_1.runWithOutboundFlow)(this.dispatchServices.flowCreationEnabled(), () => this.requestScoped(channelName, packetName, request, timeoutMs, signal, metadata, onAdmitted)));
|
|
73
73
|
}
|
|
74
|
-
async requestScoped(channelName, packetName, request, timeoutMs, signal, metadata) {
|
|
74
|
+
async requestScoped(channelName, packetName, request, timeoutMs, signal, metadata, onAdmitted) {
|
|
75
75
|
const deadlineMs = timeoutMs === undefined ? undefined : performance.now() + timeoutMs;
|
|
76
76
|
const deadlineUnixMs = timeoutMs === undefined ? undefined : Date.now() + timeoutMs;
|
|
77
77
|
let correlationId;
|
|
@@ -117,7 +117,7 @@ class ZLinkChannelOutboundOperations {
|
|
|
117
117
|
let replyParts = [];
|
|
118
118
|
try {
|
|
119
119
|
try {
|
|
120
|
-
replyParts = await (0, abort_1.awaitWithAbort)(dealer.request(parts, (0, request_deadline_1.remainingRequestTimeout)(`Channel request '${channelName}'`, deadlineMs)), signal);
|
|
120
|
+
replyParts = await (0, abort_1.awaitWithAbort)(dealer.request(parts, (0, request_deadline_1.remainingRequestTimeout)(`Channel request '${channelName}'`, deadlineMs), onAdmitted), signal);
|
|
121
121
|
}
|
|
122
122
|
catch (error) {
|
|
123
123
|
if (signal?.aborted === true)
|
|
@@ -205,10 +205,10 @@ class ZLinkChannelOutboundOperations {
|
|
|
205
205
|
targetRid: targetNodeRid
|
|
206
206
|
});
|
|
207
207
|
}
|
|
208
|
-
routeRequest(routerChannelId, targetNodeRid, packetName, request, timeoutMs, signal, metadata) {
|
|
209
|
-
return (0, flow_context_1.runWithOutboundFlow)(this.dispatchServices.flowCreationEnabled(), () => this.routeRequestScoped(routerChannelId, targetNodeRid, packetName, request, timeoutMs, signal, metadata));
|
|
208
|
+
routeRequest(routerChannelId, targetNodeRid, packetName, request, timeoutMs, signal, metadata, onAdmitted) {
|
|
209
|
+
return (0, flow_context_1.runWithOutboundFlow)(this.dispatchServices.flowCreationEnabled(), () => this.routeRequestScoped(routerChannelId, targetNodeRid, packetName, request, timeoutMs, signal, metadata, onAdmitted));
|
|
210
210
|
}
|
|
211
|
-
async routeRequestScoped(routerChannelId, targetNodeRid, packetName, request, timeoutMs, signal, metadata) {
|
|
211
|
+
async routeRequestScoped(routerChannelId, targetNodeRid, packetName, request, timeoutMs, signal, metadata, onAdmitted) {
|
|
212
212
|
let correlationId;
|
|
213
213
|
let router;
|
|
214
214
|
let terminalRecorded = false;
|
|
@@ -245,7 +245,7 @@ class ZLinkChannelOutboundOperations {
|
|
|
245
245
|
targetRid: targetNodeRid
|
|
246
246
|
});
|
|
247
247
|
const reply = await this.measureRequest(routerChannelId, async () => {
|
|
248
|
-
const replyParts = await (0, abort_1.awaitWithAbort)(router.request(targetNodeRid, parts, timeoutMs), signal);
|
|
248
|
+
const replyParts = await (0, abort_1.awaitWithAbort)(router.request(targetNodeRid, parts, timeoutMs, onAdmitted), signal);
|
|
249
249
|
try {
|
|
250
250
|
return (0, channel_envelope_1.decodeChannelReply)(replyParts, this.codecs);
|
|
251
251
|
}
|
|
@@ -45,17 +45,17 @@ export declare class ZLinkChannelRuntimeManager {
|
|
|
45
45
|
dispatchLocalMeshRoute(meshName: string, sourceNodeRid: RoutingId, parts: readonly Message[], signal?: AbortSignal): Promise<void>;
|
|
46
46
|
canDispatchLocalMeshRoute(meshName: string): boolean;
|
|
47
47
|
send(channelName: string, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): Promise<ZLinkSubmitResult>;
|
|
48
|
-
request<TReply>(channelName: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string
|
|
48
|
+
request<TReply>(channelName: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string>, onAdmitted?: () => void): Promise<TReply>;
|
|
49
49
|
tryPublish(channelName: string, topic: string, packetName: string | undefined, event: unknown, metadata?: ReadonlyMap<string, string>): ZLinkSubmitResult;
|
|
50
50
|
publish(channelName: string, topic: string, packetName: string | undefined, event: unknown, signal?: AbortSignal, metadata?: ReadonlyMap<string, string>): Promise<ZLinkSubmitResult>;
|
|
51
51
|
routeSubmit(routerChannelId: string, targetNodeRid: string, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): Promise<ZLinkSubmitResult>;
|
|
52
|
-
routeRequest<TReply>(routerChannelId: string, targetNodeRid: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string
|
|
52
|
+
routeRequest<TReply>(routerChannelId: string, targetNodeRid: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string>, onAdmitted?: () => void): Promise<TReply>;
|
|
53
53
|
routeSendToSpot(spotRouteTarget: ZLinkSpotRouteTarget, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): Promise<void>;
|
|
54
|
-
routeRequestToSpot<TReply>(spotRouteTarget: ZLinkSpotRouteTarget, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string
|
|
55
|
-
routeRequestFromSpotToSpot<TReply>(sourceSpot: ZLinkBackendSpot, spotRouteTarget: ZLinkSpotRouteTarget, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal): Promise<TReply>;
|
|
54
|
+
routeRequestToSpot<TReply>(spotRouteTarget: ZLinkSpotRouteTarget, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string>, onAdmitted?: () => void): Promise<TReply>;
|
|
55
|
+
routeRequestFromSpotToSpot<TReply>(sourceSpot: ZLinkBackendSpot, spotRouteTarget: ZLinkSpotRouteTarget, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, onAdmitted?: () => void): Promise<TReply>;
|
|
56
56
|
routeSendFromSpotToSpot(sourceSpot: ZLinkBackendSpot, spotRouteTarget: ZLinkSpotRouteTarget, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): Promise<void>;
|
|
57
|
-
routeRequestRawFromSpotToSpot(sourceSpot: ZLinkBackendSpot, spotRouteTarget: ZLinkSpotRouteTarget, request: Message, timeoutMs: number | undefined, signal?: AbortSignal): Promise<readonly Message[]>;
|
|
58
|
-
routeRequestRawToSpot(spotRouteTarget: ZLinkSpotRouteTarget, request: Message, timeoutMs: number | undefined, signal?: AbortSignal): Promise<readonly Message[]>;
|
|
57
|
+
routeRequestRawFromSpotToSpot(sourceSpot: ZLinkBackendSpot, spotRouteTarget: ZLinkSpotRouteTarget, request: Message, timeoutMs: number | undefined, signal?: AbortSignal, onAdmitted?: () => void): Promise<readonly Message[]>;
|
|
58
|
+
routeRequestRawToSpot(spotRouteTarget: ZLinkSpotRouteTarget, request: Message, timeoutMs: number | undefined, signal?: AbortSignal, onAdmitted?: () => void): Promise<readonly Message[]>;
|
|
59
59
|
canRouteChannel(routerChannelId: string): boolean;
|
|
60
60
|
canRoutePacketChannel(routerChannelId: string): boolean;
|
|
61
61
|
dispose(signal?: AbortSignal): Promise<void>;
|
|
@@ -141,8 +141,8 @@ class ZLinkChannelRuntimeManager {
|
|
|
141
141
|
send(channelName, packetName, message, metadata) {
|
|
142
142
|
return this.outbound.send(channelName, packetName, message, metadata);
|
|
143
143
|
}
|
|
144
|
-
async request(channelName, packetName, request, timeoutMs, signal, metadata) {
|
|
145
|
-
return this.outbound.request(channelName, packetName, request, timeoutMs, signal, metadata);
|
|
144
|
+
async request(channelName, packetName, request, timeoutMs, signal, metadata, onAdmitted) {
|
|
145
|
+
return this.outbound.request(channelName, packetName, request, timeoutMs, signal, metadata, onAdmitted);
|
|
146
146
|
}
|
|
147
147
|
tryPublish(channelName, topic, packetName, event, metadata) {
|
|
148
148
|
return this.outbound.tryPublish(channelName, topic, packetName, event, metadata);
|
|
@@ -153,26 +153,26 @@ class ZLinkChannelRuntimeManager {
|
|
|
153
153
|
routeSubmit(routerChannelId, targetNodeRid, packetName, message, metadata) {
|
|
154
154
|
return this.outbound.routeSubmit(routerChannelId, targetNodeRid, packetName, message, metadata);
|
|
155
155
|
}
|
|
156
|
-
async routeRequest(routerChannelId, targetNodeRid, packetName, request, timeoutMs, signal, metadata) {
|
|
157
|
-
return this.outbound.routeRequest(routerChannelId, targetNodeRid, packetName, request, timeoutMs, signal, metadata);
|
|
156
|
+
async routeRequest(routerChannelId, targetNodeRid, packetName, request, timeoutMs, signal, metadata, onAdmitted) {
|
|
157
|
+
return this.outbound.routeRequest(routerChannelId, targetNodeRid, packetName, request, timeoutMs, signal, metadata, onAdmitted);
|
|
158
158
|
}
|
|
159
159
|
async routeSendToSpot(spotRouteTarget, packetName, message, metadata) {
|
|
160
160
|
return this.spotRoutes.routeSendToSpot(spotRouteTarget, packetName, message, metadata);
|
|
161
161
|
}
|
|
162
|
-
async routeRequestToSpot(spotRouteTarget, packetName, request, timeoutMs, signal, metadata) {
|
|
163
|
-
return this.spotRoutes.routeRequestToSpot(spotRouteTarget, packetName, request, timeoutMs, signal, metadata);
|
|
162
|
+
async routeRequestToSpot(spotRouteTarget, packetName, request, timeoutMs, signal, metadata, onAdmitted) {
|
|
163
|
+
return this.spotRoutes.routeRequestToSpot(spotRouteTarget, packetName, request, timeoutMs, signal, metadata, onAdmitted);
|
|
164
164
|
}
|
|
165
|
-
async routeRequestFromSpotToSpot(sourceSpot, spotRouteTarget, packetName, request, timeoutMs, signal) {
|
|
166
|
-
return this.spotRoutes.routeRequestFromSpotToSpot(sourceSpot, spotRouteTarget, packetName, request, timeoutMs, signal);
|
|
165
|
+
async routeRequestFromSpotToSpot(sourceSpot, spotRouteTarget, packetName, request, timeoutMs, signal, onAdmitted) {
|
|
166
|
+
return this.spotRoutes.routeRequestFromSpotToSpot(sourceSpot, spotRouteTarget, packetName, request, timeoutMs, signal, onAdmitted);
|
|
167
167
|
}
|
|
168
168
|
async routeSendFromSpotToSpot(sourceSpot, spotRouteTarget, packetName, message, metadata) {
|
|
169
169
|
return this.spotRoutes.routeSendFromSpotToSpot(sourceSpot, spotRouteTarget, packetName, message, metadata);
|
|
170
170
|
}
|
|
171
|
-
async routeRequestRawFromSpotToSpot(sourceSpot, spotRouteTarget, request, timeoutMs, signal) {
|
|
172
|
-
return this.spotRoutes.routeRequestRawFromSpotToSpot(sourceSpot, spotRouteTarget, request, timeoutMs, signal);
|
|
171
|
+
async routeRequestRawFromSpotToSpot(sourceSpot, spotRouteTarget, request, timeoutMs, signal, onAdmitted) {
|
|
172
|
+
return this.spotRoutes.routeRequestRawFromSpotToSpot(sourceSpot, spotRouteTarget, request, timeoutMs, signal, onAdmitted);
|
|
173
173
|
}
|
|
174
|
-
async routeRequestRawToSpot(spotRouteTarget, request, timeoutMs, signal) {
|
|
175
|
-
return this.spotRoutes.routeRequestRawToSpot(spotRouteTarget, request, timeoutMs, signal);
|
|
174
|
+
async routeRequestRawToSpot(spotRouteTarget, request, timeoutMs, signal, onAdmitted) {
|
|
175
|
+
return this.spotRoutes.routeRequestRawToSpot(spotRouteTarget, request, timeoutMs, signal, onAdmitted);
|
|
176
176
|
}
|
|
177
177
|
canRouteChannel(routerChannelId) {
|
|
178
178
|
return this.spotRoutes.canRouteChannel(routerChannelId);
|
|
@@ -11,7 +11,7 @@ import type { ZLinkSpotRoutedSendOptions, ZLinkSpotRoutedRequestOptions } from '
|
|
|
11
11
|
import { type ZLinkChannelEnvelopeCodecRegistry } from './channel-envelope';
|
|
12
12
|
export interface ZLinkChannelClientTransport {
|
|
13
13
|
send(channelName: string, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): void | ZLinkSubmitResult | Promise<void | ZLinkSubmitResult>;
|
|
14
|
-
request<TReply>(channelName: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string
|
|
14
|
+
request<TReply>(channelName: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string>, onAdmitted?: () => void): Promise<TReply>;
|
|
15
15
|
tryPublish?(channelName: string, topic: string, packetName: string | undefined, event: unknown, metadata?: ReadonlyMap<string, string>): ZLinkSubmitResult;
|
|
16
16
|
publish(channelName: string, topic: string, packetName: string | undefined, event: unknown, signal?: AbortSignal, metadata?: ReadonlyMap<string, string>): ZLinkSubmitResult | Promise<ZLinkSubmitResult>;
|
|
17
17
|
}
|
|
@@ -22,9 +22,9 @@ export interface ZLinkSpotPublisherClientTransport {
|
|
|
22
22
|
}
|
|
23
23
|
export interface ZLinkRouteClientTransport {
|
|
24
24
|
submit(routerChannelId: string, targetNodeRid: string, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): void | ZLinkSubmitResult | Promise<void | ZLinkSubmitResult>;
|
|
25
|
-
request<TReply>(routerChannelId: string, targetNodeRid: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string
|
|
25
|
+
request<TReply>(routerChannelId: string, targetNodeRid: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string>, onAdmitted?: () => void): Promise<TReply>;
|
|
26
26
|
submitToChannel(meshName: string, channelName: string, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): void | ZLinkSubmitResult | Promise<void | ZLinkSubmitResult>;
|
|
27
|
-
requestToChannel<TReply>(meshName: string, channelName: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string
|
|
27
|
+
requestToChannel<TReply>(meshName: string, channelName: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string>, onAdmitted?: () => void): Promise<TReply>;
|
|
28
28
|
sendToSpot?(spotRouteTarget: ZLinkSpotRouteTarget, message: unknown, options: {
|
|
29
29
|
readonly packetName?: string;
|
|
30
30
|
readonly metadata?: ReadonlyMap<string, string>;
|
|
@@ -33,24 +33,25 @@ export interface ZLinkRouteClientTransport {
|
|
|
33
33
|
readonly packetName?: string;
|
|
34
34
|
readonly timeoutMs?: number;
|
|
35
35
|
readonly signal?: AbortSignal;
|
|
36
|
+
readonly onAdmitted?: () => void;
|
|
36
37
|
readonly metadata?: ReadonlyMap<string, string>;
|
|
37
38
|
}): Promise<TReply>;
|
|
38
39
|
}
|
|
39
40
|
interface ZLinkChannelTransportRuntime {
|
|
40
41
|
send(channelName: string, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): Promise<ZLinkSubmitResult>;
|
|
41
|
-
request<TReply>(channelName: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string
|
|
42
|
+
request<TReply>(channelName: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string>, onAdmitted?: () => void): Promise<TReply>;
|
|
42
43
|
tryPublish(channelName: string, topic: string, packetName: string | undefined, event: unknown, metadata?: ReadonlyMap<string, string>): ZLinkSubmitResult;
|
|
43
44
|
publish(channelName: string, topic: string, packetName: string | undefined, event: unknown, signal?: AbortSignal, metadata?: ReadonlyMap<string, string>): Promise<ZLinkSubmitResult>;
|
|
44
45
|
canRouteChannel(routerChannelId: string): boolean;
|
|
45
46
|
canRoutePacketChannel(routerChannelId: string): boolean;
|
|
46
47
|
routeSubmit(routerChannelId: string, targetNodeRid: string, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): Promise<ZLinkSubmitResult>;
|
|
47
|
-
routeRequest<TReply>(routerChannelId: string, targetNodeRid: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string
|
|
48
|
+
routeRequest<TReply>(routerChannelId: string, targetNodeRid: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string>, onAdmitted?: () => void): Promise<TReply>;
|
|
48
49
|
routeSendToSpot(spotRouteTarget: ZLinkSpotRouteTarget, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): Promise<void>;
|
|
49
50
|
routeSendFromSpotToSpot(sourceSpot: ZLinkBackendSpot, spotRouteTarget: ZLinkSpotRouteTarget, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): Promise<void>;
|
|
50
|
-
routeRequestToSpot<TReply>(spotRouteTarget: ZLinkSpotRouteTarget, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string
|
|
51
|
-
routeRequestFromSpotToSpot<TReply>(sourceSpot: ZLinkBackendSpot, spotRouteTarget: ZLinkSpotRouteTarget, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal): Promise<TReply>;
|
|
52
|
-
routeRequestRawFromSpotToSpot(sourceSpot: ZLinkBackendSpot, spotRouteTarget: ZLinkSpotRouteTarget, request: Message, timeoutMs: number | undefined, signal?: AbortSignal): Promise<readonly Message[]>;
|
|
53
|
-
routeRequestRawToSpot(spotRouteTarget: ZLinkSpotRouteTarget, request: Message, timeoutMs: number | undefined, signal?: AbortSignal): Promise<readonly Message[]>;
|
|
51
|
+
routeRequestToSpot<TReply>(spotRouteTarget: ZLinkSpotRouteTarget, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string>, onAdmitted?: () => void): Promise<TReply>;
|
|
52
|
+
routeRequestFromSpotToSpot<TReply>(sourceSpot: ZLinkBackendSpot, spotRouteTarget: ZLinkSpotRouteTarget, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, onAdmitted?: () => void): Promise<TReply>;
|
|
53
|
+
routeRequestRawFromSpotToSpot(sourceSpot: ZLinkBackendSpot, spotRouteTarget: ZLinkSpotRouteTarget, request: Message, timeoutMs: number | undefined, signal?: AbortSignal, onAdmitted?: () => void): Promise<readonly Message[]>;
|
|
54
|
+
routeRequestRawToSpot(spotRouteTarget: ZLinkSpotRouteTarget, request: Message, timeoutMs: number | undefined, signal?: AbortSignal, onAdmitted?: () => void): Promise<readonly Message[]>;
|
|
54
55
|
}
|
|
55
56
|
export declare class ZLinkRuntimeRouteTransport implements ZLinkRouteClientTransport {
|
|
56
57
|
private readonly manager;
|
|
@@ -63,20 +64,20 @@ export declare class ZLinkRuntimeRouteTransport implements ZLinkRouteClientTrans
|
|
|
63
64
|
private readonly flowCreationEnabled;
|
|
64
65
|
private readonly outboundFlow;
|
|
65
66
|
constructor(manager: () => ZLinkChannelTransportRuntime | undefined, routeChannelPredicate?: ((routerChannelId: string) => boolean) | undefined, meshRuntime?: (() => {
|
|
66
|
-
readonly meshNode
|
|
67
|
+
readonly meshNode?: (meshName: string) => ZLinkBackendMeshNode | undefined;
|
|
67
68
|
readonly meshCompletionTable: (meshName: string) => ZLinkMeshCompletionTable | undefined;
|
|
68
69
|
} | undefined) | undefined, codecs?: ZLinkChannelEnvelopeCodecRegistry | undefined, manualNodeTarget?: ((meshName: string, targetNodeRid: string) => boolean | undefined) | undefined, localNodeSubmit?: ((meshName: string, sourceNodeRid: string, parts: readonly MessageLike[]) => ZLinkSubmitResult) | undefined, metrics?: ZLinkRuntimeMetrics | undefined, flowCreationEnabled?: () => boolean, outboundFlow?: () => ZLinkMessageFlowTracer | undefined);
|
|
69
70
|
canRouteChannel(routerChannelId: string): boolean;
|
|
70
71
|
canRoutePacketChannel(routerChannelId: string): boolean;
|
|
71
|
-
submit(meshName: string, targetNodeRid: string, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): Promise<ZLinkSubmitResult>;
|
|
72
|
-
submitInfrastructure(meshName: string, targetNodeRid: string, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): Promise<ZLinkSubmitResult>;
|
|
72
|
+
submit(meshName: string, targetNodeRid: string, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): ZLinkSubmitResult | Promise<ZLinkSubmitResult>;
|
|
73
|
+
submitInfrastructure(meshName: string, targetNodeRid: string, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): ZLinkSubmitResult | Promise<ZLinkSubmitResult>;
|
|
73
74
|
private submitNode;
|
|
74
|
-
request<TReply>(meshName: string, targetNodeRid: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string
|
|
75
|
+
request<TReply>(meshName: string, targetNodeRid: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string>, onAdmitted?: () => void): Promise<TReply>;
|
|
75
76
|
private requestScoped;
|
|
76
77
|
private traceNodeRequest;
|
|
77
78
|
submitToChannel(meshName: string, channelName: string, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): Promise<ZLinkSubmitResult>;
|
|
78
79
|
private submitToChannelScoped;
|
|
79
|
-
requestToChannel<TReply>(meshName: string, channelName: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string
|
|
80
|
+
requestToChannel<TReply>(meshName: string, channelName: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string>, onAdmitted?: () => void): Promise<TReply>;
|
|
80
81
|
private requestToChannelScoped;
|
|
81
82
|
private submitRequestOperation;
|
|
82
83
|
sendToSpot(spotRouteTarget: ZLinkSpotRouteTarget, message: unknown, options: ZLinkSpotRoutedSendOptions): Promise<ZLinkSubmitResult>;
|
|
@@ -91,19 +92,21 @@ export declare class ZLinkRuntimeRouteTransport implements ZLinkRouteClientTrans
|
|
|
91
92
|
readonly packetName?: string;
|
|
92
93
|
readonly timeoutMs?: number;
|
|
93
94
|
readonly signal?: AbortSignal;
|
|
95
|
+
readonly onAdmitted?: () => void;
|
|
94
96
|
}): Promise<TReply>;
|
|
95
97
|
requestRawFromSpotToSpot(sourceSpot: ZLinkBackendSpot, spotRouteTarget: ZLinkSpotRouteTarget, request: Message, options: {
|
|
96
98
|
readonly timeoutMs?: number;
|
|
97
99
|
readonly signal?: AbortSignal;
|
|
100
|
+
readonly onAdmitted?: () => void;
|
|
98
101
|
}): Promise<readonly Message[]>;
|
|
99
102
|
requestRawToSpot(spotRouteTarget: ZLinkSpotRouteTarget, request: Message, options: {
|
|
100
103
|
readonly timeoutMs?: number;
|
|
101
104
|
readonly signal?: AbortSignal;
|
|
105
|
+
readonly onAdmitted?: () => void;
|
|
102
106
|
}): Promise<readonly Message[]>;
|
|
103
107
|
private requestRawToSpotScoped;
|
|
104
108
|
private requireManager;
|
|
105
109
|
private meshNode;
|
|
106
|
-
private isSelfNode;
|
|
107
110
|
private isKnownBackendPeer;
|
|
108
111
|
private submitLocalNode;
|
|
109
112
|
private requireMeshNode;
|
|
@@ -19,6 +19,7 @@ const framework_errors_internal_1 = require("../framework-errors-internal");
|
|
|
19
19
|
const submission_result_1 = require("../messaging/submission-result");
|
|
20
20
|
const routing_id_1 = require("../routing-id");
|
|
21
21
|
const channel_envelope_1 = require("./channel-envelope");
|
|
22
|
+
const NON_BLOCKING_SEND_OPTIONS = Object.freeze({ flags: runtime_values_1.ZLINK_BACKEND_SEND_DONT_WAIT });
|
|
22
23
|
class ZLinkRuntimeRouteTransport {
|
|
23
24
|
manager;
|
|
24
25
|
routeChannelPredicate;
|
|
@@ -52,15 +53,19 @@ class ZLinkRuntimeRouteTransport {
|
|
|
52
53
|
this.routeChannelPredicate?.(routerChannelId) ??
|
|
53
54
|
false);
|
|
54
55
|
}
|
|
55
|
-
|
|
56
|
+
submit(meshName, targetNodeRid, packetName, message, metadata) {
|
|
56
57
|
// Call-scoped flow (spec 27 §4): the envelope flow pair lives only for
|
|
57
58
|
// the duration of this outbound call, never in the caller's context.
|
|
58
|
-
|
|
59
|
+
if (!this.flowCreationEnabled())
|
|
60
|
+
return this.submitNode(meshName, targetNodeRid, packetName, message, metadata, false);
|
|
61
|
+
return (0, flow_context_1.runWithOutboundFlow)(true, () => this.submitNode(meshName, targetNodeRid, packetName, message, metadata, false));
|
|
59
62
|
}
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
submitInfrastructure(meshName, targetNodeRid, packetName, message, metadata) {
|
|
64
|
+
if (!this.flowCreationEnabled())
|
|
65
|
+
return this.submitNode(meshName, targetNodeRid, packetName, message, metadata, true);
|
|
66
|
+
return (0, flow_context_1.runWithOutboundFlow)(true, () => this.submitNode(meshName, targetNodeRid, packetName, message, metadata, true));
|
|
62
67
|
}
|
|
63
|
-
|
|
68
|
+
submitNode(meshName, targetNodeRid, packetName, message, metadata, allowObjectClientTarget) {
|
|
64
69
|
const node = this.meshNode(meshName);
|
|
65
70
|
if (node === undefined) {
|
|
66
71
|
return this.requireManager().routeSubmit(meshName, targetNodeRid, packetName, message, metadata);
|
|
@@ -70,28 +75,35 @@ class ZLinkRuntimeRouteTransport {
|
|
|
70
75
|
return { status: submission_result_1.ZLinkSubmitStatus.TargetNotFound };
|
|
71
76
|
}
|
|
72
77
|
const parts = this.encodeMessage(3 /* ZLinkChannelMessageKind.Command */, meshName, packetName, message, undefined, metadata);
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
75
|
-
return this.submitLocalNode(meshName, String(
|
|
78
|
+
const sourceNodeRid = node.routingId ?? node.status().routingId;
|
|
79
|
+
if ((0, routing_id_1.routingIdsEqual)(sourceNodeRid, targetNodeRid)) {
|
|
80
|
+
return this.submitLocalNode(meshName, String(sourceNodeRid), parts);
|
|
76
81
|
}
|
|
77
|
-
if (
|
|
78
|
-
this.
|
|
82
|
+
if (this.manualNodeTarget?.(meshName, targetNodeRid) === false &&
|
|
83
|
+
!this.isKnownBackendPeer(node, targetNodeRid)) {
|
|
79
84
|
return { status: submission_result_1.ZLinkSubmitStatus.TargetNotFound };
|
|
80
85
|
}
|
|
81
86
|
try {
|
|
82
|
-
|
|
87
|
+
const submitted = node.sendToNode((0, routing_id_1.toBackendRoutingId)(targetNodeRid), parts, NON_BLOCKING_SEND_OPTIONS);
|
|
88
|
+
return submitted instanceof Promise
|
|
89
|
+
? submitted.then(mapMeshSubmitResult, (error) => {
|
|
90
|
+
throw mapMeshSubmissionError(error, `MeshNode '${meshName}' send to node '${targetNodeRid}'`);
|
|
91
|
+
})
|
|
92
|
+
: mapMeshSubmitResult(submitted);
|
|
83
93
|
}
|
|
84
94
|
catch (error) {
|
|
85
|
-
throw mapMeshSubmissionError(error,
|
|
95
|
+
throw mapMeshSubmissionError(error, `MeshNode '${meshName}' send to node '${targetNodeRid}'`);
|
|
86
96
|
}
|
|
87
97
|
}
|
|
88
|
-
request(meshName, targetNodeRid, packetName, request, timeoutMs, signal, metadata) {
|
|
89
|
-
|
|
98
|
+
request(meshName, targetNodeRid, packetName, request, timeoutMs, signal, metadata, onAdmitted) {
|
|
99
|
+
if (!this.flowCreationEnabled())
|
|
100
|
+
return this.requestScoped(meshName, targetNodeRid, packetName, request, timeoutMs, signal, metadata, onAdmitted);
|
|
101
|
+
return (0, flow_context_1.runWithOutboundFlow)(true, () => this.requestScoped(meshName, targetNodeRid, packetName, request, timeoutMs, signal, metadata, onAdmitted));
|
|
90
102
|
}
|
|
91
|
-
async requestScoped(meshName, targetNodeRid, packetName, request, timeoutMs, signal, metadata) {
|
|
103
|
+
async requestScoped(meshName, targetNodeRid, packetName, request, timeoutMs, signal, metadata, onAdmitted) {
|
|
92
104
|
const node = this.meshNode(meshName);
|
|
93
105
|
if (node === undefined) {
|
|
94
|
-
return this.requireManager().routeRequest(meshName, targetNodeRid, packetName, request, timeoutMs, signal, metadata);
|
|
106
|
+
return this.requireManager().routeRequest(meshName, targetNodeRid, packetName, request, timeoutMs, signal, metadata, onAdmitted);
|
|
95
107
|
}
|
|
96
108
|
const correlationId = (0, channel_envelope_1.newChannelCorrelationId)();
|
|
97
109
|
try {
|
|
@@ -103,6 +115,7 @@ class ZLinkRuntimeRouteTransport {
|
|
|
103
115
|
const completion = await this.submitRequestOperation(meshName, timeoutMs, signal, `MeshNode '${meshName}' request to node '${targetNodeRid}'`, (remainingTimeoutMs) => {
|
|
104
116
|
const operationId = node.requestToNode((0, routing_id_1.toBackendRoutingId)(targetNodeRid), parts, {
|
|
105
117
|
flags: 1,
|
|
118
|
+
onAdmitted,
|
|
106
119
|
timeoutMs: remainingTimeoutMs
|
|
107
120
|
});
|
|
108
121
|
this.traceNodeRequest(ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Sent, undefined, meshName, targetNodeRid, packetName, correlationId);
|
|
@@ -142,7 +155,7 @@ class ZLinkRuntimeRouteTransport {
|
|
|
142
155
|
const parts = this.encodeMessage(3 /* ZLinkChannelMessageKind.Command */, channelName, packetName, message, undefined, metadata);
|
|
143
156
|
const operation = `MeshNode '${meshName}' send to channel '${channelName}'`;
|
|
144
157
|
try {
|
|
145
|
-
const result = mapMeshSubmitResult(await node.sendToChannel(channelName, parts,
|
|
158
|
+
const result = mapMeshSubmitResult(await node.sendToChannel(channelName, parts, NON_BLOCKING_SEND_OPTIONS));
|
|
146
159
|
if (result.status === submission_result_1.ZLinkSubmitStatus.TargetNotFound) {
|
|
147
160
|
this.metrics?.recordChannelSelectionFailure(meshName, channelName, 'no_ready_target');
|
|
148
161
|
}
|
|
@@ -152,16 +165,22 @@ class ZLinkRuntimeRouteTransport {
|
|
|
152
165
|
throw mapMeshSubmissionError(error, operation);
|
|
153
166
|
}
|
|
154
167
|
}
|
|
155
|
-
requestToChannel(meshName, channelName, packetName, request, timeoutMs, signal, metadata) {
|
|
156
|
-
|
|
168
|
+
requestToChannel(meshName, channelName, packetName, request, timeoutMs, signal, metadata, onAdmitted) {
|
|
169
|
+
if (!this.flowCreationEnabled())
|
|
170
|
+
return this.requestToChannelScoped(meshName, channelName, packetName, request, timeoutMs, signal, metadata, onAdmitted);
|
|
171
|
+
return (0, flow_context_1.runWithOutboundFlow)(true, () => this.requestToChannelScoped(meshName, channelName, packetName, request, timeoutMs, signal, metadata, onAdmitted));
|
|
157
172
|
}
|
|
158
|
-
async requestToChannelScoped(meshName, channelName, packetName, request, timeoutMs, signal, metadata) {
|
|
173
|
+
async requestToChannelScoped(meshName, channelName, packetName, request, timeoutMs, signal, metadata, onAdmitted) {
|
|
159
174
|
(0, abort_1.throwIfAborted)(signal);
|
|
160
175
|
const node = this.requireMeshNode(meshName);
|
|
161
176
|
const parts = this.encodeMessage(1 /* ZLinkChannelMessageKind.Request */, channelName, packetName, request, timeoutMs ?? Registration_1.DEFAULT_REQUEST_TIMEOUT_MS, metadata);
|
|
162
177
|
const metric = this.metrics?.startRequest(meshName, 'channel');
|
|
163
178
|
try {
|
|
164
|
-
const completion = await this.submitRequestOperation(meshName, timeoutMs, signal, `MeshNode '${meshName}' request to channel '${channelName}'`, (remainingTimeoutMs) => node.requestToChannel(channelName, parts, {
|
|
179
|
+
const completion = await this.submitRequestOperation(meshName, timeoutMs, signal, `MeshNode '${meshName}' request to channel '${channelName}'`, (remainingTimeoutMs) => node.requestToChannel(channelName, parts, {
|
|
180
|
+
flags: 1,
|
|
181
|
+
timeoutMs: remainingTimeoutMs,
|
|
182
|
+
onAdmitted
|
|
183
|
+
}));
|
|
165
184
|
const reply = this.decodeMeshReply(meshName, completion);
|
|
166
185
|
metric?.complete('completed');
|
|
167
186
|
return reply;
|
|
@@ -232,18 +251,19 @@ class ZLinkRuntimeRouteTransport {
|
|
|
232
251
|
if (spotRouteTarget.spotKind === Spots_1.ZLinkSpotKind.Instance) {
|
|
233
252
|
throw new configuration_1.ZLinkConfigurationException('Instance Spot routes require the MeshNode command 39 transport.');
|
|
234
253
|
}
|
|
235
|
-
return this.requireManager().routeRequestToSpot(spotRouteTarget, options.packetName, request, options.timeoutMs, options.signal, options.metadata);
|
|
254
|
+
return this.requireManager().routeRequestToSpot(spotRouteTarget, options.packetName, request, options.timeoutMs, options.signal, options.metadata, options.onAdmitted);
|
|
236
255
|
}
|
|
237
256
|
(0, abort_1.throwIfAborted)(options.signal);
|
|
238
257
|
let completionPromise;
|
|
239
258
|
try {
|
|
240
259
|
const encoded = this.encodeMessage(1 /* ZLinkChannelMessageKind.Request */, meshName, options.packetName, request, options.timeoutMs, options.metadata);
|
|
241
260
|
completionPromise = this.completionTable(meshName).submit(() => spotRouteTarget.spotKind === Spots_1.ZLinkSpotKind.Instance
|
|
242
|
-
? node.requestInstanceSpot(instanceSpotRouteFence(spotRouteTarget), encoded, options.timeoutMs, undefined, options.metadata, options.instanceSpot)
|
|
261
|
+
? node.requestInstanceSpot(instanceSpotRouteFence(spotRouteTarget), encoded, options.timeoutMs, undefined, options.metadata, options.instanceSpot, options.onAdmitted)
|
|
243
262
|
: node
|
|
244
263
|
.entrySpot()
|
|
245
264
|
.requestToSpot((0, routing_id_1.toBackendRoutingId)(spotRouteTarget.targetNodeRid), (0, routing_id_1.toBackendRoutingId)(spotRouteTarget.spotId), spotRouteTarget.targetSpotGeneration ?? 0n, encoded, {
|
|
246
265
|
flags: 1,
|
|
266
|
+
onAdmitted: options.onAdmitted,
|
|
247
267
|
timeoutMs: options.timeoutMs,
|
|
248
268
|
routeFence: directSpotRouteFence(spotRouteTarget),
|
|
249
269
|
entrySpot: spotRouteTarget.spotKind === Spots_1.ZLinkSpotKind.Entry
|
|
@@ -255,10 +275,10 @@ class ZLinkRuntimeRouteTransport {
|
|
|
255
275
|
return this.waitForMeshReply(meshName, completionPromise);
|
|
256
276
|
}
|
|
257
277
|
async requestFromSpotToSpot(sourceSpot, spotRouteTarget, request, options) {
|
|
258
|
-
return this.requireManager().routeRequestFromSpotToSpot(sourceSpot, spotRouteTarget, options.packetName, request, options.timeoutMs, options.signal);
|
|
278
|
+
return this.requireManager().routeRequestFromSpotToSpot(sourceSpot, spotRouteTarget, options.packetName, request, options.timeoutMs, options.signal, options.onAdmitted);
|
|
259
279
|
}
|
|
260
280
|
async requestRawFromSpotToSpot(sourceSpot, spotRouteTarget, request, options) {
|
|
261
|
-
return this.requireManager().routeRequestRawFromSpotToSpot(sourceSpot, spotRouteTarget, request, options.timeoutMs, options.signal);
|
|
281
|
+
return this.requireManager().routeRequestRawFromSpotToSpot(sourceSpot, spotRouteTarget, request, options.timeoutMs, options.signal, options.onAdmitted);
|
|
262
282
|
}
|
|
263
283
|
requestRawToSpot(spotRouteTarget, request, options) {
|
|
264
284
|
return (0, flow_context_1.runWithOutboundFlow)(this.flowCreationEnabled(), () => this.requestRawToSpotScoped(spotRouteTarget, request, options));
|
|
@@ -277,6 +297,7 @@ class ZLinkRuntimeRouteTransport {
|
|
|
277
297
|
.entrySpot()
|
|
278
298
|
.requestToSpot((0, routing_id_1.toBackendRoutingId)(spotRouteTarget.targetNodeRid), (0, routing_id_1.toBackendRoutingId)(spotRouteTarget.spotId), spotRouteTarget.targetSpotGeneration ?? 0n, parts, {
|
|
279
299
|
flags: 1,
|
|
300
|
+
onAdmitted: options.onAdmitted,
|
|
280
301
|
timeoutMs: options.timeoutMs,
|
|
281
302
|
routeFence: directSpotRouteFence(spotRouteTarget),
|
|
282
303
|
entrySpot: spotRouteTarget.spotKind === Spots_1.ZLinkSpotKind.Entry
|
|
@@ -302,7 +323,7 @@ class ZLinkRuntimeRouteTransport {
|
|
|
302
323
|
(0, mesh_completion_table_1.closeMeshCompletion)(completion);
|
|
303
324
|
}
|
|
304
325
|
}
|
|
305
|
-
return this.requireManager().routeRequestRawToSpot(spotRouteTarget, request, options.timeoutMs, options.signal);
|
|
326
|
+
return this.requireManager().routeRequestRawToSpot(spotRouteTarget, request, options.timeoutMs, options.signal, options.onAdmitted);
|
|
306
327
|
}
|
|
307
328
|
requireManager() {
|
|
308
329
|
const manager = this.manager();
|
|
@@ -312,11 +333,7 @@ class ZLinkRuntimeRouteTransport {
|
|
|
312
333
|
return manager;
|
|
313
334
|
}
|
|
314
335
|
meshNode(meshName) {
|
|
315
|
-
|
|
316
|
-
return runtime?.meshNode?.(meshName);
|
|
317
|
-
}
|
|
318
|
-
isSelfNode(node, targetNodeRid) {
|
|
319
|
-
return (0, routing_id_1.routingIdsEqual)(node.status().routingId, targetNodeRid);
|
|
336
|
+
return this.meshRuntime?.()?.meshNode?.(meshName);
|
|
320
337
|
}
|
|
321
338
|
isKnownBackendPeer(node, targetNodeRid) {
|
|
322
339
|
return node
|
|
@@ -5,5 +5,5 @@ export declare class ZLinkLocalSpotRouteTransport {
|
|
|
5
5
|
private readonly defaultRequestTimeoutMs;
|
|
6
6
|
constructor(dispatcher: ZLinkLocalSpotRouteDispatcher | undefined, defaultRequestTimeoutMs: number | undefined);
|
|
7
7
|
send(routerChannelId: string, spotId: RoutingId, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): Promise<void>;
|
|
8
|
-
request<TReply>(routerChannelId: string, spotId: RoutingId, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal): Promise<TReply>;
|
|
8
|
+
request<TReply>(routerChannelId: string, spotId: RoutingId, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, onAdmitted?: () => void): Promise<TReply>;
|
|
9
9
|
}
|
|
@@ -18,12 +18,13 @@ class ZLinkLocalSpotRouteTransport {
|
|
|
18
18
|
metadata
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
request(routerChannelId, spotId, packetName, request, timeoutMs, signal) {
|
|
21
|
+
request(routerChannelId, spotId, packetName, request, timeoutMs, signal, onAdmitted) {
|
|
22
22
|
if (this.dispatcher === undefined) {
|
|
23
23
|
throw new configuration_1.ZLinkConfigurationException(`Route channel '${routerChannelId}' could not dispatch local SPOT request.`);
|
|
24
24
|
}
|
|
25
25
|
const pending = this.dispatcher.request(spotId, packetName, request, {
|
|
26
26
|
channelName: routerChannelId,
|
|
27
|
+
onAdmitted,
|
|
27
28
|
signal
|
|
28
29
|
});
|
|
29
30
|
const effectiveTimeoutMs = timeoutMs ?? this.defaultRequestTimeoutMs;
|
|
@@ -7,6 +7,6 @@ export declare class ZLinkRouterSocketSpotRouteTransport {
|
|
|
7
7
|
private readonly sockets;
|
|
8
8
|
constructor(sockets: ZLinkChannelSocketRegistry);
|
|
9
9
|
send(target: ZLinkSpotRouteTarget, parts: readonly Message[], flags: ZLinkBackendSendFlags): Promise<void>;
|
|
10
|
-
request<TReply>(target: ZLinkSpotRouteTarget, parts: readonly Message[], codecs: ZLinkChannelEnvelopeCodecRegistry | undefined, flags: ZLinkBackendSendFlags, timeoutMs: number | undefined, signal?: AbortSignal): Promise<TReply>;
|
|
11
|
-
requestRaw(target: ZLinkSpotRouteTarget, request: Message, timeoutMs: number | undefined, signal?: AbortSignal): Promise<readonly Message[]>;
|
|
10
|
+
request<TReply>(target: ZLinkSpotRouteTarget, parts: readonly Message[], codecs: ZLinkChannelEnvelopeCodecRegistry | undefined, flags: ZLinkBackendSendFlags, timeoutMs: number | undefined, signal?: AbortSignal, onAdmitted?: () => void): Promise<TReply>;
|
|
11
|
+
requestRaw(target: ZLinkSpotRouteTarget, request: Message, timeoutMs: number | undefined, signal?: AbortSignal, onAdmitted?: () => void): Promise<readonly Message[]>;
|
|
12
12
|
}
|
|
@@ -17,10 +17,10 @@ class ZLinkRouterSocketSpotRouteTransport {
|
|
|
17
17
|
(0, channel_envelope_1.closeMessages)(parts);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
async request(target, parts, codecs, flags, timeoutMs, signal) {
|
|
20
|
+
async request(target, parts, codecs, flags, timeoutMs, signal, onAdmitted) {
|
|
21
21
|
const router = this.sockets.routeRouter(target.routerChannelId);
|
|
22
22
|
void flags;
|
|
23
|
-
const operation = router.requestToSpot(target.targetNodeRid, target.spotId, parts, timeoutMs);
|
|
23
|
+
const operation = router.requestToSpot(target.targetNodeRid, target.spotId, parts, timeoutMs, onAdmitted);
|
|
24
24
|
const replyParts = await (0, abort_1.awaitWithAbort)(operation, signal, () => {
|
|
25
25
|
void operation.then(channel_envelope_1.closeMessages, () => undefined);
|
|
26
26
|
});
|
|
@@ -32,9 +32,9 @@ class ZLinkRouterSocketSpotRouteTransport {
|
|
|
32
32
|
(0, channel_envelope_1.closeMessages)(parts);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
async requestRaw(target, request, timeoutMs, signal) {
|
|
35
|
+
async requestRaw(target, request, timeoutMs, signal, onAdmitted) {
|
|
36
36
|
const router = this.sockets.routeRouter(target.routerChannelId);
|
|
37
|
-
const operation = router.requestToSpot(target.targetNodeRid, target.spotId, [request], timeoutMs);
|
|
37
|
+
const operation = router.requestToSpot(target.targetNodeRid, target.spotId, [request], timeoutMs, onAdmitted);
|
|
38
38
|
return await (0, abort_1.awaitWithAbort)(operation, signal, () => {
|
|
39
39
|
void operation.then(channel_envelope_1.closeMessages, () => undefined);
|
|
40
40
|
});
|
|
@@ -4,7 +4,7 @@ import type { ZLinkSpotRouteTarget } from '../spots/spot-routing-internal';
|
|
|
4
4
|
export declare class ZLinkSourceSpotRouter {
|
|
5
5
|
private readonly defaultRequestTimeoutMs;
|
|
6
6
|
constructor(defaultRequestTimeoutMs: number | undefined);
|
|
7
|
-
request<TReply>(sourceSpot: ZLinkBackendSpot, target: ZLinkSpotRouteTarget, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal): Promise<TReply>;
|
|
7
|
+
request<TReply>(sourceSpot: ZLinkBackendSpot, target: ZLinkSpotRouteTarget, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, onAdmitted?: () => void): Promise<TReply>;
|
|
8
8
|
send(sourceSpot: ZLinkBackendSpot, target: ZLinkSpotRouteTarget, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): Promise<void>;
|
|
9
|
-
requestRaw(sourceSpot: ZLinkBackendSpot, target: ZLinkSpotRouteTarget, request: Message, timeoutMs: number | undefined, signal?: AbortSignal): Promise<readonly Message[]>;
|
|
9
|
+
requestRaw(sourceSpot: ZLinkBackendSpot, target: ZLinkSpotRouteTarget, request: Message, timeoutMs: number | undefined, signal?: AbortSignal, onAdmitted?: () => void): Promise<readonly Message[]>;
|
|
10
10
|
}
|
|
@@ -9,12 +9,12 @@ class ZLinkSourceSpotRouter {
|
|
|
9
9
|
constructor(defaultRequestTimeoutMs) {
|
|
10
10
|
this.defaultRequestTimeoutMs = defaultRequestTimeoutMs;
|
|
11
11
|
}
|
|
12
|
-
async request(sourceSpot, target, packetName, request, timeoutMs, signal) {
|
|
12
|
+
async request(sourceSpot, target, packetName, request, timeoutMs, signal, onAdmitted) {
|
|
13
13
|
(0, abort_1.throwIfAborted)(signal);
|
|
14
14
|
const parts = [
|
|
15
15
|
(0, spot_direct_envelope_1.encodeSpotDirectEnvelope)(1 /* ZLinkChannelMessageKind.Request */, target.routerChannelId, packetName, request)
|
|
16
16
|
];
|
|
17
|
-
const operation = sourceSpot.requestToSpot(target.targetNodeRid, target.spotId, parts, timeoutMs ?? this.defaultRequestTimeoutMs);
|
|
17
|
+
const operation = sourceSpot.requestToSpot(target.targetNodeRid, target.spotId, parts, timeoutMs ?? this.defaultRequestTimeoutMs, onAdmitted);
|
|
18
18
|
const replyParts = await (0, abort_1.awaitWithAbort)(operation, signal, () => {
|
|
19
19
|
void operation.then(channel_envelope_1.closeMessages, () => undefined);
|
|
20
20
|
});
|
|
@@ -37,9 +37,9 @@ class ZLinkSourceSpotRouter {
|
|
|
37
37
|
(0, channel_envelope_1.closeMessages)(parts);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
async requestRaw(sourceSpot, target, request, timeoutMs, signal) {
|
|
40
|
+
async requestRaw(sourceSpot, target, request, timeoutMs, signal, onAdmitted) {
|
|
41
41
|
(0, abort_1.throwIfAborted)(signal);
|
|
42
|
-
const operation = sourceSpot.requestToSpot(target.targetNodeRid, target.spotId, request, timeoutMs ?? this.defaultRequestTimeoutMs);
|
|
42
|
+
const operation = sourceSpot.requestToSpot(target.targetNodeRid, target.spotId, request, timeoutMs ?? this.defaultRequestTimeoutMs, onAdmitted);
|
|
43
43
|
return await (0, abort_1.awaitWithAbort)(operation, signal, () => {
|
|
44
44
|
void operation.then(channel_envelope_1.closeMessages, () => undefined);
|
|
45
45
|
});
|
|
@@ -8,6 +8,6 @@ export declare class ZLinkSpotNodeRouteTransport {
|
|
|
8
8
|
private readonly targets;
|
|
9
9
|
constructor(registration: ZLinkFrameworkRegistration, targets: ZLinkSpotRouteTargetResolver);
|
|
10
10
|
send(target: ZLinkSpotRouteTarget, parts: readonly Message[]): Promise<boolean>;
|
|
11
|
-
request<TReply>(target: ZLinkSpotRouteTarget, parts: readonly Message[], codecs: ZLinkChannelEnvelopeCodecRegistry | undefined, timeoutMs: number | undefined, signal?: AbortSignal): Promise<TReply> | undefined;
|
|
12
|
-
requestRaw(target: ZLinkSpotRouteTarget, request: Message, timeoutMs: number | undefined, signal?: AbortSignal): Promise<readonly Message[]> | undefined;
|
|
11
|
+
request<TReply>(target: ZLinkSpotRouteTarget, parts: readonly Message[], codecs: ZLinkChannelEnvelopeCodecRegistry | undefined, timeoutMs: number | undefined, signal?: AbortSignal, onAdmitted?: () => void): Promise<TReply> | undefined;
|
|
12
|
+
requestRaw(target: ZLinkSpotRouteTarget, request: Message, timeoutMs: number | undefined, signal?: AbortSignal, onAdmitted?: () => void): Promise<readonly Message[]> | undefined;
|
|
13
13
|
}
|
|
@@ -24,14 +24,14 @@ class ZLinkSpotNodeRouteTransport {
|
|
|
24
24
|
(0, channel_envelope_1.closeMessages)(parts);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
request(target, parts, codecs, timeoutMs, signal) {
|
|
27
|
+
request(target, parts, codecs, timeoutMs, signal, onAdmitted) {
|
|
28
28
|
const router = this.targets.spotNodeRouter(target.routerChannelId);
|
|
29
29
|
if (router === undefined) {
|
|
30
30
|
return undefined;
|
|
31
31
|
}
|
|
32
32
|
const effectiveTimeoutMs = timeoutMs ?? this.registration.requestTimeoutMs ?? Registration_1.DEFAULT_REQUEST_TIMEOUT_MS;
|
|
33
33
|
(0, abort_1.throwIfAborted)(signal);
|
|
34
|
-
const operation = router.requestToSpot(target.targetNodeRid, target.spotId, parts, effectiveTimeoutMs);
|
|
34
|
+
const operation = router.requestToSpot(target.targetNodeRid, target.spotId, parts, effectiveTimeoutMs, onAdmitted);
|
|
35
35
|
return (0, abort_1.awaitWithAbort)(operation, signal, () => {
|
|
36
36
|
void operation.then(channel_envelope_1.closeMessages, () => undefined);
|
|
37
37
|
}).then((replyParts) => {
|
|
@@ -44,14 +44,14 @@ class ZLinkSpotNodeRouteTransport {
|
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
-
requestRaw(target, request, timeoutMs, signal) {
|
|
47
|
+
requestRaw(target, request, timeoutMs, signal, onAdmitted) {
|
|
48
48
|
const router = this.targets.spotNodeRouter(target.routerChannelId);
|
|
49
49
|
if (router === undefined) {
|
|
50
50
|
return undefined;
|
|
51
51
|
}
|
|
52
52
|
const effectiveTimeoutMs = timeoutMs ?? this.registration.requestTimeoutMs ?? Registration_1.DEFAULT_REQUEST_TIMEOUT_MS;
|
|
53
53
|
(0, abort_1.throwIfAborted)(signal);
|
|
54
|
-
const operation = router.requestToSpot(target.targetNodeRid, target.spotId, request, effectiveTimeoutMs);
|
|
54
|
+
const operation = router.requestToSpot(target.targetNodeRid, target.spotId, request, effectiveTimeoutMs, onAdmitted);
|
|
55
55
|
return (0, abort_1.awaitWithAbort)(operation, signal, () => {
|
|
56
56
|
void operation.then(channel_envelope_1.closeMessages, () => undefined);
|
|
57
57
|
});
|
|
@@ -8,7 +8,7 @@ export declare class ZLinkSpotRouteBridgeTransport {
|
|
|
8
8
|
constructor(bridges: ReadonlyMap<string, ZLinkBackendSpotRouteBridge>, defaultRequestTimeoutMs: number | undefined);
|
|
9
9
|
has(routerChannelId: string): boolean;
|
|
10
10
|
send(target: ZLinkSpotRouteTarget, parts: readonly Message[]): Promise<void>;
|
|
11
|
-
request<TReply>(target: ZLinkSpotRouteTarget, parts: readonly Message[], codecs: ZLinkChannelEnvelopeCodecRegistry | undefined, timeoutMs: number | undefined, signal?: AbortSignal): Promise<TReply>;
|
|
12
|
-
requestRaw(target: ZLinkSpotRouteTarget, request: Message, timeoutMs: number | undefined, signal?: AbortSignal): Promise<readonly Message[]>;
|
|
11
|
+
request<TReply>(target: ZLinkSpotRouteTarget, parts: readonly Message[], codecs: ZLinkChannelEnvelopeCodecRegistry | undefined, timeoutMs: number | undefined, signal?: AbortSignal, onAdmitted?: () => void): Promise<TReply>;
|
|
12
|
+
requestRaw(target: ZLinkSpotRouteTarget, request: Message, timeoutMs: number | undefined, signal?: AbortSignal, onAdmitted?: () => void): Promise<readonly Message[]>;
|
|
13
13
|
private requireBridge;
|
|
14
14
|
}
|
|
@@ -24,11 +24,11 @@ class ZLinkSpotRouteBridgeTransport {
|
|
|
24
24
|
(0, channel_envelope_1.closeMessages)(parts);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
async request(target, parts, codecs, timeoutMs, signal) {
|
|
27
|
+
async request(target, parts, codecs, timeoutMs, signal, onAdmitted) {
|
|
28
28
|
const bridge = this.requireBridge(target.routerChannelId);
|
|
29
29
|
const operation = (0, channel_multipart_1.appendParts)(bridge.request(target.routerChannelId, target.targetNodeRid, target.spotId), parts)
|
|
30
30
|
.timeout(timeoutMs ?? 0)
|
|
31
|
-
.submit();
|
|
31
|
+
.submit(onAdmitted);
|
|
32
32
|
const replyParts = await (0, abort_1.awaitWithAbort)(operation, signal, () => {
|
|
33
33
|
void operation.then(channel_envelope_1.closeMessages, () => undefined);
|
|
34
34
|
});
|
|
@@ -40,13 +40,13 @@ class ZLinkSpotRouteBridgeTransport {
|
|
|
40
40
|
(0, channel_envelope_1.closeMessages)(parts);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
requestRaw(target, request, timeoutMs, signal) {
|
|
43
|
+
requestRaw(target, request, timeoutMs, signal, onAdmitted) {
|
|
44
44
|
const bridge = this.requireBridge(target.routerChannelId);
|
|
45
45
|
const operation = bridge
|
|
46
46
|
.request(target.routerChannelId, target.targetNodeRid, target.spotId)
|
|
47
47
|
.message(request)
|
|
48
48
|
.timeout(timeoutMs ?? this.defaultRequestTimeoutMs ?? 0)
|
|
49
|
-
.submit();
|
|
49
|
+
.submit(onAdmitted);
|
|
50
50
|
return (0, abort_1.awaitWithAbort)(operation, signal, () => {
|
|
51
51
|
void operation.then(channel_envelope_1.closeMessages, () => undefined);
|
|
52
52
|
});
|