@zlink-systems/framework 0.31.0 → 0.32.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/Actors/ZLinkActor.d.ts +2 -0
- package/dist/contracts/Actors/ZLinkSessionBindingIdentity.d.ts +6 -0
- package/dist/contracts/Actors/ZLinkSessionBindingIdentity.js +2 -0
- package/dist/contracts/Actors/index.d.ts +1 -0
- package/dist/contracts/Actors/index.js +1 -0
- package/dist/contracts/Common/payload-slab.d.ts +4 -0
- package/dist/contracts/Common/payload-slab.js +30 -0
- package/dist/contracts/Handlers/Contexts.d.ts +1 -0
- package/dist/internal.d.ts +9 -0
- package/dist/internal.js +23 -1
- package/dist/runtime/actors/actor-client.d.ts +1 -1
- package/dist/runtime/actors/actor-client.js +32 -23
- package/dist/runtime/actors/actor-mailbox.d.ts +1 -1
- package/dist/runtime/actors/actor-runtime-state.d.ts +1 -1
- package/dist/runtime/actors/spot-actor-dispatch.d.ts +4 -2
- package/dist/runtime/actors/spot-actor-dispatch.js +2 -1
- package/dist/runtime/application-jobs/application-ingress-record-owner.d.ts +1 -0
- package/dist/runtime/application-jobs/application-ingress-record-owner.js +3 -0
- package/dist/runtime/backend/contracts/index.d.ts +2 -0
- package/dist/runtime/backend/mesh-completion-table.d.ts +1 -0
- package/dist/runtime/backend/mesh-completion-table.js +1 -0
- package/dist/runtime/backend/node/node-mesh-backend-adapter.js +5 -1
- package/dist/runtime/backend/node/node-raw-binding-port.d.ts +7 -2
- package/dist/runtime/backend/node/node-raw-binding-port.js +17 -11
- package/dist/runtime/backend/node/node-raw-mesh-backend.d.ts +2 -2
- package/dist/runtime/backend/node/node-raw-mesh-backend.js +15 -8
- package/dist/runtime/channels/channel-dispatch-pipeline.d.ts +7 -6
- package/dist/runtime/channels/channel-dispatch-pipeline.js +1 -0
- package/dist/runtime/channels/channel-dispatchers.d.ts +7 -3
- package/dist/runtime/channels/channel-dispatchers.js +27 -19
- package/dist/runtime/channels/channel-envelope.js +543 -23
- package/dist/runtime/channels/channel-receive-loops.d.ts +9 -6
- package/dist/runtime/channels/channel-receive-loops.js +59 -18
- package/dist/runtime/channels/channel-runtime-lifecycle.d.ts +22 -3
- package/dist/runtime/channels/channel-socket-registry.d.ts +22 -4
- package/dist/runtime/diagnostics/runtime-metrics.d.ts +1 -1
- package/dist/runtime/diagnostics/runtime-metrics.js +2 -1
- package/dist/runtime/execution/serial-execution-queue.d.ts +26 -13
- package/dist/runtime/foundation/raw-service-mesh-runtime.d.ts +27 -11
- package/dist/runtime/foundation/raw-service-mesh-runtime.js +29 -25
- package/dist/runtime/foundation/service-liveness-registry.d.ts +1 -1
- package/dist/runtime/foundation/service-mailbox.d.ts +3 -1
- package/dist/runtime/foundation/service-mailbox.js +4 -1
- package/dist/runtime/foundation/service-runtime-contracts.d.ts +3 -1
- package/dist/runtime/foundation/service-stateful-registry.d.ts +2 -0
- package/dist/runtime/foundation/service-stateful-registry.js +28 -12
- package/dist/runtime/foundation/service-stateful-runtime.d.ts +51 -19
- package/dist/runtime/foundation/service-stateful-runtime.js +54 -5
- package/dist/runtime/foundation/service-stateful-wire-codec.d.ts +3 -0
- package/dist/runtime/foundation/service-stateful-wire-codec.js +15 -0
- package/dist/runtime/foundation/service-wire-constants.generated.d.ts +1 -0
- package/dist/runtime/foundation/service-wire-constants.generated.js +12 -0
- package/dist/runtime/foundation/service-wire-m6a-codec.d.ts +2 -0
- package/dist/runtime/foundation/service-wire-m6a-codec.js +17 -7
- package/dist/runtime/host/actor-placement-coordinator.d.ts +1 -1
- package/dist/runtime/host/actor-transfer-runtime.d.ts +3 -3
- package/dist/runtime/host/application-job-queue.d.ts +1 -1
- package/dist/runtime/host/index.d.ts +89 -36
- package/dist/runtime/host/index.js +101 -7
- package/dist/runtime/host/location-runtime-owner.d.ts +2 -2
- package/dist/runtime/host/service-relocation-host-runtime.d.ts +181 -44
- package/dist/runtime/host/service-relocation-host-runtime.js +47 -13
- package/dist/runtime/host/spot-address-transport.js +50 -42
- package/dist/runtime/locations/auto-connect-loop.d.ts +0 -1
- package/dist/runtime/locations/auto-connect-loop.js +25 -19
- package/dist/runtime/locations/auto-connect-planner.js +2 -5
- package/dist/runtime/locations/auto-connect-reconciler.d.ts +1 -0
- package/dist/runtime/locations/auto-connect-reconciler.js +35 -23
- package/dist/runtime/locations/in-memory-location-store.d.ts +0 -2
- package/dist/runtime/locations/in-memory-location-store.js +1 -38
- package/dist/runtime/locations/location-store-repository.d.ts +0 -1
- package/dist/runtime/locations/location-store-repository.js +13 -115
- package/dist/runtime/locations/runtime.d.ts +3 -3
- package/dist/runtime/locations/runtime.js +12 -16
- package/dist/runtime/messaging/creation-payload-codec.js +2 -2
- package/dist/runtime/protocol/service_wire_codec.generated.d.ts +4 -0
- package/dist/runtime/protocol/service_wire_codec.generated.js +17 -7
- package/dist/runtime/spots/index.d.ts +20 -5
- package/dist/runtime/spots/index.js +14 -0
- package/dist/runtime/spots/spot-actor-admission-coordinator.d.ts +3 -3
- package/dist/runtime/spots/spot-actor-packet-dispatch.d.ts +1 -0
- package/dist/runtime/spots/spot-actor-packet-dispatch.js +13 -7
- package/dist/runtime/spots/spot-actor-packet-drain.d.ts +1 -0
- package/dist/runtime/spots/spot-actor-packet-drain.js +12 -5
- package/dist/runtime/spots/spot-entry-activation.d.ts +2 -1
- package/dist/runtime/spots/spot-node-runtime-manager.d.ts +8 -6
- package/dist/runtime/spots/spot-node-runtime-manager.js +2 -0
- package/dist/runtime/spots/spot-route-packet-dispatch.js +7 -4
- package/dist/runtime/spots/spot-routed-spot-packet-dispatch.js +3 -1
- package/dist/runtime/spots/spot-serial-executor.d.ts +2 -1
- package/dist/runtime/spots/spot-subscription-dispatch.js +3 -1
- package/dist/runtime/spots/spot-timer.d.ts +1 -1
- package/dist/runtime/streams/actor-session-binding-registry.d.ts +9 -3
- package/dist/runtime/streams/actor-session-binding-registry.js +17 -0
- package/dist/runtime/streams/index.d.ts +3 -3
- package/dist/runtime/streams/index.js +22 -2
- package/dist/runtime/streams/managed-stream.js +2 -1
- package/dist/runtime/streams/session-calls.d.ts +1 -1
- package/dist/runtime/streams/session-calls.js +3 -9
- package/dist/runtime/streams/session-context.d.ts +2 -2
- package/dist/runtime/streams/session-context.js +2 -2
- package/dist/runtime/streams/stream-session-runtime.d.ts +1 -0
- package/dist/runtime/streams/stream-session-runtime.js +37 -12
- package/package.json +3 -3
- package/src/contracts/Actors/ZLinkActor.ts +6 -0
- package/src/contracts/Actors/ZLinkSessionBindingIdentity.ts +7 -0
- package/src/contracts/Actors/index.ts +1 -0
- package/src/contracts/Common/payload-slab.ts +29 -0
- package/src/contracts/Handlers/Contexts.ts +1 -0
- package/src/internal.ts +17 -0
- package/src/runtime/actors/actor-client.ts +48 -23
- package/src/runtime/actors/actor-mailbox.ts +1 -1
- package/src/runtime/actors/actor-runtime-state.ts +1 -1
- package/src/runtime/actors/spot-actor-dispatch.ts +4 -3
- package/src/runtime/application-jobs/application-ingress-record-owner.ts +4 -0
- package/src/runtime/backend/contracts/index.ts +2 -0
- package/src/runtime/backend/mesh-completion-table.ts +2 -0
- package/src/runtime/backend/node/node-mesh-backend-adapter.ts +5 -1
- package/src/runtime/backend/node/node-raw-binding-port.ts +20 -7
- package/src/runtime/backend/node/node-raw-mesh-backend.ts +18 -10
- package/src/runtime/channels/channel-dispatch-pipeline.ts +6 -5
- package/src/runtime/channels/channel-dispatchers.ts +39 -19
- package/src/runtime/channels/channel-envelope.ts +547 -20
- package/src/runtime/channels/channel-receive-loops.ts +93 -36
- package/src/runtime/channels/channel-runtime-lifecycle.ts +2 -2
- package/src/runtime/channels/channel-socket-registry.ts +3 -3
- package/src/runtime/diagnostics/runtime-metrics.ts +3 -1
- package/src/runtime/execution/serial-execution-queue.ts +13 -13
- package/src/runtime/foundation/raw-service-mesh-runtime.ts +40 -39
- package/src/runtime/foundation/service-liveness-registry.ts +1 -1
- package/src/runtime/foundation/service-mailbox.ts +6 -1
- package/src/runtime/foundation/service-runtime-contracts.ts +7 -1
- package/src/runtime/foundation/service-stateful-registry.ts +39 -14
- package/src/runtime/foundation/service-stateful-runtime.ts +87 -21
- package/src/runtime/foundation/service-stateful-wire-codec.ts +18 -0
- package/src/runtime/foundation/service-wire-constants.generated.ts +10 -0
- package/src/runtime/foundation/service-wire-m6a-codec.ts +29 -7
- package/src/runtime/host/actor-placement-coordinator.ts +1 -1
- package/src/runtime/host/actor-transfer-runtime.ts +3 -3
- package/src/runtime/host/application-job-queue.ts +1 -1
- package/src/runtime/host/index.ts +183 -44
- package/src/runtime/host/location-runtime-owner.ts +2 -2
- package/src/runtime/host/service-relocation-host-runtime.ts +101 -65
- package/src/runtime/host/spot-address-transport.ts +67 -61
- package/src/runtime/locations/auto-connect-loop.ts +24 -16
- package/src/runtime/locations/auto-connect-planner.ts +2 -5
- package/src/runtime/locations/auto-connect-reconciler.ts +37 -24
- package/src/runtime/locations/in-memory-location-store.ts +1 -74
- package/src/runtime/locations/location-store-repository.ts +32 -153
- package/src/runtime/locations/runtime.ts +16 -28
- package/src/runtime/messaging/creation-payload-codec.ts +3 -3
- package/src/runtime/protocol/service_wire_codec.generated.ts +18 -8
- package/src/runtime/protocol/service_wire_pilot_codec.generated.ts +1 -1
- package/src/runtime/spots/index.ts +28 -4
- package/src/runtime/spots/spot-actor-admission-coordinator.ts +1 -1
- package/src/runtime/spots/spot-actor-packet-dispatch.ts +16 -6
- package/src/runtime/spots/spot-actor-packet-drain.ts +21 -6
- package/src/runtime/spots/spot-entry-activation.ts +1 -1
- package/src/runtime/spots/spot-node-runtime-manager.ts +8 -6
- package/src/runtime/spots/spot-route-packet-dispatch.ts +8 -4
- package/src/runtime/spots/spot-routed-spot-packet-dispatch.ts +3 -1
- package/src/runtime/spots/spot-serial-executor.ts +1 -1
- package/src/runtime/spots/spot-subscription-dispatch.ts +3 -1
- package/src/runtime/spots/spot-timer.ts +1 -1
- package/src/runtime/streams/actor-session-binding-registry.ts +30 -3
- package/src/runtime/streams/index.ts +30 -4
- package/src/runtime/streams/managed-stream.ts +2 -1
- package/src/runtime/streams/session-calls.ts +9 -14
- package/src/runtime/streams/session-context.ts +6 -11
- package/src/runtime/streams/stream-session-runtime.ts +49 -20
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { ZLinkActorContext } from './ZLinkActorContext';
|
|
2
2
|
import type { ZLinkActorJoinCompletion } from './ZLinkActorFactory';
|
|
3
|
+
import type { ZLinkSessionBindingIdentity } from './ZLinkSessionBindingIdentity';
|
|
3
4
|
export interface ZLinkActor {
|
|
4
5
|
readonly context: ZLinkActorContext;
|
|
5
6
|
configure?(): void;
|
|
6
7
|
onJoinCompleted?(completion: ZLinkActorJoinCompletion): Promise<void>;
|
|
8
|
+
onDuplicateBind?(current: ZLinkSessionBindingIdentity, incoming: ZLinkSessionBindingIdentity, signal: AbortSignal): Promise<string | undefined>;
|
|
7
9
|
}
|
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./ZLinkActor"), exports);
|
|
18
|
+
__exportStar(require("./ZLinkSessionBindingIdentity"), exports);
|
|
18
19
|
__exportStar(require("./ZLinkActorContext"), exports);
|
|
19
20
|
__exportStar(require("./ZLinkActorClient"), exports);
|
|
20
21
|
__exportStar(require("./ZLinkActorFactory"), exports);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Allocates independent bytes; previously returned regions are never reused. */
|
|
2
|
+
export declare function allocatePayloadBytes(length: number): Buffer;
|
|
3
|
+
/** Copies bytes into an exact, standalone backing store with no Buffer pool. */
|
|
4
|
+
export declare function copyPayloadBytes(bytes: Uint8Array): Buffer;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.allocatePayloadBytes = allocatePayloadBytes;
|
|
4
|
+
exports.copyPayloadBytes = copyPayloadBytes;
|
|
5
|
+
const SLAB_BYTES = 64 * 1024;
|
|
6
|
+
const MAX_POOLED_BYTES = 16 * 1024;
|
|
7
|
+
const ALIGNMENT = 8;
|
|
8
|
+
let slab;
|
|
9
|
+
let offset = 0;
|
|
10
|
+
/** Allocates independent bytes; previously returned regions are never reused. */
|
|
11
|
+
function allocatePayloadBytes(length) {
|
|
12
|
+
if (length > MAX_POOLED_BYTES || length < 0 || !Number.isInteger(length)) {
|
|
13
|
+
return Buffer.allocUnsafe(length);
|
|
14
|
+
}
|
|
15
|
+
if (slab === undefined || offset + length > SLAB_BYTES) {
|
|
16
|
+
slab = Buffer.allocUnsafe(SLAB_BYTES);
|
|
17
|
+
offset = 0;
|
|
18
|
+
}
|
|
19
|
+
const bytes = slab.subarray(offset, offset + length);
|
|
20
|
+
offset += Math.ceil(length / ALIGNMENT) * ALIGNMENT;
|
|
21
|
+
// Transient runtime frames only; local queues and application boundaries
|
|
22
|
+
// copy before they retain or expose these bytes.
|
|
23
|
+
return bytes;
|
|
24
|
+
}
|
|
25
|
+
/** Copies bytes into an exact, standalone backing store with no Buffer pool. */
|
|
26
|
+
function copyPayloadBytes(bytes) {
|
|
27
|
+
const copy = Buffer.allocUnsafeSlow(bytes.byteLength);
|
|
28
|
+
copy.set(bytes);
|
|
29
|
+
return copy;
|
|
30
|
+
}
|
|
@@ -6,6 +6,7 @@ export interface ZLinkMessageContext {
|
|
|
6
6
|
readonly contentType?: string;
|
|
7
7
|
readonly metadata: ZLinkMessageMetadata;
|
|
8
8
|
readonly correlationId?: string;
|
|
9
|
+
readonly receivedAt: Date;
|
|
9
10
|
}
|
|
10
11
|
export interface ZLinkPublishMessageContext extends ZLinkMessageContext {
|
|
11
12
|
readonly channelName: string;
|
package/dist/internal.d.ts
CHANGED
|
@@ -3,6 +3,11 @@ export * from './index';
|
|
|
3
3
|
export { requireValidSendTimeoutMs } from './contracts/Configuration/SendTimeoutValidation';
|
|
4
4
|
export * from './runtime/diagnostics';
|
|
5
5
|
export * from './runtime/host';
|
|
6
|
+
export { ZLinkActorPlacementCoordinator } from './runtime/host/actor-placement-coordinator';
|
|
7
|
+
export { ZLinkActorTransferRuntime } from './runtime/host/actor-transfer-runtime';
|
|
8
|
+
export { ApplicationJobQueue, ApplicationJobQueuePermit, nodeEffectiveProcessorCount, resolveApplicationJobQueueConfiguration } from './runtime/host/application-job-queue';
|
|
9
|
+
export { ZLinkLocationRuntimeOwner } from './runtime/host/location-runtime-owner';
|
|
10
|
+
export { relocationFailedFailureCode, ZLinkHostServiceRelocationRuntime } from './runtime/host/service-relocation-host-runtime';
|
|
6
11
|
export * from './runtime/admission';
|
|
7
12
|
export * from './runtime/activation-admission';
|
|
8
13
|
export * from './runtime/streams';
|
|
@@ -17,9 +22,13 @@ export * from './runtime/locations/canonical-codec';
|
|
|
17
22
|
export { ZLinkLocationAutoConnectType, ZLinkLocationKind, ZLinkRouteKind } from './contracts/Locations/Values';
|
|
18
23
|
export { ZLinkLocationWriteIntent, ZLinkLocationWriteStatus } from './contracts/Locations/Writes';
|
|
19
24
|
export * from './runtime/channels';
|
|
25
|
+
export { ZLinkChannelRuntimeLifecycle } from './runtime/channels/channel-runtime-lifecycle';
|
|
26
|
+
export { ZLinkChannelSocketRegistry } from './runtime/channels/channel-socket-registry';
|
|
27
|
+
export { ZLinkChannelDispatchPipeline } from './runtime/channels/channel-dispatch-pipeline';
|
|
20
28
|
export * from './runtime/backend';
|
|
21
29
|
export * from './runtime/codecs';
|
|
22
30
|
export * from './runtime/execution';
|
|
31
|
+
export { ZLinkSerialExecutionQueue } from './runtime/execution/serial-execution-queue';
|
|
23
32
|
export * from './runtime/handlers';
|
|
24
33
|
export * from './runtime/messaging';
|
|
25
34
|
export * from './runtime/foundation';
|
package/dist/internal.js
CHANGED
|
@@ -14,13 +14,27 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.requirePublicWeight = exports.isValidCapacity = exports.isValidListenerPort = exports.isValidPositiveCapacity = exports.isValidPublicWeight = exports.ZLINK_MAX_CAPACITY = exports.ZLINK_MAX_PUBLIC_WEIGHT = exports.MAX_LISTENER_PORT = exports.ZLINK_MAX_STABLE_TYPE_BYTES = exports.ZLINK_RELOCATION_MAX_BLOB_REFERENCE_BYTES = exports.ZLinkLocationWriteStatus = exports.ZLinkLocationWriteIntent = exports.ZLinkRouteKind = exports.ZLinkLocationKind = exports.ZLinkLocationAutoConnectType = exports.requireValidSendTimeoutMs = void 0;
|
|
17
|
+
exports.requirePublicWeight = exports.isValidCapacity = exports.isValidListenerPort = exports.isValidPositiveCapacity = exports.isValidPublicWeight = exports.ZLINK_MAX_CAPACITY = exports.ZLINK_MAX_PUBLIC_WEIGHT = exports.MAX_LISTENER_PORT = exports.ZLINK_MAX_STABLE_TYPE_BYTES = exports.ZLINK_RELOCATION_MAX_BLOB_REFERENCE_BYTES = exports.ZLinkSerialExecutionQueue = exports.ZLinkChannelDispatchPipeline = exports.ZLinkChannelSocketRegistry = exports.ZLinkChannelRuntimeLifecycle = exports.ZLinkLocationWriteStatus = exports.ZLinkLocationWriteIntent = exports.ZLinkRouteKind = exports.ZLinkLocationKind = exports.ZLinkLocationAutoConnectType = exports.ZLinkHostServiceRelocationRuntime = exports.relocationFailedFailureCode = exports.ZLinkLocationRuntimeOwner = exports.resolveApplicationJobQueueConfiguration = exports.nodeEffectiveProcessorCount = exports.ApplicationJobQueuePermit = exports.ApplicationJobQueue = exports.ZLinkActorTransferRuntime = exports.ZLinkActorPlacementCoordinator = exports.requireValidSendTimeoutMs = void 0;
|
|
18
18
|
/** Test and companion-package integration surface. It is not exported by package.json. */
|
|
19
19
|
__exportStar(require("./index"), exports);
|
|
20
20
|
var SendTimeoutValidation_1 = require("./contracts/Configuration/SendTimeoutValidation");
|
|
21
21
|
Object.defineProperty(exports, "requireValidSendTimeoutMs", { enumerable: true, get: function () { return SendTimeoutValidation_1.requireValidSendTimeoutMs; } });
|
|
22
22
|
__exportStar(require("./runtime/diagnostics"), exports);
|
|
23
23
|
__exportStar(require("./runtime/host"), exports);
|
|
24
|
+
var actor_placement_coordinator_1 = require("./runtime/host/actor-placement-coordinator");
|
|
25
|
+
Object.defineProperty(exports, "ZLinkActorPlacementCoordinator", { enumerable: true, get: function () { return actor_placement_coordinator_1.ZLinkActorPlacementCoordinator; } });
|
|
26
|
+
var actor_transfer_runtime_1 = require("./runtime/host/actor-transfer-runtime");
|
|
27
|
+
Object.defineProperty(exports, "ZLinkActorTransferRuntime", { enumerable: true, get: function () { return actor_transfer_runtime_1.ZLinkActorTransferRuntime; } });
|
|
28
|
+
var application_job_queue_1 = require("./runtime/host/application-job-queue");
|
|
29
|
+
Object.defineProperty(exports, "ApplicationJobQueue", { enumerable: true, get: function () { return application_job_queue_1.ApplicationJobQueue; } });
|
|
30
|
+
Object.defineProperty(exports, "ApplicationJobQueuePermit", { enumerable: true, get: function () { return application_job_queue_1.ApplicationJobQueuePermit; } });
|
|
31
|
+
Object.defineProperty(exports, "nodeEffectiveProcessorCount", { enumerable: true, get: function () { return application_job_queue_1.nodeEffectiveProcessorCount; } });
|
|
32
|
+
Object.defineProperty(exports, "resolveApplicationJobQueueConfiguration", { enumerable: true, get: function () { return application_job_queue_1.resolveApplicationJobQueueConfiguration; } });
|
|
33
|
+
var location_runtime_owner_1 = require("./runtime/host/location-runtime-owner");
|
|
34
|
+
Object.defineProperty(exports, "ZLinkLocationRuntimeOwner", { enumerable: true, get: function () { return location_runtime_owner_1.ZLinkLocationRuntimeOwner; } });
|
|
35
|
+
var service_relocation_host_runtime_1 = require("./runtime/host/service-relocation-host-runtime");
|
|
36
|
+
Object.defineProperty(exports, "relocationFailedFailureCode", { enumerable: true, get: function () { return service_relocation_host_runtime_1.relocationFailedFailureCode; } });
|
|
37
|
+
Object.defineProperty(exports, "ZLinkHostServiceRelocationRuntime", { enumerable: true, get: function () { return service_relocation_host_runtime_1.ZLinkHostServiceRelocationRuntime; } });
|
|
24
38
|
__exportStar(require("./runtime/admission"), exports);
|
|
25
39
|
__exportStar(require("./runtime/activation-admission"), exports);
|
|
26
40
|
__exportStar(require("./runtime/streams"), exports);
|
|
@@ -40,9 +54,17 @@ var Writes_1 = require("./contracts/Locations/Writes");
|
|
|
40
54
|
Object.defineProperty(exports, "ZLinkLocationWriteIntent", { enumerable: true, get: function () { return Writes_1.ZLinkLocationWriteIntent; } });
|
|
41
55
|
Object.defineProperty(exports, "ZLinkLocationWriteStatus", { enumerable: true, get: function () { return Writes_1.ZLinkLocationWriteStatus; } });
|
|
42
56
|
__exportStar(require("./runtime/channels"), exports);
|
|
57
|
+
var channel_runtime_lifecycle_1 = require("./runtime/channels/channel-runtime-lifecycle");
|
|
58
|
+
Object.defineProperty(exports, "ZLinkChannelRuntimeLifecycle", { enumerable: true, get: function () { return channel_runtime_lifecycle_1.ZLinkChannelRuntimeLifecycle; } });
|
|
59
|
+
var channel_socket_registry_1 = require("./runtime/channels/channel-socket-registry");
|
|
60
|
+
Object.defineProperty(exports, "ZLinkChannelSocketRegistry", { enumerable: true, get: function () { return channel_socket_registry_1.ZLinkChannelSocketRegistry; } });
|
|
61
|
+
var channel_dispatch_pipeline_1 = require("./runtime/channels/channel-dispatch-pipeline");
|
|
62
|
+
Object.defineProperty(exports, "ZLinkChannelDispatchPipeline", { enumerable: true, get: function () { return channel_dispatch_pipeline_1.ZLinkChannelDispatchPipeline; } });
|
|
43
63
|
__exportStar(require("./runtime/backend"), exports);
|
|
44
64
|
__exportStar(require("./runtime/codecs"), exports);
|
|
45
65
|
__exportStar(require("./runtime/execution"), exports);
|
|
66
|
+
var serial_execution_queue_1 = require("./runtime/execution/serial-execution-queue");
|
|
67
|
+
Object.defineProperty(exports, "ZLinkSerialExecutionQueue", { enumerable: true, get: function () { return serial_execution_queue_1.ZLinkSerialExecutionQueue; } });
|
|
46
68
|
__exportStar(require("./runtime/handlers"), exports);
|
|
47
69
|
__exportStar(require("./runtime/messaging"), exports);
|
|
48
70
|
__exportStar(require("./runtime/foundation"), exports);
|
|
@@ -30,7 +30,7 @@ export declare class DefaultZLinkActorClient implements ZLinkActorClient {
|
|
|
30
30
|
private send;
|
|
31
31
|
private request;
|
|
32
32
|
private resolveActorRoute;
|
|
33
|
-
private
|
|
33
|
+
private mapActorFailure;
|
|
34
34
|
private throwIfKnownStale;
|
|
35
35
|
private createPacketParts;
|
|
36
36
|
private submitActorSend;
|
|
@@ -42,10 +42,12 @@ class DefaultZLinkActorClient {
|
|
|
42
42
|
async send(actorId, explicitPacketName, message, metadata) {
|
|
43
43
|
const route = await this.resolveActorRoute(actorId);
|
|
44
44
|
const { meshName, actorRef: actor } = route;
|
|
45
|
-
this.throwIfKnownStale(
|
|
45
|
+
this.throwIfKnownStale(route);
|
|
46
46
|
const parts = this.createPacketParts(protocol_1.ZLinkStreamMessageKind.Send, undefined, explicitPacketName, message, metadata);
|
|
47
|
+
let routeFence;
|
|
47
48
|
try {
|
|
48
49
|
const messageFollow = createActorMessageFollowContext(route, parts, false);
|
|
50
|
+
routeFence = actorRouteInvalidationFence(route);
|
|
49
51
|
const routedActor = (0, actor_message_follow_context_1.attachActorMessageFollowContext)(actor, messageFollow);
|
|
50
52
|
const submissionCopies = (await this.options.transportDeliveryGate?.()?.waitBeforeSubmit(actorId, 'oneWay')) ?? 1;
|
|
51
53
|
const handoff = this.options.handoffCapture?.(meshName, actor.actorId, parts, false, routedActor);
|
|
@@ -76,12 +78,7 @@ class DefaultZLinkActorClient {
|
|
|
76
78
|
return await this.submitActorSend(meshName, toBackendActorRef(actor), parts, route);
|
|
77
79
|
}
|
|
78
80
|
catch (error) {
|
|
79
|
-
|
|
80
|
-
this.invalidateActorRoute(actorId);
|
|
81
|
-
this.options.staleActorRefReporter?.(meshName, actor.actorId);
|
|
82
|
-
throw actorLocationStale(actor.actorId, error);
|
|
83
|
-
}
|
|
84
|
-
throw error;
|
|
81
|
+
throw this.mapActorFailure(actorId, error, routeFence, meshName);
|
|
85
82
|
}
|
|
86
83
|
finally {
|
|
87
84
|
closeMessages(parts);
|
|
@@ -92,6 +89,7 @@ class DefaultZLinkActorClient {
|
|
|
92
89
|
const sourceSpotId = (0, actor_execution_context_1.currentZLinkActorExecution)()?.spotId ?? (0, execution_1.currentZLinkSpotSerialSourceId)();
|
|
93
90
|
const effectiveTimeoutMs = timeoutMs ?? this.options.defaultRequestTimeoutMs;
|
|
94
91
|
let meshName;
|
|
92
|
+
let routeFence;
|
|
95
93
|
return this.requests.prepare(effectiveTimeoutMs, signal, (requestOperation, receiver) => {
|
|
96
94
|
void (async () => {
|
|
97
95
|
const deadlineMs = requestOperation.deadlineMs;
|
|
@@ -106,14 +104,17 @@ class DefaultZLinkActorClient {
|
|
|
106
104
|
}
|
|
107
105
|
const { actorRef: actor } = route;
|
|
108
106
|
meshName = route.meshName;
|
|
109
|
-
if (this.options.staleActorRefPredicate?.(meshName, actor) === true)
|
|
107
|
+
if (this.options.staleActorRefPredicate?.(meshName, actor) === true) {
|
|
108
|
+
routeFence = actorRouteInvalidationFence(route);
|
|
110
109
|
throw actorLocationStale(actor.actorId, undefined);
|
|
110
|
+
}
|
|
111
111
|
const operationId = (0, actor_message_follow_context_1.createMessageFollowId)();
|
|
112
112
|
const correlationId = (0, actor_message_follow_context_1.createMessageFollowId)();
|
|
113
113
|
const requestSequence = BigInt(`0x${operationId.slice(16)}`);
|
|
114
114
|
const parts = this.createPacketParts(protocol_1.ZLinkStreamMessageKind.Request, requestSequence === 0n ? 1n : requestSequence, explicitPacketName, request, mergeActorRequestMetadata(metadata, deadlineUnixMs), correlationId);
|
|
115
115
|
try {
|
|
116
116
|
const messageFollow = createActorMessageFollowContext(route, parts, true, deadlineUnixMs, correlationId, operationId);
|
|
117
|
+
routeFence = actorRouteInvalidationFence(route);
|
|
117
118
|
const routedActor = (0, actor_message_follow_context_1.attachActorMessageFollowContext)(actor, messageFollow);
|
|
118
119
|
const delivery = this.options
|
|
119
120
|
.transportDeliveryGate?.()
|
|
@@ -139,15 +140,7 @@ class DefaultZLinkActorClient {
|
|
|
139
140
|
closeMessages(parts);
|
|
140
141
|
}
|
|
141
142
|
})().catch((error) => receiver.operationFailed(requestOperation.id, error, undefined));
|
|
142
|
-
}, (value) => value, (error) =>
|
|
143
|
-
if (isStaleActorError(error)) {
|
|
144
|
-
this.invalidateActorRoute(actorId);
|
|
145
|
-
if (meshName !== undefined)
|
|
146
|
-
this.options.staleActorRefReporter?.(meshName, actorId);
|
|
147
|
-
return actorLocationStale(actorId, error);
|
|
148
|
-
}
|
|
149
|
-
return error;
|
|
150
|
-
});
|
|
143
|
+
}, (value) => value, (error) => this.mapActorFailure(actorId, error, routeFence, meshName));
|
|
151
144
|
}
|
|
152
145
|
async resolveActorRoute(actorId, signal, deadlineMs, requestOperation) {
|
|
153
146
|
const resolver = this.options.locationResolver();
|
|
@@ -163,15 +156,21 @@ class DefaultZLinkActorClient {
|
|
|
163
156
|
}
|
|
164
157
|
return resolution.route;
|
|
165
158
|
}
|
|
166
|
-
|
|
167
|
-
|
|
159
|
+
mapActorFailure(actorId, error, routeFence, meshName) {
|
|
160
|
+
if (!isStaleActorError(error))
|
|
161
|
+
return error;
|
|
162
|
+
const resolver = this.options.locationResolver();
|
|
163
|
+
if (routeFence !== undefined && resolver !== undefined)
|
|
164
|
+
resolver.invalidateActorRouteIfMatches(routeFence);
|
|
165
|
+
if (meshName !== undefined)
|
|
166
|
+
this.options.staleActorRefReporter?.(meshName, actorId);
|
|
167
|
+
return actorLocationStale(actorId, error);
|
|
168
168
|
}
|
|
169
|
-
throwIfKnownStale(
|
|
169
|
+
throwIfKnownStale(route) {
|
|
170
|
+
const { meshName, actorRef: actor } = route;
|
|
170
171
|
if (this.options.staleActorRefPredicate?.(meshName, actor) !== true)
|
|
171
172
|
return;
|
|
172
|
-
this.
|
|
173
|
-
this.options.staleActorRefReporter?.(meshName, actor.actorId);
|
|
174
|
-
throw actorLocationStale(actor.actorId, undefined);
|
|
173
|
+
throw this.mapActorFailure(actor.actorId, actorLocationStale(actor.actorId, undefined), actorRouteInvalidationFence(route), meshName);
|
|
175
174
|
}
|
|
176
175
|
createPacketParts(kind, requestSeq, explicitPacketName, message, metadata, correlationId) {
|
|
177
176
|
const packetName = (0, packet_name_1.resolveFrameworkPacketName)(message, explicitPacketName, 'Actor');
|
|
@@ -301,6 +300,16 @@ function nativeActorRouteFence(route, actor) {
|
|
|
301
300
|
ownerLeaseGeneration: route.ownerLeaseGeneration
|
|
302
301
|
};
|
|
303
302
|
}
|
|
303
|
+
function actorRouteInvalidationFence(route) {
|
|
304
|
+
return {
|
|
305
|
+
actorId: route.actorRef.actorId,
|
|
306
|
+
objectGeneration: route.actorRef.objectGeneration,
|
|
307
|
+
targetNodeRid: route.actorRef.nodeRid,
|
|
308
|
+
targetNodeGeneration: route.ownerNodeGeneration,
|
|
309
|
+
authorityOwnerGeneration: route.authorityOwnerGeneration,
|
|
310
|
+
ownerLeaseGeneration: route.ownerLeaseGeneration
|
|
311
|
+
};
|
|
312
|
+
}
|
|
304
313
|
function remoteActorRouteTarget(route) {
|
|
305
314
|
if (route.enclosingSpotRoute !== undefined) {
|
|
306
315
|
return route.enclosingSpotRoute;
|
|
@@ -2,7 +2,7 @@ import { ZLinkSerialExecutionQueue, type ZLinkSerialSchedulerOptions, type ZLink
|
|
|
2
2
|
export declare class ZLinkActorSerialExecutor {
|
|
3
3
|
private readonly actorId;
|
|
4
4
|
private readonly sourceSpotId;
|
|
5
|
-
|
|
5
|
+
readonly scheduler: ZLinkSerialExecutionQueue;
|
|
6
6
|
constructor(actorId: string, sourceSpotId: unknown, options?: ZLinkSerialSchedulerOptions, sharedOwner?: ZLinkSerialExecutionQueue);
|
|
7
7
|
execute<T>(operation: () => Promise<T> | T, workOptions?: ZLinkSerialWorkOptions): Promise<T>;
|
|
8
8
|
close(): Promise<void>;
|
|
@@ -77,7 +77,7 @@ export declare class ZLinkActorRuntimeState {
|
|
|
77
77
|
private spotMembershipEpochValue;
|
|
78
78
|
private nativeActorRefValue;
|
|
79
79
|
private entryNodeRidValue;
|
|
80
|
-
|
|
80
|
+
boundSessionValue: ZLinkRemoteBoundSessionTarget | undefined;
|
|
81
81
|
private remoteActorPacketTargetValue;
|
|
82
82
|
private createRequestPayloadValue;
|
|
83
83
|
private ownsLocationValue;
|
|
@@ -54,8 +54,10 @@ export declare class ZLinkSpotActorDispatcher {
|
|
|
54
54
|
notifyDisconnectActor(actor: ZLinkActor): Promise<void>;
|
|
55
55
|
private requirePacket;
|
|
56
56
|
private ensureActorType;
|
|
57
|
-
|
|
57
|
+
invokeHandler<THandler, TResult>(actor: ZLinkActor, descriptor: Pick<ZLinkActorPacketDescriptor, 'handlerType' | 'methodName'>, callback: (handler: THandler, method: THandler extends {
|
|
58
|
+
handle: infer TMethod;
|
|
59
|
+
} ? TMethod : never) => Promise<TResult>): Promise<TResult>;
|
|
58
60
|
private execute;
|
|
59
|
-
|
|
61
|
+
createContext(packetName: string, context: Partial<ZLinkMessageContext> | undefined): ZLinkMessageContext;
|
|
60
62
|
}
|
|
61
63
|
export {};
|
|
@@ -205,7 +205,8 @@ class ZLinkSpotActorDispatcher {
|
|
|
205
205
|
packetName,
|
|
206
206
|
contentType: context?.contentType,
|
|
207
207
|
metadata: context?.metadata ?? contracts_1.ZLinkMessageMetadataEmpty,
|
|
208
|
-
correlationId: context?.correlationId
|
|
208
|
+
correlationId: context?.correlationId,
|
|
209
|
+
receivedAt: context?.receivedAt ?? new Date()
|
|
209
210
|
};
|
|
210
211
|
}
|
|
211
212
|
}
|
|
@@ -29,6 +29,7 @@ export declare class ApplicationJobRecordLease implements ApplicationJobPermitPo
|
|
|
29
29
|
private processingTerminal;
|
|
30
30
|
detachedForHandlerTurn: boolean;
|
|
31
31
|
constructor(shared: SharedIngressRecordState, permit: ApplicationJobPermitPort | undefined);
|
|
32
|
+
reacquire(signal: AbortSignal): Promise<ApplicationJobPermitPort>;
|
|
32
33
|
get origin(): ApplicationJobOrigin;
|
|
33
34
|
markApplicationQueued(): void;
|
|
34
35
|
detachForHandlerTurn(): void;
|
|
@@ -472,6 +472,8 @@ export interface ZLinkMeshBackendAdapter {
|
|
|
472
472
|
createMeshNode(context: ZLinkBackendContext, options: {
|
|
473
473
|
readonly meshName: string;
|
|
474
474
|
readonly routingId?: RoutingId;
|
|
475
|
+
readonly sendHighWaterMark?: number;
|
|
476
|
+
readonly receiveHighWaterMark?: number;
|
|
475
477
|
readonly receiveTimeoutMs?: number;
|
|
476
478
|
readonly trustProfile?: string;
|
|
477
479
|
readonly applicationJobQueue: import('../../application-jobs/contracts').ApplicationJobQueuePort;
|
|
@@ -9,6 +9,7 @@ export interface ZLinkMeshCompletionDiagnostic {
|
|
|
9
9
|
export interface ZLinkMeshCompletion {
|
|
10
10
|
readonly terminalResult: number;
|
|
11
11
|
readonly failureErrno: number;
|
|
12
|
+
readonly failureMessage?: string;
|
|
12
13
|
readonly operationKind: number;
|
|
13
14
|
readonly kindData: ReceiveKindData | null;
|
|
14
15
|
readonly parts: Message[];
|
|
@@ -269,6 +269,7 @@ function retainCompletion(record) {
|
|
|
269
269
|
return {
|
|
270
270
|
terminalResult: record.terminalResult,
|
|
271
271
|
failureErrno: record.failureErrno,
|
|
272
|
+
...(record.failureMessage === undefined ? {} : { failureMessage: record.failureMessage }),
|
|
272
273
|
operationKind: record.operationKind,
|
|
273
274
|
kindData: record.kindData,
|
|
274
275
|
parts
|
|
@@ -12,7 +12,11 @@ class ZLinkNodeMeshBackendAdapter {
|
|
|
12
12
|
if (!isBindingContext(bindingContext)) {
|
|
13
13
|
throw new TypeError('Node MeshNode creation requires the Node binding Context owned by the host.');
|
|
14
14
|
}
|
|
15
|
-
return new node_raw_mesh_backend_1.ZLinkNodeRawMeshBackend(options.meshName, options.routingId, new node_raw_binding_port_1.ZLinkNodeRawBindingPort(bindingContext,
|
|
15
|
+
return new node_raw_mesh_backend_1.ZLinkNodeRawMeshBackend(options.meshName, options.routingId, new node_raw_binding_port_1.ZLinkNodeRawBindingPort(bindingContext, {
|
|
16
|
+
sendHighWaterMark: options.sendHighWaterMark,
|
|
17
|
+
receiveHighWaterMark: options.receiveHighWaterMark,
|
|
18
|
+
receiveTimeoutMs: options.receiveTimeoutMs
|
|
19
|
+
}), options.applicationJobQueue, options.applicationJobReceiveFlowFailureSink, options.peerAdmissionSealed, options.infrastructureTaskRunner);
|
|
16
20
|
}
|
|
17
21
|
}
|
|
18
22
|
exports.ZLinkNodeMeshBackendAdapter = ZLinkNodeMeshBackendAdapter;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { type Context } from '@zlink-systems/zlink';
|
|
2
2
|
import type { ZLinkRawBindingPort, ZLinkRawHostPort } from '../raw-binding-port';
|
|
3
|
+
interface ZLinkNodeRawRouterSocketOptions {
|
|
4
|
+
readonly sendHighWaterMark?: number;
|
|
5
|
+
readonly receiveHighWaterMark?: number;
|
|
6
|
+
readonly receiveTimeoutMs?: number;
|
|
7
|
+
}
|
|
3
8
|
export type { ZLinkRawBindingPort, ZLinkRawDealerPort, ZLinkRawHostPort, ZLinkRawMonitorPort, ZLinkRawMonitorRecord, ZLinkRawReceivedRecord, ZLinkRawRouterPort, ZLinkRawRouterRoute, ZLinkRawSocketPort } from '../raw-binding-port';
|
|
4
9
|
export declare class ZLinkNodeRawBindingPort implements ZLinkRawBindingPort {
|
|
5
10
|
private readonly sharedContext?;
|
|
6
|
-
private readonly
|
|
7
|
-
constructor(sharedContext?: Context | undefined,
|
|
11
|
+
private readonly routerSocketOptions?;
|
|
12
|
+
constructor(sharedContext?: Context | undefined, routerSocketOptions?: ZLinkNodeRawRouterSocketOptions | undefined);
|
|
8
13
|
createHost(): ZLinkRawHostPort;
|
|
9
14
|
}
|
|
@@ -11,30 +11,30 @@ const node_event_loop_poller_1 = require("./node-event-loop-poller");
|
|
|
11
11
|
const runtime_message_1 = require("../runtime-message");
|
|
12
12
|
class ZLinkNodeRawBindingPort {
|
|
13
13
|
sharedContext;
|
|
14
|
-
|
|
15
|
-
constructor(sharedContext,
|
|
14
|
+
routerSocketOptions;
|
|
15
|
+
constructor(sharedContext, routerSocketOptions) {
|
|
16
16
|
this.sharedContext = sharedContext;
|
|
17
|
-
this.
|
|
17
|
+
this.routerSocketOptions = routerSocketOptions;
|
|
18
18
|
}
|
|
19
19
|
createHost() {
|
|
20
|
-
return new NodeRawHostPort(this.sharedContext ?? (0, zlink_1.createContext)(), this.sharedContext === undefined, this.
|
|
20
|
+
return new NodeRawHostPort(this.sharedContext ?? (0, zlink_1.createContext)(), this.sharedContext === undefined, this.routerSocketOptions);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
exports.ZLinkNodeRawBindingPort = ZLinkNodeRawBindingPort;
|
|
24
24
|
class NodeRawHostPort {
|
|
25
25
|
context;
|
|
26
26
|
ownsContext;
|
|
27
|
-
|
|
27
|
+
routerSocketOptions;
|
|
28
28
|
resources = [];
|
|
29
29
|
state = 'open';
|
|
30
|
-
constructor(context, ownsContext,
|
|
30
|
+
constructor(context, ownsContext, routerSocketOptions) {
|
|
31
31
|
this.context = context;
|
|
32
32
|
this.ownsContext = ownsContext;
|
|
33
|
-
this.
|
|
33
|
+
this.routerSocketOptions = routerSocketOptions;
|
|
34
34
|
}
|
|
35
35
|
createRouter() {
|
|
36
36
|
this.requireOpen();
|
|
37
|
-
return this.own(new NodeRawRouterPort((0, zlink_1.createRouterSocket)(this.context), this.
|
|
37
|
+
return this.own(new NodeRawRouterPort((0, zlink_1.createRouterSocket)(this.context), this.routerSocketOptions));
|
|
38
38
|
}
|
|
39
39
|
createDealer() {
|
|
40
40
|
this.requireOpen();
|
|
@@ -218,13 +218,19 @@ class NodeRawRouterPort extends NodeRawSocketPort {
|
|
|
218
218
|
this.requireOpen();
|
|
219
219
|
(0, node_socket_backend_adapter_1.disconnectSocketPeer)(this.socket, this.preparedRoutingId(routingId));
|
|
220
220
|
}
|
|
221
|
-
constructor(socket,
|
|
221
|
+
constructor(socket, options) {
|
|
222
222
|
super(socket, true);
|
|
223
223
|
socket.options.handover = true;
|
|
224
224
|
socket.options.mandatory = true;
|
|
225
225
|
socket.options.probe = true;
|
|
226
|
-
if (
|
|
227
|
-
socket.options.
|
|
226
|
+
if (options?.sendHighWaterMark !== undefined) {
|
|
227
|
+
socket.options.sendHwm = BigInt(options.sendHighWaterMark);
|
|
228
|
+
}
|
|
229
|
+
if (options?.receiveHighWaterMark !== undefined) {
|
|
230
|
+
socket.options.recvHwm = BigInt(options.receiveHighWaterMark);
|
|
231
|
+
}
|
|
232
|
+
if (options?.receiveTimeoutMs !== undefined) {
|
|
233
|
+
socket.options.recvTimeout = options.receiveTimeoutMs;
|
|
228
234
|
}
|
|
229
235
|
}
|
|
230
236
|
localEndpoint() {
|
|
@@ -36,7 +36,7 @@ export declare class ZLinkNodeRawMeshBackend implements ZLinkBackendMeshNode {
|
|
|
36
36
|
private readonly lifecycleGeneration;
|
|
37
37
|
private bindEndpoint?;
|
|
38
38
|
private advertiseHost?;
|
|
39
|
-
|
|
39
|
+
runtime?: RawServiceMeshRuntime;
|
|
40
40
|
private stateful?;
|
|
41
41
|
private readyHandler?;
|
|
42
42
|
private maintenanceTimer?;
|
|
@@ -277,7 +277,7 @@ export declare class ZLinkNodeRawMeshBackend implements ZLinkBackendMeshNode {
|
|
|
277
277
|
setSpotSubscription(state: ServiceSpotState, channelName: string, topicFilter: string): void;
|
|
278
278
|
unsetSpotSubscription(state: ServiceSpotState, channelName: string, topicFilter: string): void;
|
|
279
279
|
clearSpotSubscriptions(state: ServiceSpotState): void;
|
|
280
|
-
|
|
280
|
+
createDescriptor(): ServiceNodeDescriptor;
|
|
281
281
|
private resolveAdvertisedEndpoint;
|
|
282
282
|
/**
|
|
283
283
|
* Arms the one maintenance timer for the nearest management deadline
|
|
@@ -369,6 +369,7 @@ class ZLinkNodeRawMeshBackend {
|
|
|
369
369
|
}
|
|
370
370
|
expectPeer(peer) {
|
|
371
371
|
this.requireRuntime().expectPeerByRoutingId(peer.endpoint, peer.nodeRoutingId, peer.securityIdentity, peer.lifecycleGeneration);
|
|
372
|
+
this.scheduleMaintenance();
|
|
372
373
|
}
|
|
373
374
|
removePeerConnection(intentId) {
|
|
374
375
|
const intent = this.peerIntents.get(intentId);
|
|
@@ -1447,6 +1448,9 @@ function completionRecord(operationId, operationKind, result) {
|
|
|
1447
1448
|
kindData: 'kindData' in result ? (result.kindData ?? null) : null,
|
|
1448
1449
|
terminalResult: result.terminalResult,
|
|
1449
1450
|
failureErrno: result.failureCode,
|
|
1451
|
+
...('failureMessage' in result && result.failureMessage !== undefined
|
|
1452
|
+
? { failureMessage: result.failureMessage }
|
|
1453
|
+
: {}),
|
|
1450
1454
|
parts: payload === undefined
|
|
1451
1455
|
? []
|
|
1452
1456
|
: payload.contentType === MULTIPART_CONTENT_TYPE
|
|
@@ -1667,10 +1671,10 @@ function decodeStatefulRecord(record, stateful) {
|
|
|
1667
1671
|
});
|
|
1668
1672
|
return accepted ? zlink_1.SubmitResult.Ok : zlink_1.SubmitResult.InvalidState;
|
|
1669
1673
|
},
|
|
1670
|
-
replyFailure(terminalResult, failureCode) {
|
|
1674
|
+
replyFailure(terminalResult, failureCode, tail) {
|
|
1671
1675
|
if (stateful.reply === undefined)
|
|
1672
1676
|
return zlink_1.SubmitResult.InvalidState;
|
|
1673
|
-
return stateful.reply(terminalResult, failureCode)
|
|
1677
|
+
return stateful.reply(terminalResult, failureCode, undefined, tail)
|
|
1674
1678
|
? zlink_1.SubmitResult.Ok
|
|
1675
1679
|
: zlink_1.SubmitResult.InvalidState;
|
|
1676
1680
|
}
|
|
@@ -1678,12 +1682,15 @@ function decodeStatefulRecord(record, stateful) {
|
|
|
1678
1682
|
}
|
|
1679
1683
|
function receiveIngressLifecycle(record) {
|
|
1680
1684
|
const applicationJob = record.applicationJob;
|
|
1681
|
-
return
|
|
1682
|
-
? {}
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1685
|
+
return {
|
|
1686
|
+
...(record.receivedAt === undefined ? {} : { receivedAt: record.receivedAt }),
|
|
1687
|
+
...(applicationJob === undefined
|
|
1688
|
+
? {}
|
|
1689
|
+
: {
|
|
1690
|
+
applicationJobPermit: applicationJob,
|
|
1691
|
+
releaseRetainedIngress: () => applicationJob.close()
|
|
1692
|
+
})
|
|
1693
|
+
};
|
|
1687
1694
|
}
|
|
1688
1695
|
function prepareStatefulMailboxDispatch(signal) {
|
|
1689
1696
|
const mailboxRecord = this.statefulMailboxRecord;
|
|
@@ -2,7 +2,7 @@ import type { ZLinkHandlerMessageType } from '../../contracts/Common/HandlerMess
|
|
|
2
2
|
import type { ZLinkMeshDispatchAdmission } from '../admission';
|
|
3
3
|
import type { ZLinkMessageContext, ZLinkHandlerFilter, ZLinkUnhandledDispatchOptions, ZLinkFlowOrigin } from '../../contracts';
|
|
4
4
|
import { ZLinkFrameworkException } from '../../contracts';
|
|
5
|
-
import { ZLinkDispatchMessageKind, ZLinkDispatchErrorSurface } from '../../contracts/Dispatch/ZLinkDispatchOptions';
|
|
5
|
+
import { ZLinkRuntimeMessageFlowOutcome as ZLinkMessageFlowOutcome, ZLinkDispatchMessageKind, ZLinkDispatchErrorSurface } from '../../contracts/Dispatch/ZLinkDispatchOptions';
|
|
6
6
|
import { type ZLinkChannelEnvelope, type ZLinkChannelEnvelopeCodecRegistry } from './channel-envelope';
|
|
7
7
|
import type { ZLinkMalformedChannelHeaderInfo } from './channel-envelope-inspection';
|
|
8
8
|
import type { ZLinkDispatchErrorReporter } from './dispatch-error-reporter';
|
|
@@ -47,8 +47,8 @@ export interface ZLinkRequestDispatch<TContext extends ZLinkMessageContext> {
|
|
|
47
47
|
readonly writeError: (error: unknown) => void | Promise<void>;
|
|
48
48
|
}
|
|
49
49
|
export declare class ZLinkChannelDispatchPipeline {
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
readonly options: ZLinkChannelDispatchPipelineOptions;
|
|
51
|
+
readonly filters: readonly ZLinkHandlerFilter[];
|
|
52
52
|
private readonly unhandled;
|
|
53
53
|
constructor(options: ZLinkChannelDispatchPipelineOptions);
|
|
54
54
|
/**
|
|
@@ -67,7 +67,7 @@ export declare class ZLinkChannelDispatchPipeline {
|
|
|
67
67
|
*/
|
|
68
68
|
dispatchRequest<TContext extends ZLinkMessageContext>(dispatch: ZLinkRequestDispatch<TContext>, admit?: ZLinkMeshDispatchAdmission): void | Promise<void>;
|
|
69
69
|
private dispatchMissingRequest;
|
|
70
|
-
|
|
70
|
+
invokeInFlow<TContext extends ZLinkMessageContext, TResult>(dispatch: ZLinkOneWayDispatch<TContext> | ZLinkRequestDispatch<TContext>, handler: ZLinkChannelDispatchHandler<TContext, TResult>): unknown;
|
|
71
71
|
private completeRequest;
|
|
72
72
|
private replyPathMissing;
|
|
73
73
|
private failRequest;
|
|
@@ -87,13 +87,14 @@ export declare class ZLinkChannelDispatchPipeline {
|
|
|
87
87
|
readonly sourceRid?: string;
|
|
88
88
|
readonly writeProtocolError?: (error: ZLinkFrameworkException) => Promise<void>;
|
|
89
89
|
}): Promise<void>;
|
|
90
|
-
|
|
90
|
+
invoke<TContext extends ZLinkMessageContext, TResult>(dispatch: ZLinkOneWayDispatch<TContext> | ZLinkRequestDispatch<TContext>, handler: ZLinkChannelDispatchHandler<TContext, TResult>): TResult | undefined | typeof HANDLER_FILTER_REJECTED | Promise<TResult | undefined | typeof HANDLER_FILTER_REJECTED>;
|
|
91
91
|
private invokeFiltered;
|
|
92
92
|
private createFilterContext;
|
|
93
93
|
private dispatchKind;
|
|
94
94
|
private report;
|
|
95
|
-
|
|
95
|
+
trace(outcome: ZLinkMessageFlowOutcome, fields: ZLinkChannelDispatchFields): void;
|
|
96
96
|
private failureReason;
|
|
97
97
|
private applyOneWayUnhandled;
|
|
98
98
|
}
|
|
99
|
+
declare const HANDLER_FILTER_REJECTED: unique symbol;
|
|
99
100
|
export {};
|