@zlink-systems/framework 0.29.0 → 0.30.0
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/dist/.tsbuildinfo +1 -1
- package/dist/contracts/Configuration/Builders.d.ts +1 -2
- package/dist/contracts/Configuration/Configs.d.ts +0 -5
- package/dist/contracts/Configuration/RegistrationBuilders.js +6 -4
- package/dist/contracts/Configuration/RegistrationTypes.d.ts +1 -6
- package/dist/contracts/Configuration/RegistrationValidators.js +4 -4
- package/dist/contracts/Configuration/index.d.ts +1 -1
- package/dist/internal.d.ts +1 -0
- package/dist/internal.js +3 -1
- package/dist/runtime/actors/actor-handoff.d.ts +3 -2
- package/dist/runtime/actors/actor-handoff.js +9 -4
- package/dist/runtime/actors/actor-runtime-contracts.d.ts +1 -0
- package/dist/runtime/actors/index.d.ts +2 -0
- package/dist/runtime/actors/index.js +21 -6
- package/dist/runtime/application-jobs/application-ingress-record-owner.d.ts +3 -1
- package/dist/runtime/application-jobs/application-ingress-record-owner.js +6 -1
- package/dist/runtime/application-jobs/application-job-queue-scope.d.ts +3 -1
- package/dist/runtime/application-jobs/application-job-queue-scope.js +5 -0
- package/dist/runtime/application-jobs/contracts.d.ts +5 -1
- package/dist/runtime/backend/contracts/index.d.ts +10 -19
- package/dist/runtime/backend/mesh-completion-table.d.ts +6 -4
- package/dist/runtime/backend/mesh-completion-table.js +28 -18
- package/dist/runtime/backend/mesh-dispatch-pump.js +21 -25
- package/dist/runtime/backend/node/node-backend-adapter-factory.js +6 -1
- package/dist/runtime/backend/node/node-backend-adapter-support.d.ts +3 -3
- package/dist/runtime/backend/node/node-backend-adapter-support.js +24 -29
- package/dist/runtime/backend/node/node-mesh-backend-adapter.d.ts +1 -9
- package/dist/runtime/backend/node/node-mesh-backend-adapter.js +1 -1
- package/dist/runtime/backend/node/node-raw-binding-port.js +11 -6
- package/dist/runtime/backend/node/node-raw-mesh-backend.d.ts +10 -12
- package/dist/runtime/backend/node/node-raw-mesh-backend.js +64 -98
- package/dist/runtime/backend/node/node-socket-backend-adapter.js +10 -5
- package/dist/runtime/backend/raw-binding-port.d.ts +9 -2
- package/dist/runtime/channels/channel-receive-loops.js +3 -3
- package/dist/runtime/channels/channel-runtime-lifecycle.js +2 -1
- package/dist/runtime/channels/channel-socket-registry.d.ts +10 -3
- package/dist/runtime/channels/channel-socket-registry.js +59 -82
- package/dist/runtime/diagnostics/message-flow.d.ts +1 -0
- package/dist/runtime/diagnostics/message-flow.js +3 -3
- package/dist/runtime/foundation/raw-service-mesh-runtime.d.ts +15 -1
- package/dist/runtime/foundation/raw-service-mesh-runtime.js +193 -64
- package/dist/runtime/foundation/service-liveness-registry.d.ts +20 -8
- package/dist/runtime/foundation/service-liveness-registry.js +57 -44
- package/dist/runtime/foundation/service-mailbox.d.ts +3 -0
- package/dist/runtime/foundation/service-mailbox.js +2 -1
- package/dist/runtime/foundation/service-stateful-runtime.d.ts +7 -6
- package/dist/runtime/foundation/service-stateful-runtime.js +60 -41
- package/dist/runtime/foundation/service-stateful-wire-codec.d.ts +5 -2
- package/dist/runtime/foundation/service-stateful-wire-codec.js +43 -61
- package/dist/runtime/foundation/service-topology-registry.d.ts +5 -3
- package/dist/runtime/foundation/service-topology-registry.js +9 -4
- package/dist/runtime/handlers/handler-instance-scope.js +1 -1
- package/dist/runtime/host/actor-packet-relay.js +7 -7
- package/dist/runtime/host/actor-placement-coordinator.d.ts +2 -1
- package/dist/runtime/host/actor-placement-coordinator.js +2 -1
- package/dist/runtime/host/actor-runtime-options-factory.d.ts +2 -1
- package/dist/runtime/host/actor-runtime-options-factory.js +2 -1
- package/dist/runtime/host/application-job-queue.d.ts +11 -4
- package/dist/runtime/host/application-job-queue.js +66 -10
- package/dist/runtime/host/entry-actor-runtime.js +1 -1
- package/dist/runtime/host/index.d.ts +1 -1
- package/dist/runtime/host/index.js +18 -13
- package/dist/runtime/host/instance-activation-authority.d.ts +2 -1
- package/dist/runtime/host/instance-activation-authority.js +89 -25
- package/dist/runtime/host/service-relocation-host-runtime.js +2 -2
- package/dist/runtime/host/spot-address-transport.d.ts +1 -0
- package/dist/runtime/host/spot-address-transport.js +25 -12
- package/dist/runtime/host/spot-runtime-options-factory.js +2 -2
- package/dist/runtime/host/user-spot-creation-coordinator.d.ts +1 -0
- package/dist/runtime/host/user-spot-creation-coordinator.js +1 -0
- package/dist/runtime/locations/domain-store-contract.d.ts +3 -2
- package/dist/runtime/locations/in-memory-authority-store.d.ts +5 -2
- package/dist/runtime/locations/in-memory-authority-store.js +107 -14
- package/dist/runtime/locations/in-memory-location-store.d.ts +3 -3
- package/dist/runtime/locations/in-memory-location-store.js +31 -13
- package/dist/runtime/locations/internal-location-contracts.d.ts +8 -0
- package/dist/runtime/locations/location-store-repository.d.ts +4 -2
- package/dist/runtime/locations/location-store-repository.js +209 -33
- package/dist/runtime/locations/resolvers.d.ts +2 -1
- package/dist/runtime/locations/resolvers.js +10 -1
- package/dist/runtime/messaging/submission-result.d.ts +1 -1
- package/dist/runtime/messaging/submission-result.js +2 -2
- package/dist/runtime/spots/formal-remote-actor-admission-registry.d.ts +2 -0
- package/dist/runtime/spots/index.d.ts +4 -3
- package/dist/runtime/spots/index.js +14 -14
- package/dist/runtime/spots/spot-activation.d.ts +2 -1
- package/dist/runtime/spots/spot-activation.js +4 -4
- package/dist/runtime/spots/spot-actor-admission-coordinator.d.ts +2 -1
- package/dist/runtime/spots/spot-actor-admission-coordinator.js +11 -10
- package/dist/runtime/spots/spot-actor-packet-dispatch.d.ts +4 -1
- package/dist/runtime/spots/spot-actor-packet-dispatch.js +7 -5
- package/dist/runtime/spots/spot-actor-packet-drain.js +2 -0
- package/dist/runtime/spots/spot-actor-packet-relay-dispatch.js +1 -0
- package/dist/runtime/spots/spot-entry-activation.d.ts +1 -0
- package/dist/runtime/spots/spot-entry-activation.js +6 -1
- package/dist/runtime/spots/spot-node-runtime-manager.d.ts +3 -1
- package/dist/runtime/spots/spot-node-runtime-manager.js +10 -11
- package/dist/runtime/spots/spot-routing-internal.d.ts +6 -0
- package/dist/runtime/spots/spot-runtime-ports.d.ts +2 -1
- package/dist/runtime/spots/spot-serial-executor.d.ts +1 -0
- package/dist/runtime/spots/spot-serial-executor.js +10 -1
- package/dist/runtime/streams/stream-session-runtime.js +1 -1
- package/package.json +3 -3
- package/src/contracts/Configuration/Builders.ts +1 -2
- package/src/contracts/Configuration/Configs.ts +0 -6
- package/src/contracts/Configuration/RegistrationBuilders.ts +8 -12
- package/src/contracts/Configuration/RegistrationTypes.ts +1 -6
- package/src/contracts/Configuration/RegistrationValidators.ts +9 -10
- package/src/contracts/Configuration/index.ts +1 -6
- package/src/internal.ts +1 -0
- package/src/runtime/actors/actor-handoff.ts +13 -4
- package/src/runtime/actors/actor-runtime-contracts.ts +4 -0
- package/src/runtime/actors/index.ts +77 -42
- package/src/runtime/application-jobs/application-ingress-record-owner.ts +12 -2
- package/src/runtime/application-jobs/application-job-queue-scope.ts +6 -1
- package/src/runtime/application-jobs/contracts.ts +14 -1
- package/src/runtime/backend/contracts/index.ts +10 -18
- package/src/runtime/backend/mesh-completion-table.ts +36 -19
- package/src/runtime/backend/mesh-dispatch-pump.ts +19 -22
- package/src/runtime/backend/node/node-backend-adapter-factory.ts +12 -5
- package/src/runtime/backend/node/node-backend-adapter-support.ts +31 -29
- package/src/runtime/backend/node/node-mesh-backend-adapter.ts +3 -10
- package/src/runtime/backend/node/node-raw-binding-port.ts +19 -10
- package/src/runtime/backend/node/node-raw-mesh-backend.ts +81 -111
- package/src/runtime/backend/node/node-socket-backend-adapter.ts +12 -8
- package/src/runtime/backend/raw-binding-port.ts +12 -2
- package/src/runtime/channels/channel-receive-loops.ts +3 -3
- package/src/runtime/channels/channel-runtime-lifecycle.ts +7 -1
- package/src/runtime/channels/channel-socket-registry.ts +84 -130
- package/src/runtime/diagnostics/message-flow.ts +1 -1
- package/src/runtime/foundation/raw-service-mesh-runtime.ts +268 -70
- package/src/runtime/foundation/service-liveness-registry.ts +68 -59
- package/src/runtime/foundation/service-mailbox.ts +7 -1
- package/src/runtime/foundation/service-stateful-runtime.ts +109 -77
- package/src/runtime/foundation/service-stateful-wire-codec.ts +55 -79
- package/src/runtime/foundation/service-topology-registry.ts +13 -7
- package/src/runtime/handlers/handler-instance-scope.ts +2 -1
- package/src/runtime/host/actor-packet-relay.ts +7 -0
- package/src/runtime/host/actor-placement-coordinator.ts +8 -2
- package/src/runtime/host/actor-runtime-options-factory.ts +7 -0
- package/src/runtime/host/application-job-queue.ts +77 -10
- package/src/runtime/host/entry-actor-runtime.ts +1 -0
- package/src/runtime/host/index.ts +30 -7
- package/src/runtime/host/instance-activation-authority.ts +132 -27
- package/src/runtime/host/service-relocation-host-runtime.ts +2 -0
- package/src/runtime/host/spot-address-transport.ts +45 -22
- package/src/runtime/host/spot-runtime-options-factory.ts +2 -0
- package/src/runtime/host/user-spot-creation-coordinator.ts +8 -0
- package/src/runtime/locations/domain-store-contract.ts +6 -2
- package/src/runtime/locations/in-memory-authority-store.ts +153 -12
- package/src/runtime/locations/in-memory-location-store.ts +39 -13
- package/src/runtime/locations/internal-location-contracts.ts +10 -0
- package/src/runtime/locations/location-store-repository.ts +295 -36
- package/src/runtime/locations/resolvers.ts +25 -2
- package/src/runtime/messaging/submission-result.ts +2 -2
- package/src/runtime/spots/formal-remote-actor-admission-registry.ts +2 -0
- package/src/runtime/spots/index.ts +16 -0
- package/src/runtime/spots/spot-activation.ts +5 -0
- package/src/runtime/spots/spot-actor-admission-coordinator.ts +13 -0
- package/src/runtime/spots/spot-actor-packet-dispatch.ts +10 -0
- package/src/runtime/spots/spot-actor-packet-drain.ts +2 -0
- package/src/runtime/spots/spot-actor-packet-relay-dispatch.ts +1 -0
- package/src/runtime/spots/spot-entry-activation.ts +7 -0
- package/src/runtime/spots/spot-node-runtime-manager.ts +14 -12
- package/src/runtime/spots/spot-routing-internal.ts +14 -0
- package/src/runtime/spots/spot-runtime-ports.ts +2 -0
- package/src/runtime/spots/spot-serial-executor.ts +10 -4
- package/src/runtime/streams/stream-session-runtime.ts +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ApplicationJobOrigin } from '../application-jobs/contracts';
|
|
1
2
|
import type {
|
|
2
3
|
ActorRef,
|
|
3
4
|
RoutingId,
|
|
@@ -857,6 +858,7 @@ export class ZLinkSpotActivationLifecycle {
|
|
|
857
858
|
}
|
|
858
859
|
|
|
859
860
|
async dispatchActorPacket(
|
|
861
|
+
origin: ApplicationJobOrigin,
|
|
860
862
|
activation: ZLinkSpotActivation,
|
|
861
863
|
actorId: string,
|
|
862
864
|
parts: readonly Message[],
|
|
@@ -867,6 +869,7 @@ export class ZLinkSpotActivationLifecycle {
|
|
|
867
869
|
messageFollowOrigin?: ZLinkMessageFollowOrigin
|
|
868
870
|
): Promise<unknown> {
|
|
869
871
|
return await this.actorAdmission.dispatchActorPacket(
|
|
872
|
+
origin,
|
|
870
873
|
activation,
|
|
871
874
|
actorId,
|
|
872
875
|
parts,
|
|
@@ -880,6 +883,7 @@ export class ZLinkSpotActivationLifecycle {
|
|
|
880
883
|
|
|
881
884
|
/** @internal Dispatches a held Actor record after its handoff owner releases it. */
|
|
882
885
|
dispatchActorPacketDirect(
|
|
886
|
+
origin: ApplicationJobOrigin,
|
|
883
887
|
activation: ZLinkSpotActivation,
|
|
884
888
|
actorId: string,
|
|
885
889
|
parts: readonly Message[],
|
|
@@ -888,6 +892,7 @@ export class ZLinkSpotActivationLifecycle {
|
|
|
888
892
|
fallbackActorRef?: ActorRef
|
|
889
893
|
): Promise<unknown> {
|
|
890
894
|
return this.actorAdmission.dispatchActorPacketDirect(
|
|
895
|
+
origin,
|
|
891
896
|
activation,
|
|
892
897
|
actorId,
|
|
893
898
|
parts,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { currentApplicationJobOrigin } from '../application-jobs/application-job-queue-scope';
|
|
2
|
+
import type { ApplicationJobOrigin } from '../application-jobs/contracts';
|
|
1
3
|
import type { ActorRef, ZLinkActor } from '../../contracts';
|
|
2
4
|
import type { Message } from '../../contracts/Common/Message';
|
|
3
5
|
import type { ZLinkMessageFollowOrigin } from '../foundation/service-runtime-contracts';
|
|
@@ -39,6 +41,7 @@ export class ZLinkSpotActorAdmissionCoordinator {
|
|
|
39
41
|
constructor(private readonly options: AdmissionOptions) {}
|
|
40
42
|
|
|
41
43
|
async dispatchActorPacket(
|
|
44
|
+
origin: ApplicationJobOrigin,
|
|
42
45
|
activation: ZLinkSpotActivation,
|
|
43
46
|
actorId: string,
|
|
44
47
|
parts: readonly Message[],
|
|
@@ -49,6 +52,7 @@ export class ZLinkSpotActorAdmissionCoordinator {
|
|
|
49
52
|
messageFollowOrigin?: ZLinkMessageFollowOrigin
|
|
50
53
|
): Promise<unknown> {
|
|
51
54
|
const handoff = this.options.actorHandoffRuntime?.capture(
|
|
55
|
+
origin,
|
|
52
56
|
actorId,
|
|
53
57
|
parts,
|
|
54
58
|
returnResponse,
|
|
@@ -63,6 +67,7 @@ export class ZLinkSpotActorAdmissionCoordinator {
|
|
|
63
67
|
replayFallbackActorRef
|
|
64
68
|
) =>
|
|
65
69
|
this.dispatchActorPacketDirect(
|
|
70
|
+
origin,
|
|
66
71
|
activation,
|
|
67
72
|
actorId,
|
|
68
73
|
replayedParts,
|
|
@@ -73,6 +78,7 @@ export class ZLinkSpotActorAdmissionCoordinator {
|
|
|
73
78
|
);
|
|
74
79
|
if (handoff !== undefined) return await handoff;
|
|
75
80
|
return await this.dispatchActorPacketDirect(
|
|
81
|
+
origin,
|
|
76
82
|
activation,
|
|
77
83
|
actorId,
|
|
78
84
|
parts,
|
|
@@ -116,6 +122,7 @@ export class ZLinkSpotActorAdmissionCoordinator {
|
|
|
116
122
|
packets: {
|
|
117
123
|
handle: (delivery) =>
|
|
118
124
|
this.dispatchActorPacket(
|
|
125
|
+
'remote',
|
|
119
126
|
activation,
|
|
120
127
|
delivery.actorId,
|
|
121
128
|
delivery.parts,
|
|
@@ -149,6 +156,7 @@ export class ZLinkSpotActorAdmissionCoordinator {
|
|
|
149
156
|
|
|
150
157
|
/** @internal Dispatches a coordinator-owned replay without recapturing it. */
|
|
151
158
|
dispatchActorPacketDirect(
|
|
159
|
+
origin: ApplicationJobOrigin,
|
|
152
160
|
activation: ZLinkSpotActivation,
|
|
153
161
|
actorId: string,
|
|
154
162
|
parts: readonly Message[],
|
|
@@ -159,6 +167,7 @@ export class ZLinkSpotActorAdmissionCoordinator {
|
|
|
159
167
|
): Promise<unknown> {
|
|
160
168
|
return activation.executeActor(actorId, (actorSerial) =>
|
|
161
169
|
this.dispatchActorPacketInActorTurn(
|
|
170
|
+
origin,
|
|
162
171
|
activation,
|
|
163
172
|
actorSerial,
|
|
164
173
|
actorId,
|
|
@@ -190,6 +199,7 @@ export class ZLinkSpotActorAdmissionCoordinator {
|
|
|
190
199
|
record.drain((parts, returnResponse, remoteBoundSessionTarget, fallbackActorRef) =>
|
|
191
200
|
executeChild((actorSerial) =>
|
|
192
201
|
this.dispatchActorPacketInActorTurn(
|
|
202
|
+
currentApplicationJobOrigin(),
|
|
193
203
|
activation,
|
|
194
204
|
actorSerial,
|
|
195
205
|
actorId,
|
|
@@ -217,6 +227,7 @@ export class ZLinkSpotActorAdmissionCoordinator {
|
|
|
217
227
|
}
|
|
218
228
|
|
|
219
229
|
private dispatchActorPacketInActorTurn(
|
|
230
|
+
origin: ApplicationJobOrigin,
|
|
220
231
|
activation: ZLinkSpotActivation,
|
|
221
232
|
actorSerial: ZLinkSpotSerialTurnExecutor,
|
|
222
233
|
actorId: string,
|
|
@@ -250,6 +261,7 @@ export class ZLinkSpotActorAdmissionCoordinator {
|
|
|
250
261
|
dispatchErrors: this.options.dispatchErrors,
|
|
251
262
|
routeToActorJoinPrewarm: this.options.routeToActorJoinPrewarm
|
|
252
263
|
}).dispatch(
|
|
264
|
+
origin,
|
|
253
265
|
actorId,
|
|
254
266
|
parts,
|
|
255
267
|
returnResponse,
|
|
@@ -305,6 +317,7 @@ export class ZLinkSpotActorAdmissionCoordinator {
|
|
|
305
317
|
backlog,
|
|
306
318
|
(parts, returnResponse, remoteBoundSessionTarget, fallbackActorRef) =>
|
|
307
319
|
this.dispatchActorPacketDirect(
|
|
320
|
+
'remote',
|
|
308
321
|
activation,
|
|
309
322
|
actor.context.actorId,
|
|
310
323
|
parts,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ApplicationJobOrigin } from '../application-jobs/contracts';
|
|
1
2
|
import {
|
|
2
3
|
ZLinkFrameworkInternalErrorKind,
|
|
3
4
|
createInternalFrameworkException,
|
|
@@ -57,6 +58,7 @@ export interface ZLinkActorRequestTerminal {
|
|
|
57
58
|
|
|
58
59
|
/** One admitted Actor packet and the routing context that must move with it. */
|
|
59
60
|
export interface ZLinkActorPacketDelivery {
|
|
61
|
+
readonly origin: ApplicationJobOrigin;
|
|
60
62
|
readonly actorId: string;
|
|
61
63
|
readonly parts: readonly Message[];
|
|
62
64
|
readonly returnResponse: boolean;
|
|
@@ -79,6 +81,7 @@ export type ZLinkRouteToActorJoinPrewarm = (
|
|
|
79
81
|
actorId: string,
|
|
80
82
|
objectGeneration: bigint,
|
|
81
83
|
arrival: {
|
|
84
|
+
readonly origin: ApplicationJobOrigin;
|
|
82
85
|
readonly header: Buffer;
|
|
83
86
|
readonly payload: Buffer;
|
|
84
87
|
readonly returnResponse: boolean;
|
|
@@ -133,6 +136,7 @@ export class ZLinkSpotActorPacketDispatch {
|
|
|
133
136
|
constructor(private readonly options: ZLinkSpotActorPacketDispatchOptions) {}
|
|
134
137
|
|
|
135
138
|
dispatch(
|
|
139
|
+
origin: ApplicationJobOrigin,
|
|
136
140
|
actorId: string,
|
|
137
141
|
parts: readonly Message[],
|
|
138
142
|
returnResponse = false,
|
|
@@ -141,6 +145,7 @@ export class ZLinkSpotActorPacketDispatch {
|
|
|
141
145
|
requestTerminal?: ZLinkActorRequestTerminal
|
|
142
146
|
): Promise<unknown> {
|
|
143
147
|
return this.dispatchDelivery({
|
|
148
|
+
origin,
|
|
144
149
|
actorId,
|
|
145
150
|
parts,
|
|
146
151
|
returnResponse,
|
|
@@ -212,6 +217,7 @@ export class ZLinkSpotActorPacketDispatch {
|
|
|
212
217
|
const actor = this.options.resolveActor(actorId);
|
|
213
218
|
if (actor === undefined) {
|
|
214
219
|
return this.handleMissingActor(
|
|
220
|
+
delivery.origin,
|
|
215
221
|
actorId,
|
|
216
222
|
parts,
|
|
217
223
|
header,
|
|
@@ -250,6 +256,7 @@ export class ZLinkSpotActorPacketDispatch {
|
|
|
250
256
|
}
|
|
251
257
|
|
|
252
258
|
private async handleMissingActor(
|
|
259
|
+
origin: ApplicationJobOrigin,
|
|
253
260
|
actorId: string,
|
|
254
261
|
parts: readonly Message[],
|
|
255
262
|
header: ReturnType<typeof decodeStreamHeader>,
|
|
@@ -271,6 +278,7 @@ export class ZLinkSpotActorPacketDispatch {
|
|
|
271
278
|
(messageKind !== ZLinkDispatchMessageKind.ActorRequest || requestTerminal !== undefined)
|
|
272
279
|
) {
|
|
273
280
|
const parked = this.parkForActorJoinPrewarm(
|
|
281
|
+
origin,
|
|
274
282
|
actorId,
|
|
275
283
|
parts,
|
|
276
284
|
messageKind,
|
|
@@ -328,6 +336,7 @@ export class ZLinkSpotActorPacketDispatch {
|
|
|
328
336
|
* lifetime.
|
|
329
337
|
*/
|
|
330
338
|
private parkForActorJoinPrewarm(
|
|
339
|
+
origin: ApplicationJobOrigin,
|
|
331
340
|
actorId: string,
|
|
332
341
|
parts: readonly Message[],
|
|
333
342
|
messageKind: ZLinkDispatchMessageKind,
|
|
@@ -369,6 +378,7 @@ export class ZLinkSpotActorPacketDispatch {
|
|
|
369
378
|
actorId,
|
|
370
379
|
fallbackActorRef.objectGeneration,
|
|
371
380
|
{
|
|
381
|
+
origin,
|
|
372
382
|
header: Buffer.from(parts[0].data()),
|
|
373
383
|
payload: Buffer.from(parts[1].data()),
|
|
374
384
|
returnResponse,
|
|
@@ -135,6 +135,7 @@ export class ZLinkSpotActorPacketDrain {
|
|
|
135
135
|
await this.dispatchNoBindActorRequest(noBindInfo, actorId, parts, actorRef);
|
|
136
136
|
} else {
|
|
137
137
|
await this.options.actorPacketHandler({
|
|
138
|
+
origin: 'remote',
|
|
138
139
|
actorId,
|
|
139
140
|
parts,
|
|
140
141
|
returnResponse: false,
|
|
@@ -198,6 +199,7 @@ export class ZLinkSpotActorPacketDrain {
|
|
|
198
199
|
): Promise<void> {
|
|
199
200
|
try {
|
|
200
201
|
const response = await this.options.actorPacketHandler?.({
|
|
202
|
+
origin: 'remote',
|
|
201
203
|
actorId,
|
|
202
204
|
parts,
|
|
203
205
|
returnResponse: true,
|
|
@@ -111,6 +111,7 @@ export class ZLinkSpotActorPacketRelayDispatch {
|
|
|
111
111
|
actorPacketRelay.messageFollowContext !== undefined &&
|
|
112
112
|
remoteBoundSessionTarget !== undefined;
|
|
113
113
|
const response = await this.options.actorPacketHandler({
|
|
114
|
+
origin: 'remote',
|
|
114
115
|
actorId: actorPacketRelay.actorId,
|
|
115
116
|
parts: [header, payload],
|
|
116
117
|
returnResponse: !followedBoundSessionReply,
|
|
@@ -378,6 +378,10 @@ export class ZLinkEntrySpotActivation {
|
|
|
378
378
|
return this.spotSerialExecutor.executeActor(actorId, operation);
|
|
379
379
|
}
|
|
380
380
|
|
|
381
|
+
terminateActor(actorId: string, terminal: () => Promise<void>): Promise<void> {
|
|
382
|
+
return this.spotSerialExecutor.terminateActor(actorId, terminal);
|
|
383
|
+
}
|
|
384
|
+
|
|
381
385
|
/**
|
|
382
386
|
* Entry Spot membership does not have an application admission callback.
|
|
383
387
|
* The shared core round-trip therefore accepts a valid returning Actor and
|
|
@@ -461,6 +465,7 @@ export class ZLinkEntrySpotActivation {
|
|
|
461
465
|
messageFollowOrigin
|
|
462
466
|
} = delivery;
|
|
463
467
|
const handoff = this.options.actorHandoffRuntime?.capture(
|
|
468
|
+
delivery.origin,
|
|
464
469
|
actorId,
|
|
465
470
|
parts,
|
|
466
471
|
returnResponse,
|
|
@@ -476,6 +481,7 @@ export class ZLinkEntrySpotActivation {
|
|
|
476
481
|
) =>
|
|
477
482
|
this.spotSerialExecutor.executeActor(actorId, () =>
|
|
478
483
|
this.dispatchActorPacketInsideMailbox({
|
|
484
|
+
origin: delivery.origin,
|
|
479
485
|
actorId,
|
|
480
486
|
parts: replayedParts,
|
|
481
487
|
returnResponse: replayReturnResponse,
|
|
@@ -499,6 +505,7 @@ export class ZLinkEntrySpotActivation {
|
|
|
499
505
|
(parts, returnResponse, remoteBoundSessionTarget, fallbackActorRef) =>
|
|
500
506
|
this.spotSerialExecutor.executeActor(actor.context.actorId, () =>
|
|
501
507
|
this.dispatchActorPacketInsideMailbox({
|
|
508
|
+
origin: 'remote',
|
|
502
509
|
actorId: actor.context.actorId,
|
|
503
510
|
parts,
|
|
504
511
|
returnResponse,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ApplicationJobOrigin } from '../application-jobs/contracts';
|
|
1
2
|
import { RuntimeDisposal } from '../disposal';
|
|
2
3
|
import { randomUUID } from 'node:crypto';
|
|
3
4
|
import {
|
|
@@ -62,7 +63,6 @@ import {
|
|
|
62
63
|
} from '../configuration';
|
|
63
64
|
import type { ZLinkRuntimeEventPublisher } from '../diagnostics';
|
|
64
65
|
import { runWithOutboundFlow } from '../diagnostics/flow-context';
|
|
65
|
-
import { requireZLinkInfrastructureExecutionArea } from '../execution';
|
|
66
66
|
import type { ZLinkListenerRecords } from '../foundation/listener-records';
|
|
67
67
|
import {
|
|
68
68
|
type ZLinkMessageFollowOrigin,
|
|
@@ -285,6 +285,7 @@ export class ZLinkSpotNodeRuntimeManager {
|
|
|
285
285
|
routingId,
|
|
286
286
|
receiveTimeoutMs: spotNode.router?.receiveTimeoutMs,
|
|
287
287
|
applicationJobQueue: this.applicationJobQueue,
|
|
288
|
+
infrastructureTaskRunner: this.options.detachedTaskRunner,
|
|
288
289
|
applicationJobReceiveFlowFailureSink: this.options.applicationJobReceiveFlowFailureSink,
|
|
289
290
|
peerAdmissionSealed: () => this.options.peerAdmissionSealed?.(spotNodeName) ?? false
|
|
290
291
|
});
|
|
@@ -324,6 +325,9 @@ export class ZLinkSpotNodeRuntimeManager {
|
|
|
324
325
|
let pump: ZLinkMeshDispatchPump | undefined;
|
|
325
326
|
const completions = new ZLinkMeshCompletionTable();
|
|
326
327
|
try {
|
|
328
|
+
node.setCompletionHandler((terminal, materialize) =>
|
|
329
|
+
completions.complete(terminal, materialize)
|
|
330
|
+
);
|
|
327
331
|
node.setBind(bind);
|
|
328
332
|
if (spotNode.router?.advertiseHost !== undefined) {
|
|
329
333
|
node.setAdvertiseHost(spotNode.router.advertiseHost);
|
|
@@ -783,6 +787,13 @@ export class ZLinkSpotNodeRuntimeManager {
|
|
|
783
787
|
return activation?.notifyJoinActor(actor, signal) ?? Promise.resolve();
|
|
784
788
|
}
|
|
785
789
|
|
|
790
|
+
terminateActorActivation(actor: ZLinkActor, terminal: () => Promise<void>): Promise<void> {
|
|
791
|
+
const activation = this.entryActivations.get(actor.context.meshName);
|
|
792
|
+
return activation === undefined
|
|
793
|
+
? terminal()
|
|
794
|
+
: activation.terminateActor(actor.context.actorId, terminal);
|
|
795
|
+
}
|
|
796
|
+
|
|
786
797
|
notifyPrimaryEntrySpotActorLeft(
|
|
787
798
|
actor: ZLinkActor,
|
|
788
799
|
signal?: AbortSignal,
|
|
@@ -864,17 +875,6 @@ export class ZLinkSpotNodeRuntimeManager {
|
|
|
864
875
|
owner: ReadyRecord,
|
|
865
876
|
record: ReceiveRecord
|
|
866
877
|
): Promise<void> {
|
|
867
|
-
if (record.kind === ReceiveKind.Completion) {
|
|
868
|
-
requireZLinkInfrastructureExecutionArea();
|
|
869
|
-
const completions = this.meshCompletions.get(meshName);
|
|
870
|
-
if (completions === undefined) {
|
|
871
|
-
throw new ZLinkConfigurationException(
|
|
872
|
-
`MeshNode '${meshName}' received a completion before its completion table was registered.`
|
|
873
|
-
);
|
|
874
|
-
}
|
|
875
|
-
completions.complete(record);
|
|
876
|
-
return;
|
|
877
|
-
}
|
|
878
878
|
const node = this.meshNodes.get(meshName);
|
|
879
879
|
const targetsEntrySpot =
|
|
880
880
|
owner.spotId === null ||
|
|
@@ -1044,6 +1044,7 @@ export class ZLinkSpotNodeRuntimeManager {
|
|
|
1044
1044
|
}
|
|
1045
1045
|
|
|
1046
1046
|
async dispatchEntryActorPacket(
|
|
1047
|
+
origin: ApplicationJobOrigin,
|
|
1047
1048
|
actorId: string,
|
|
1048
1049
|
parts: readonly Message[],
|
|
1049
1050
|
returnResponse = false,
|
|
@@ -1083,6 +1084,7 @@ export class ZLinkSpotNodeRuntimeManager {
|
|
|
1083
1084
|
);
|
|
1084
1085
|
}
|
|
1085
1086
|
return await activation.dispatchActorPacket({
|
|
1087
|
+
origin,
|
|
1086
1088
|
actorId,
|
|
1087
1089
|
parts,
|
|
1088
1090
|
returnResponse,
|
|
@@ -2,6 +2,11 @@ import type { RoutingId } from '../../contracts/Common';
|
|
|
2
2
|
import type { ZLinkFrameworkRuntimeState, ZLinkSpotKind } from '../../contracts';
|
|
3
3
|
|
|
4
4
|
export interface ZLinkSpotRouteResolver {
|
|
5
|
+
resolve(
|
|
6
|
+
spotId: RoutingId,
|
|
7
|
+
signal: AbortSignal | undefined,
|
|
8
|
+
instanceIntent: true
|
|
9
|
+
): Promise<ZLinkSpotRouteTarget | ZLinkInstanceReactivationRoute>;
|
|
5
10
|
resolve(spotId: RoutingId, signal?: AbortSignal): Promise<ZLinkSpotRouteTarget>;
|
|
6
11
|
invalidate?(spotId: RoutingId): void;
|
|
7
12
|
}
|
|
@@ -28,3 +33,12 @@ export interface ZLinkSpotRouteTarget {
|
|
|
28
33
|
/** Current state of the owning MeshNode, when the route was resolved from Location Store. */
|
|
29
34
|
readonly targetNodeState?: ZLinkFrameworkRuntimeState;
|
|
30
35
|
}
|
|
36
|
+
|
|
37
|
+
export interface ZLinkInstanceReactivationRoute extends Pick<
|
|
38
|
+
ZLinkSpotRouteTarget,
|
|
39
|
+
'spotId' | 'spotKind' | 'stableType'
|
|
40
|
+
> {
|
|
41
|
+
readonly kind: 'coldActivation';
|
|
42
|
+
readonly meshName: string;
|
|
43
|
+
readonly stableType: string;
|
|
44
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ApplicationJobOrigin } from '../application-jobs/contracts';
|
|
1
2
|
import type {
|
|
2
3
|
ActorRef,
|
|
3
4
|
RoutingId,
|
|
@@ -151,6 +152,7 @@ export interface ZLinkSpotBoundSessionRuntime {
|
|
|
151
152
|
|
|
152
153
|
export interface ZLinkSpotActorHandoffRuntime {
|
|
153
154
|
capture(
|
|
155
|
+
origin: ApplicationJobOrigin,
|
|
154
156
|
actorId: string,
|
|
155
157
|
parts: readonly Message[],
|
|
156
158
|
returnResponse?: boolean,
|
|
@@ -51,10 +51,8 @@ export class ZLinkSpotSerialExecutor {
|
|
|
51
51
|
operation: (serial: ZLinkSpotSerialTurnExecutor) => Promise<T> | T,
|
|
52
52
|
workOptions?: ZLinkSerialWorkOptions
|
|
53
53
|
): Promise<T> {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
workOptions
|
|
57
|
-
);
|
|
54
|
+
const serial = this.actorSerial(actorId);
|
|
55
|
+
return this.actorExecutor(actorId).execute(() => operation(serial), workOptions);
|
|
58
56
|
}
|
|
59
57
|
|
|
60
58
|
/** @internal Restores a durable Actor FIFO prefix without starting it. */
|
|
@@ -102,6 +100,14 @@ export class ZLinkSpotSerialExecutor {
|
|
|
102
100
|
return this.spotSerial.execute(operation, { ...workOptions, lane: 'lifecycle' });
|
|
103
101
|
}
|
|
104
102
|
|
|
103
|
+
async terminateActor(actorId: string, terminal: () => Promise<void>): Promise<void> {
|
|
104
|
+
const executor = this.actorExecutor(actorId);
|
|
105
|
+
await executor.close();
|
|
106
|
+
await terminal();
|
|
107
|
+
if (this.actorExecutors.get(actorId) === executor) this.actorExecutors.delete(actorId);
|
|
108
|
+
this.actorSerials.delete(actorId);
|
|
109
|
+
}
|
|
110
|
+
|
|
105
111
|
/**
|
|
106
112
|
* Makes all child queues unreachable and completes them in one synchronous
|
|
107
113
|
* ownership turn. Already accepted work remains drainable.
|
|
@@ -1048,7 +1048,7 @@ export class ZLinkStreamSessionNodeRuntime {
|
|
|
1048
1048
|
let packet: ZLinkBackendStreamPacket | undefined;
|
|
1049
1049
|
let packetTransferred = false;
|
|
1050
1050
|
try {
|
|
1051
|
-
permit = await this.options.applicationJobQueue.acquire(signal);
|
|
1051
|
+
permit = await this.options.applicationJobQueue.acquire(signal, 'remote');
|
|
1052
1052
|
if (this.isReceiveStopped(signal)) {
|
|
1053
1053
|
permit.releaseAfterInternalProcessing();
|
|
1054
1054
|
break;
|