@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,23 +1,30 @@
|
|
|
1
1
|
import type { RequestRuntime } from '../foundation/request-runtime';
|
|
2
2
|
import { inspectRuntime } from '../internal-observation';
|
|
3
|
-
import { type RoutingId, type ZLinkMeshNodeDescriptor } from '../../contracts';
|
|
3
|
+
import { type RoutingId, type Type, type ZLinkActor, type ZLinkMeshNodeDescriptor, ZLinkSpotKind } from '../../contracts';
|
|
4
4
|
import type { ZLinkProviderResolver } from '../../contracts/Common/ZLinkProviderResolver';
|
|
5
5
|
import type { ZLinkActivationAdmission } from '../activation-admission';
|
|
6
6
|
import type { DefaultZLinkActorManager } from '../actors';
|
|
7
|
-
import { type ZLinkActorHandoffPacket } from '../actors/actor-handoff';
|
|
7
|
+
import { type ZLinkActorHandoffPacket, type ZLinkActorHandoffResult } from '../actors/actor-handoff';
|
|
8
8
|
import type { ZLinkActorJoinRelocation } from '../actors/actor-join-relocation';
|
|
9
|
+
import { type ZLinkActorRuntimeState } from '../actors/actor-runtime-state';
|
|
9
10
|
import type { ZLinkBackendMeshNode, ZLinkMeshCompletionTable } from '../backend';
|
|
10
11
|
import type { ZLinkFrameworkRegistration } from '../configuration';
|
|
11
|
-
import { type ZLinkRuntimeEventPublisher, type ZLinkRuntimeMetrics } from '../diagnostics';
|
|
12
|
+
import { type ZLinkRuntimeEventPublisher, type ZLinkRelocationMetricOperation, type ZLinkRuntimeMetrics } from '../diagnostics';
|
|
12
13
|
import { type ZLinkMessageFlowTracer } from '../diagnostics/message-flow';
|
|
13
|
-
import { type
|
|
14
|
+
import { type ServicePreparedRelocationAggregate } from '../foundation/service-relocation-aggregate-committer';
|
|
15
|
+
import { ServiceRelocationObjectRestoreOwner, type ServiceCapturedObjectRelocation, type ServiceObjectRelocationStaging, type ServiceRelocationHiddenObject, type ServiceRelocationTargetObjectPort } from '../foundation/service-relocation-object-owner';
|
|
16
|
+
import { ServiceRelocationAuthorityPayloadCodec, type ServiceRelocationEnvelope, type ServiceRelocationMembership, type ServiceRelocationParticipant, type ServiceRelocationPublication, type ServiceRelocationQueuedMessage } from '../foundation/service-relocation-runtime';
|
|
14
17
|
import { type ReceiveRecord } from '../foundation/service-runtime-contracts';
|
|
15
|
-
import { type ServiceSessionRelocationRoute, type ServiceSessionRelocationSeal, type ServiceSessionRelocationSealed } from '../foundation/service-stateful-wire-codec';
|
|
18
|
+
import { type ServiceMaintenanceRelocationCutover, type ServiceMaintenanceRelocationData, type ServiceMaintenanceRelocationPrepare, type ServiceMaintenanceRelocationReady, type ServiceMaintenanceReplyRelay, type ServiceSessionRelocationRoute, type ServiceSessionRelocationSeal, type ServiceSessionRelocationSealed, type ServiceWireRelocationCoordinatorFence, type ServiceWireRelocationTarget, type ServiceWireRequestSourceFence } from '../foundation/service-stateful-wire-codec';
|
|
16
19
|
import type { ZLinkDomainLocationStore as ZLinkLocationStore } from '../locations/domain-store-contract';
|
|
17
|
-
import type { ZLinkLocationOwnerToken } from '../locations/internal-location-contracts';
|
|
20
|
+
import type { ZLinkAuthoritySnapshot, ZLinkLocationOwnerToken } from '../locations/internal-location-contracts';
|
|
18
21
|
import type { ZLinkTrackedInstanceAuthority } from '../locations/spot-location-claims';
|
|
19
22
|
import type { DefaultZLinkSpotManager } from '../spots';
|
|
23
|
+
import type { ZLinkSpotActivation } from '../spots/spot-activation-state';
|
|
24
|
+
import type { ZLinkSpotRouteTarget } from '../spots/spot-routing-internal';
|
|
20
25
|
import { type ZLinkActorTransferRuntime } from './actor-transfer-runtime';
|
|
26
|
+
import { ZLinkRelocationPayloadAssembly } from './relocation-direct-transfer';
|
|
27
|
+
import { decodeServiceRelocationControlResponse, type ZLinkServiceRelocationControlRequest } from './service-relocation-control';
|
|
21
28
|
export declare class ZLinkRelocationStateIncompatibleError extends Error {
|
|
22
29
|
constructor(message: string);
|
|
23
30
|
}
|
|
@@ -45,15 +52,92 @@ interface ZLinkHostRelocationOptions {
|
|
|
45
52
|
clear?(): void | Promise<void>;
|
|
46
53
|
};
|
|
47
54
|
readonly trackInstanceSpot?: (input: ZLinkTrackedInstanceAuthority) => void;
|
|
48
|
-
readonly
|
|
55
|
+
readonly observeActorAuthorityVersion?: (actorId: string, storeVersion: string) => void;
|
|
49
56
|
readonly reconcileStatefulAuthorityRoutes?: (signal?: AbortSignal) => Promise<void>;
|
|
50
57
|
readonly runtimeEventPublisher?: ZLinkRuntimeEventPublisher;
|
|
51
58
|
readonly metrics?: ZLinkRuntimeMetrics;
|
|
52
59
|
readonly activationAdmission?: ZLinkActivationAdmission;
|
|
53
60
|
}
|
|
61
|
+
interface LocalHidden extends ServiceRelocationHiddenObject {
|
|
62
|
+
readonly participant: ServiceRelocationParticipant;
|
|
63
|
+
readonly actor?: ZLinkActor;
|
|
64
|
+
readonly activation?: ZLinkSpotActivation;
|
|
65
|
+
initialized: boolean;
|
|
66
|
+
replayStart?: Promise<void>;
|
|
67
|
+
onReplayResult?: (packet: ZLinkActorHandoffPacket, result: ZLinkActorHandoffResult) => Promise<void>;
|
|
68
|
+
readonly replayPackets: ZLinkActorHandoffPacket[];
|
|
69
|
+
targetAuthorityOwnerGeneration?: bigint;
|
|
70
|
+
}
|
|
71
|
+
interface LocalStage {
|
|
72
|
+
readonly offer: TargetRelocationOffer;
|
|
73
|
+
readonly owner: ServiceRelocationObjectRestoreOwner<LocalHidden>;
|
|
74
|
+
readonly staging: ServiceObjectRelocationStaging<LocalHidden>;
|
|
75
|
+
phase: 'ready' | 'finalizing' | 'committed' | 'open' | 'failed';
|
|
76
|
+
lane: Promise<void>;
|
|
77
|
+
cutoverReceived: boolean;
|
|
78
|
+
/** Boundary relay records buffered until cutover (or fallback) applies them. */
|
|
79
|
+
readonly boundaryRelay: ServiceMaintenanceRelocationData[];
|
|
80
|
+
fallback?: ReturnType<typeof setTimeout>;
|
|
81
|
+
finalize?: Promise<void>;
|
|
82
|
+
/** The Restore's activation admission (MeshNode §5.1); held until target commit or abort. */
|
|
83
|
+
readonly releaseActivation: () => void;
|
|
84
|
+
readonly releaseJoinAdmission: () => void;
|
|
85
|
+
}
|
|
86
|
+
interface TargetPayloadAssembly {
|
|
87
|
+
readonly prepare: ServiceMaintenanceRelocationPrepare;
|
|
88
|
+
readonly fingerprint: string;
|
|
89
|
+
readonly authenticatedSourceNodeRid: string;
|
|
90
|
+
readonly assembly: ZLinkRelocationPayloadAssembly;
|
|
91
|
+
}
|
|
92
|
+
/** One authority read decides commit and the snapshots eligible for Follow. */
|
|
93
|
+
type SourceAuthorityCommit = {
|
|
94
|
+
readonly kind: 'target';
|
|
95
|
+
readonly followAuthorities: ReadonlyMap<string, ZLinkAuthoritySnapshot>;
|
|
96
|
+
};
|
|
97
|
+
interface SourceCutoverWindow {
|
|
98
|
+
readonly meshName: string;
|
|
99
|
+
readonly targetNodeRid: RoutingId;
|
|
100
|
+
/** Boundary batch frames plus the cutover frame, retained until authority settlement. */
|
|
101
|
+
frames?: readonly Buffer[];
|
|
102
|
+
/** The ready route used to submit the retained batch. */
|
|
103
|
+
submittedRouteGeneration?: bigint;
|
|
104
|
+
readonly cutoverSubmittedAtMs: number;
|
|
105
|
+
followTimer?: ReturnType<typeof setTimeout>;
|
|
106
|
+
windowClosed: boolean;
|
|
107
|
+
followExpired: boolean;
|
|
108
|
+
}
|
|
109
|
+
interface TargetRelocationReservation {
|
|
110
|
+
readonly prepared: ServicePreparedRelocationAggregate;
|
|
111
|
+
}
|
|
112
|
+
interface TargetRelocationOffer {
|
|
113
|
+
readonly prepare: ServiceMaintenanceRelocationPrepare;
|
|
114
|
+
readonly prepareFingerprint: string;
|
|
115
|
+
readonly authenticatedSourceNodeRid: string;
|
|
116
|
+
readonly envelope: ServiceRelocationEnvelope;
|
|
117
|
+
readonly reservation: TargetRelocationReservation;
|
|
118
|
+
}
|
|
119
|
+
interface TargetPrepareOperation {
|
|
120
|
+
readonly fingerprint: string;
|
|
121
|
+
readonly promise: Promise<ServiceMaintenanceRelocationReady>;
|
|
122
|
+
}
|
|
123
|
+
interface SourceActorSession {
|
|
124
|
+
readonly state: ZLinkActorRuntimeState;
|
|
125
|
+
readonly actor: ZLinkActor;
|
|
126
|
+
readonly prepared: Awaited<ReturnType<ZLinkActorTransferRuntime['prepareMaintenanceSession']>>;
|
|
127
|
+
}
|
|
128
|
+
interface PendingSessionRelocation {
|
|
129
|
+
readonly targetNodeRid: string;
|
|
130
|
+
readonly request: ServiceSessionRelocationSeal;
|
|
131
|
+
readonly requestFingerprint: string;
|
|
132
|
+
readonly promise: Promise<ServiceSessionRelocationSealed>;
|
|
133
|
+
readonly resolve: (response: ServiceSessionRelocationSealed) => void;
|
|
134
|
+
readonly reject: (error: unknown) => void;
|
|
135
|
+
retryTimer?: ReturnType<typeof setTimeout>;
|
|
136
|
+
deadlineTimer?: ReturnType<typeof setTimeout>;
|
|
137
|
+
}
|
|
54
138
|
/** Production host bridge from Retire inventory to remote RouteMesh owners. */
|
|
55
139
|
export declare class ZLinkHostServiceRelocationRuntime implements ZLinkActorJoinRelocation {
|
|
56
|
-
|
|
140
|
+
readonly options: ZLinkHostRelocationOptions;
|
|
57
141
|
[inspectRuntime](): Readonly<{
|
|
58
142
|
targetStages: number;
|
|
59
143
|
targetAssemblies: number;
|
|
@@ -64,11 +148,11 @@ export declare class ZLinkHostServiceRelocationRuntime implements ZLinkActorJoin
|
|
|
64
148
|
}> | undefined;
|
|
65
149
|
terminalTargets: number;
|
|
66
150
|
}>;
|
|
67
|
-
|
|
151
|
+
readonly targetStages: Map<string, LocalStage>;
|
|
68
152
|
private readonly terminalTargets;
|
|
69
|
-
|
|
153
|
+
readonly targetPrepareOperations: Map<string, TargetPrepareOperation>;
|
|
70
154
|
private readonly pendingReplyRelays;
|
|
71
|
-
|
|
155
|
+
readonly pendingSessionRelocations: Map<string, PendingSessionRelocation>;
|
|
72
156
|
private readonly terminalSessionRelocations;
|
|
73
157
|
/**
|
|
74
158
|
* A command 44 submit has no response path. Keep a bounded record of a
|
|
@@ -77,7 +161,7 @@ export declare class ZLinkHostServiceRelocationRuntime implements ZLinkActorJoin
|
|
|
77
161
|
*/
|
|
78
162
|
private readonly failedSessionRouteSubmits;
|
|
79
163
|
private readonly sourceRelocationIds;
|
|
80
|
-
|
|
164
|
+
readonly targetAssemblies: Map<string, TargetPayloadAssembly>;
|
|
81
165
|
/**
|
|
82
166
|
* Terminal restore failures (assembly/checksum/factory/restore error): the
|
|
83
167
|
* target already sent relocationFailed (command 53) once. An exact-identity
|
|
@@ -96,7 +180,7 @@ export declare class ZLinkHostServiceRelocationRuntime implements ZLinkActorJoin
|
|
|
96
180
|
private nodePayloadBudget?;
|
|
97
181
|
private readonly sourceActorJoinProfiles;
|
|
98
182
|
private readonly terminalActorJoinSourceLeaves;
|
|
99
|
-
|
|
183
|
+
readonly codec: ServiceRelocationAuthorityPayloadCodec;
|
|
100
184
|
/**
|
|
101
185
|
* Set once dispose() starts tearing assemblies down. A payload() rejection
|
|
102
186
|
* observed after this point is the shutdown itself, not a chunk-assembly or
|
|
@@ -122,7 +206,7 @@ export declare class ZLinkHostServiceRelocationRuntime implements ZLinkActorJoin
|
|
|
122
206
|
tryHandleControl(meshName: string, record: ReceiveRecord, signal?: AbortSignal): boolean | Promise<boolean>;
|
|
123
207
|
private handleControl;
|
|
124
208
|
/** Sends the Ready reply once the async restore finished; failures replay on resend. */
|
|
125
|
-
|
|
209
|
+
deliverTargetReady(meshName: string, operationKey: string, request: ServiceMaintenanceRelocationPrepare, ingress: ReceiveRecord, operation: Promise<ServiceMaintenanceRelocationReady>): Promise<void>;
|
|
126
210
|
/** Cleans up a Ready reply that never delivered within the Restore validity window. */
|
|
127
211
|
private expireTargetReadyResponse;
|
|
128
212
|
/**
|
|
@@ -145,16 +229,24 @@ export declare class ZLinkHostServiceRelocationRuntime implements ZLinkActorJoin
|
|
|
145
229
|
private handleSessionRelocationRoute;
|
|
146
230
|
private validateSessionOwnerFence;
|
|
147
231
|
private sendSessionRelocationResponse;
|
|
148
|
-
|
|
232
|
+
relocateSpotAggregate(meshName: string, activation: ZLinkSpotActivation, kind: 'user_spot' | 'instance_spot', actorStates: readonly ZLinkActorRuntimeState[], target: ZLinkMeshNodeDescriptor | undefined, targetApplicationVersion: bigint | undefined, signal?: AbortSignal): Promise<void>;
|
|
149
233
|
private relocateSpotAggregateCore;
|
|
150
|
-
|
|
151
|
-
|
|
234
|
+
relocateStandaloneActor(meshName: string, state: ZLinkActorRuntimeState, target: ZLinkMeshNodeDescriptor | undefined, targetApplicationVersion: bigint | undefined, signal?: AbortSignal, targetMembership?: ZLinkSpotRouteTarget & {
|
|
235
|
+
readonly spotKind: ZLinkSpotKind.Entry | ZLinkSpotKind.User;
|
|
236
|
+
readonly spotObjectGeneration: bigint;
|
|
237
|
+
}, aggregateIdOverride?: string, retainSourceForActorJoin?: boolean,
|
|
238
|
+
/** Target's advertised relocation state chunk cap (Actor Join only; spec 15 §4.2). */
|
|
239
|
+
advertisedReceiveChunkLimitBytes?: number, deadlineAtMs?: number): Promise<void>;
|
|
240
|
+
relocatePerActorSpotShell(meshName: string, activation: ZLinkSpotActivation, target: ZLinkMeshNodeDescriptor | undefined, targetApplicationVersion: bigint | undefined, signal?: AbortSignal): Promise<void>;
|
|
152
241
|
private relocatePerActorSpotShellCore;
|
|
153
242
|
private actorCaptureUnit;
|
|
154
243
|
private reserveRelocationId;
|
|
155
244
|
private reserveExactRelocationId;
|
|
156
|
-
|
|
245
|
+
runCoordinator(meshName: string, target: ZLinkMeshNodeDescriptor, primary: ZLinkAuthoritySnapshot, captured: ServiceCapturedObjectRelocation, _authorities: ReadonlyMap<string, ZLinkAuthoritySnapshot>, signal?: AbortSignal, sessions?: readonly SourceActorSession[],
|
|
246
|
+
/** Target's advertised relocation state chunk cap (Actor Join only; spec 15 §4.2). */
|
|
247
|
+
advertisedReceiveChunkLimitBytes?: number, controlDeadlineAtMs?: number, relocationMetric?: ZLinkRelocationMetricOperation): Promise<void>;
|
|
157
248
|
private completeSourceRelocationMetric;
|
|
249
|
+
startSourceRelocationMetric(meshName: string, objectKind: 'actor' | 'user_spot' | 'instance_spot', policy: 'recreate' | 'snapshot', actorId?: string): ZLinkRelocationMetricOperation | undefined;
|
|
158
250
|
/** Streams the payload chunks of one stage under the effective in-flight budgets. */
|
|
159
251
|
private sendRelocationStateChunks;
|
|
160
252
|
/**
|
|
@@ -163,7 +255,7 @@ export declare class ZLinkHostServiceRelocationRuntime implements ZLinkActorJoin
|
|
|
163
255
|
*/
|
|
164
256
|
private acquireRelocationBudget;
|
|
165
257
|
/** Pre-seal admission wait — a full budget delays the next unit before seal. */
|
|
166
|
-
|
|
258
|
+
waitForRelocationBudgetHeadroom(targetRid: string, signal?: AbortSignal): Promise<void>;
|
|
167
259
|
private requireNodePayloadBudget;
|
|
168
260
|
private requirePeerPayloadBudget;
|
|
169
261
|
/**
|
|
@@ -178,7 +270,7 @@ export declare class ZLinkHostServiceRelocationRuntime implements ZLinkActorJoin
|
|
|
178
270
|
private closeSourceCutoverWindow;
|
|
179
271
|
private releaseSourceCutoverWindow;
|
|
180
272
|
/** Relocation flow §4.4: replay the whole batch on a different ready route. */
|
|
181
|
-
|
|
273
|
+
resendSourceCutover(window: SourceCutoverWindow): Promise<void>;
|
|
182
274
|
/**
|
|
183
275
|
* The one source authority settlement after request creation (Location runtime
|
|
184
276
|
* §6.1·§10, spec 28 §4.4). It reads the Store until the target commit or
|
|
@@ -191,7 +283,7 @@ export declare class ZLinkHostServiceRelocationRuntime implements ZLinkActorJoin
|
|
|
191
283
|
* A committed later owner has no Follow snapshot (Location runtime §10). An uncertain
|
|
192
284
|
* Store or lease result keeps the work retained and repeats the same decision.
|
|
193
285
|
*/
|
|
194
|
-
|
|
286
|
+
settleSourceAuthority(envelope: ServiceRelocationEnvelope, primary: ZLinkAuthoritySnapshot, target: ServiceWireRelocationTarget, restoreDeadlineReached: () => boolean, window: SourceCutoverWindow | undefined, relocationMetric?: ZLinkRelocationMetricOperation): Promise<SourceAuthorityCommit | 'source' | 'lost'>;
|
|
195
287
|
private readSourceSettlement;
|
|
196
288
|
/**
|
|
197
289
|
* True when every relocation this source started reached its Message
|
|
@@ -199,9 +291,9 @@ export declare class ZLinkHostServiceRelocationRuntime implements ZLinkActorJoin
|
|
|
199
291
|
* ended — both source-local events (spec 30 §11).
|
|
200
292
|
*/
|
|
201
293
|
isSafeToShutdown(): boolean;
|
|
202
|
-
|
|
294
|
+
releaseParticipantAuthorities(envelope: ServiceRelocationEnvelope, primaryKey: string, signal?: AbortSignal): Promise<void>;
|
|
203
295
|
/** Restores the hidden object and its saved-work prefix before Ready. */
|
|
204
|
-
|
|
296
|
+
handlePrepareControl(meshName: string, stagingId: string, request: ServiceMaintenanceRelocationPrepare, sourceNodeRid: RoutingId, signal?: AbortSignal): Promise<ServiceMaintenanceRelocationReady>;
|
|
205
297
|
/**
|
|
206
298
|
* The cutover wait of a Ready stage (spec 28 §4.4) is a Warning only: it
|
|
207
299
|
* records `cutover_timeout` and never submits the target CAS or opens
|
|
@@ -219,34 +311,49 @@ export declare class ZLinkHostServiceRelocationRuntime implements ZLinkActorJoin
|
|
|
219
311
|
* whole (the retransmission always resends the entire batch, so the exact
|
|
220
312
|
* span is the staged suffix of `boundaryRecordCount` records).
|
|
221
313
|
*/
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
314
|
+
reconcileBoundaryRelay(stage: LocalStage, request: ServiceMaintenanceRelocationCutover, stagingId: string): void;
|
|
315
|
+
beginTargetFinalize(meshName: string, stagingId: string, stage: LocalStage, signal?: AbortSignal): Promise<void>;
|
|
316
|
+
finalizeTargetStage(meshName: string, stagingId: string, stage: LocalStage, signal?: AbortSignal): Promise<void>;
|
|
225
317
|
private validateRelocationData;
|
|
226
318
|
private applyRelocationData;
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
319
|
+
finalizeActorJoinProfiles(meshName: string, stage: LocalStage, signal?: AbortSignal): Promise<void>;
|
|
320
|
+
submitActorJoinSourceLeave(meshName: string, sourceNodeRid: RoutingId, relocationId: string, actorId: string): Promise<void>;
|
|
321
|
+
acceptActorJoinSourceLeave(input: {
|
|
322
|
+
readonly transferId: string;
|
|
323
|
+
readonly actorId: string;
|
|
324
|
+
readonly succeeded: boolean;
|
|
325
|
+
}): boolean;
|
|
230
326
|
private sendControlOneWay;
|
|
231
|
-
|
|
232
|
-
|
|
327
|
+
submitControlFrame(meshName: string, targetNodeRid: RoutingId, frame: Buffer, kind: string): Promise<void>;
|
|
328
|
+
clearTargetRelocationPublication(stage: LocalStage, primary: ZLinkAuthoritySnapshot, signal?: AbortSignal): Promise<ZLinkAuthoritySnapshot>;
|
|
233
329
|
private handleReplyRelay;
|
|
234
|
-
|
|
330
|
+
sendReplyRelay(meshName: string, ackTargetNodeRid: RoutingId, request: ServiceMaintenanceReplyRelay, expectedRequestSource: ServiceWireRequestSourceFence, signal?: AbortSignal): Promise<RelocationTerminalDelivery>;
|
|
235
331
|
private acceptReplyRelayAck;
|
|
236
332
|
private requireAdmittedPeer;
|
|
237
|
-
|
|
238
|
-
|
|
333
|
+
targetReplyRelayCoordinator(meshName: string, stage: LocalStage, authority: ZLinkAuthoritySnapshot): ServiceWireRelocationCoordinatorFence;
|
|
334
|
+
relayTerminalReply(meshName: string, stage: LocalStage, coordinator: ServiceWireRelocationCoordinatorFence, participantId: bigint, packet: ZLinkActorHandoffPacket, result: ZLinkActorHandoffResult, signal?: AbortSignal): Promise<void>;
|
|
239
335
|
private exactSourceLeaseExpired;
|
|
240
|
-
|
|
241
|
-
|
|
336
|
+
publishSessionRoutes(staging: ServiceObjectRelocationStaging<LocalHidden>): Promise<void>;
|
|
337
|
+
sendControl(meshName: string, targetNodeRid: RoutingId, request: ZLinkServiceRelocationControlRequest, signal?: AbortSignal, deadlineAtMs?: number, onSubmitted?: (signal: AbortSignal) => Promise<void>): Promise<ReturnType<typeof decodeServiceRelocationControlResponse>>;
|
|
242
338
|
private selectTarget;
|
|
243
339
|
private readTargetParticipantAuthorities;
|
|
244
|
-
|
|
245
|
-
|
|
340
|
+
reserveTargetForPrepare(meshName: string, prepare: ServiceMaintenanceRelocationPrepare, envelope: ServiceRelocationEnvelope, signal?: AbortSignal): Promise<TargetRelocationReservation>;
|
|
341
|
+
authorityPayloadForPublication(payload: Uint8Array, publication: ServiceRelocationPublication, target?: {
|
|
342
|
+
readonly owner: ZLinkLocationOwnerToken;
|
|
343
|
+
readonly meshName: string;
|
|
344
|
+
readonly nodeRid: string;
|
|
345
|
+
readonly nodeGeneration: bigint;
|
|
346
|
+
readonly objectGeneration: bigint;
|
|
347
|
+
readonly targetAttemptGeneration: bigint;
|
|
348
|
+
readonly coordinatorExpectedStoreVersion: string;
|
|
349
|
+
readonly actorSpotId?: string;
|
|
350
|
+
readonly actorSpotGeneration?: bigint;
|
|
351
|
+
readonly actorSpotKind?: ZLinkSpotKind.Entry | ZLinkSpotKind.User;
|
|
352
|
+
}): Uint8Array;
|
|
246
353
|
private abortTargetReservation;
|
|
247
354
|
private abortTargetStage;
|
|
248
355
|
private discardTargetStage;
|
|
249
|
-
|
|
356
|
+
commitTargetReservation(stage: LocalStage, reservation: TargetRelocationReservation, signal?: AbortSignal): Promise<ZLinkAuthoritySnapshot | undefined>;
|
|
250
357
|
/**
|
|
251
358
|
* The one target authority settlement (Location runtime §10, spec 28
|
|
252
359
|
* §4.4-§4.5). Only a verified cutover lets the target submit its NewOwner
|
|
@@ -259,27 +366,57 @@ export declare class ZLinkHostServiceRelocationRuntime implements ZLinkActorJoin
|
|
|
259
366
|
* caller then discards the staging.
|
|
260
367
|
*/
|
|
261
368
|
private commitTargetAggregate;
|
|
262
|
-
|
|
263
|
-
|
|
369
|
+
readAggregateForCommitRetry(prepared: ServicePreparedRelocationAggregate, signal?: AbortSignal): Promise<{
|
|
370
|
+
readonly kind: 'committed';
|
|
371
|
+
readonly authorities: ReadonlyMap<string, ZLinkAuthoritySnapshot>;
|
|
372
|
+
} | {
|
|
373
|
+
readonly kind: 'source' | 'unknown' | 'stale';
|
|
374
|
+
}>;
|
|
375
|
+
materializeTargetEnvelope(meshName: string, envelope: ServiceRelocationEnvelope, signal?: AbortSignal): Promise<Pick<LocalStage, 'owner' | 'staging'> & {
|
|
376
|
+
readonly target: LocalTargetPort;
|
|
377
|
+
}>;
|
|
264
378
|
/** Maps schema ordinals to the authoritative Location Store inventory. */
|
|
265
|
-
|
|
379
|
+
resolveTargetParticipantInventory(meshName: string, request: ServiceMaintenanceRelocationPrepare, envelope: ServiceRelocationEnvelope, signal?: AbortSignal): Promise<ServiceRelocationEnvelope>;
|
|
266
380
|
private spotKind;
|
|
267
381
|
private spotRegistration;
|
|
268
382
|
private actorRegistration;
|
|
269
|
-
|
|
383
|
+
captureApplication<T>(policy: {
|
|
384
|
+
readonly kind: 'disabled' | 'recreate' | 'snapshot';
|
|
385
|
+
readonly adapterType?: Type;
|
|
386
|
+
}, value: T, signal?: AbortSignal): Promise<Uint8Array>;
|
|
270
387
|
private createRelocationAdapter;
|
|
271
388
|
private recordRelocationInterruption;
|
|
272
389
|
private sealSpotMessageFollow;
|
|
273
390
|
private commitSpotMessageFollow;
|
|
274
391
|
private requireLocationStore;
|
|
275
392
|
private requireSpotManager;
|
|
276
|
-
|
|
393
|
+
afterSpotCloseDecision<T>(meshName: string, spotId: RoutingId, seal: () => T): T | Promise<T>;
|
|
277
394
|
private requireActorManager;
|
|
278
395
|
private relocationLimits;
|
|
279
396
|
private requireMeshNode;
|
|
280
397
|
private sendInfrastructureControl;
|
|
281
398
|
private requestInfrastructureControl;
|
|
282
399
|
}
|
|
400
|
+
declare class LocalTargetPort implements ServiceRelocationTargetObjectPort<LocalHidden> {
|
|
401
|
+
private readonly options;
|
|
402
|
+
private readonly meshName;
|
|
403
|
+
private readonly envelope;
|
|
404
|
+
constructor(options: ZLinkHostRelocationOptions, meshName: string, envelope: ServiceRelocationEnvelope);
|
|
405
|
+
createHidden(participant: ServiceRelocationParticipant, signal?: AbortSignal): Promise<LocalHidden>;
|
|
406
|
+
restoreApplicationState(hidden: LocalHidden, payload: Uint8Array, signal?: AbortSignal): Promise<void>;
|
|
407
|
+
restoreMemberships(hidden: ReadonlyMap<string, LocalHidden>, memberships: readonly ServiceRelocationMembership[]): Promise<void>;
|
|
408
|
+
publish(hidden: LocalHidden, authority: ZLinkAuthoritySnapshot): Promise<void>;
|
|
409
|
+
restoreBoundSession(hidden: LocalHidden, payload: Uint8Array): Promise<void>;
|
|
410
|
+
replayQueuedMessage(hidden: LocalHidden, message: ServiceRelocationQueuedMessage): Promise<void>;
|
|
411
|
+
openAdmission(hidden: LocalHidden): Promise<void>;
|
|
412
|
+
normalize(hidden: LocalHidden): Promise<void>;
|
|
413
|
+
abort(hidden: LocalHidden): Promise<void>;
|
|
414
|
+
private registration;
|
|
415
|
+
private requireLocationStore;
|
|
416
|
+
private requireSpotManager;
|
|
417
|
+
private requireActorManager;
|
|
418
|
+
}
|
|
419
|
+
type RelocationTerminalDelivery = 'terminalReceived' | 'alreadyTerminal' | 'sourceLeaseExpired';
|
|
283
420
|
export declare function decodeQueuedHandoffPacket(message: ServiceRelocationQueuedMessage): ZLinkActorHandoffPacket;
|
|
284
421
|
export declare function createServiceRelocationId(isInUse: (candidate: string) => boolean, entropy?: (size: number) => Uint8Array): string;
|
|
285
422
|
/**
|
|
@@ -25,6 +25,7 @@ const runtime_values_1 = require("../backend/runtime-values");
|
|
|
25
25
|
const diagnostics_1 = require("../diagnostics");
|
|
26
26
|
const runtime_metrics_1 = require("../diagnostics/runtime-metrics");
|
|
27
27
|
const message_flow_1 = require("../diagnostics/message-flow");
|
|
28
|
+
const flow_context_1 = require("../diagnostics/flow-context");
|
|
28
29
|
const dispatch_error_details_1 = require("../diagnostics/dispatch-error-details");
|
|
29
30
|
const state_lane_1 = require("../execution/state-lane");
|
|
30
31
|
const actor_join_recovery_codec_1 = require("../foundation/actor-join-recovery-codec");
|
|
@@ -1212,7 +1213,7 @@ class ZLinkHostServiceRelocationRuntime {
|
|
|
1212
1213
|
}));
|
|
1213
1214
|
const relocationMetric = spotRegistration.relocation.kind === 'disabled'
|
|
1214
1215
|
? undefined
|
|
1215
|
-
: this.
|
|
1216
|
+
: this.startSourceRelocationMetric(meshName, kind, spotRegistration.relocation.kind);
|
|
1216
1217
|
try {
|
|
1217
1218
|
const waitForRelocationBoundary = activation.waitForRelocationBoundary;
|
|
1218
1219
|
readinessBoundaryConsumed =
|
|
@@ -1288,7 +1289,7 @@ class ZLinkHostServiceRelocationRuntime {
|
|
|
1288
1289
|
};
|
|
1289
1290
|
const relocationMetric = actorPolicy === 'disabled'
|
|
1290
1291
|
? undefined
|
|
1291
|
-
: this.
|
|
1292
|
+
: this.startSourceRelocationMetric(meshName, 'actor', actorPolicy, state.actorId);
|
|
1292
1293
|
try {
|
|
1293
1294
|
if ((0, diagnostics_1.isRelocationDebugEnabled)()) {
|
|
1294
1295
|
(0, diagnostics_1.relocationDebug)('standalone_actor.wait_budget', {
|
|
@@ -1390,7 +1391,7 @@ class ZLinkHostServiceRelocationRuntime {
|
|
|
1390
1391
|
const aggregateId = this.reserveRelocationId();
|
|
1391
1392
|
const relocationMetric = spotRegistration.relocation.kind === 'disabled'
|
|
1392
1393
|
? undefined
|
|
1393
|
-
: this.
|
|
1394
|
+
: this.startSourceRelocationMetric(meshName, 'user_spot', spotRegistration.relocation.kind);
|
|
1394
1395
|
try {
|
|
1395
1396
|
await this.waitForRelocationBudgetHeadroom(String(target.rid), signal);
|
|
1396
1397
|
const captured = await new service_relocation_object_owner_1.ServiceRelocationObjectCaptureOwner().captureUserSpotAggregate(aggregateId, 1n, spotUnit, [], [], signal);
|
|
@@ -1765,6 +1766,41 @@ class ZLinkHostServiceRelocationRuntime {
|
|
|
1765
1766
|
? 'shutdown'
|
|
1766
1767
|
: 'failed');
|
|
1767
1768
|
}
|
|
1769
|
+
startSourceRelocationMetric(meshName, objectKind, policy, actorId) {
|
|
1770
|
+
const flow = objectKind === 'actor' ? this.options.messageFlow?.() : undefined;
|
|
1771
|
+
const flowContext = flow?.flowCreationEnabled() === true ? (0, flow_context_1.currentFlowContext)() : undefined;
|
|
1772
|
+
const traceTerminal = (outcome) => {
|
|
1773
|
+
if (flow === undefined || flowContext === undefined)
|
|
1774
|
+
return;
|
|
1775
|
+
const result = outcome === 'completed' ? 'succeeded' : outcome === 'shutdown' ? 'shutdown' : 'failed';
|
|
1776
|
+
(0, message_flow_1.flowIfEnabled)(flow, ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Completed, result, flowContext.flowId)?.trace({
|
|
1777
|
+
outcome: ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Completed,
|
|
1778
|
+
result,
|
|
1779
|
+
surface: ZLinkDispatchOptions_1.ZLinkDispatchErrorSurface.ActorRelocation,
|
|
1780
|
+
messageKind: ZLinkDispatchOptions_1.ZLinkDispatchMessageKind.Control,
|
|
1781
|
+
meshName,
|
|
1782
|
+
actorId,
|
|
1783
|
+
flowId: flowContext.flowId,
|
|
1784
|
+
flowOrigin: flowContext.flowOrigin,
|
|
1785
|
+
errorMessage: result === 'failed' ? `source_relocation_${outcome}` : undefined
|
|
1786
|
+
});
|
|
1787
|
+
};
|
|
1788
|
+
const metric = this.options.metrics?.startRelocation(meshName, objectKind, policy, traceTerminal);
|
|
1789
|
+
if (metric !== undefined)
|
|
1790
|
+
return metric;
|
|
1791
|
+
if (flow === undefined || flowContext === undefined)
|
|
1792
|
+
return undefined;
|
|
1793
|
+
let completed = false;
|
|
1794
|
+
return {
|
|
1795
|
+
recordBytes: () => { },
|
|
1796
|
+
complete: (outcome) => {
|
|
1797
|
+
if (completed)
|
|
1798
|
+
return;
|
|
1799
|
+
completed = true;
|
|
1800
|
+
traceTerminal(outcome);
|
|
1801
|
+
}
|
|
1802
|
+
};
|
|
1803
|
+
}
|
|
1768
1804
|
/** Streams the payload chunks of one stage under the effective in-flight budgets. */
|
|
1769
1805
|
async sendRelocationStateChunks(meshName, target, identity, encoded, plan, signal) {
|
|
1770
1806
|
for (let ordinal = 0; ordinal < plan.chunkCount; ordinal += 1) {
|
|
@@ -2009,6 +2045,9 @@ class ZLinkHostServiceRelocationRuntime {
|
|
|
2009
2045
|
if (result.kind !== 'stored') {
|
|
2010
2046
|
throw new Error(`Participant '${participant.key}' recovery pointer release failed.`);
|
|
2011
2047
|
}
|
|
2048
|
+
if (participant.objectKind === 'actor') {
|
|
2049
|
+
this.options.observeActorAuthorityVersion?.((0, authority_key_codec_1.decodeAuthorityKey)(key).globalId, result.storeVersion.value);
|
|
2050
|
+
}
|
|
2012
2051
|
}
|
|
2013
2052
|
}
|
|
2014
2053
|
/** Restores the hidden object and its saved-work prefix before Ready. */
|
|
@@ -2304,15 +2343,6 @@ class ZLinkHostServiceRelocationRuntime {
|
|
|
2304
2343
|
hidden.onReplayResult = (packet, result) => this.relayTerminalReply(meshName, stage, coordinator, BigInt(index + 1), packet, result, signal);
|
|
2305
2344
|
}
|
|
2306
2345
|
await stage.owner.normalize(stage.staging, authority, signal);
|
|
2307
|
-
// The target may have visited this Actor before and still retain that
|
|
2308
|
-
// tenure in its private Actor-client resolver. The target-only CAS is
|
|
2309
|
-
// now authoritative, so expire the old projection before OnJoinedActor
|
|
2310
|
-
// can issue an Actor request and deadlock behind source leave.
|
|
2311
|
-
for (const hidden of stage.staging.hidden.values()) {
|
|
2312
|
-
if (hidden.actor !== undefined) {
|
|
2313
|
-
this.options.invalidateActorRoute?.(hidden.actor.context.actorId);
|
|
2314
|
-
}
|
|
2315
|
-
}
|
|
2316
2346
|
await this.finalizeActorJoinProfiles(meshName, stage, signal);
|
|
2317
2347
|
await this.publishSessionRoutes(stage.staging);
|
|
2318
2348
|
stage.phase = 'open';
|
|
@@ -2449,6 +2479,9 @@ class ZLinkHostServiceRelocationRuntime {
|
|
|
2449
2479
|
if (result.kind !== 'stored') {
|
|
2450
2480
|
throw new Error('Relocation target authority normalization CAS failed.');
|
|
2451
2481
|
}
|
|
2482
|
+
if (primary.allocation.objectKind === 'actor') {
|
|
2483
|
+
this.options.observeActorAuthorityVersion?.((0, authority_key_codec_1.decodeAuthorityKey)(stage.staging.primaryAuthorityKey).globalId, result.storeVersion.value);
|
|
2484
|
+
}
|
|
2452
2485
|
return { ...result, kind: 'snapshot' };
|
|
2453
2486
|
}
|
|
2454
2487
|
async handleReplyRelay(meshName, relay, sourceNodeRid, signal) {
|
|
@@ -3406,6 +3439,7 @@ class LocalTargetPort {
|
|
|
3406
3439
|
value: hidden.authorityKey
|
|
3407
3440
|
});
|
|
3408
3441
|
const actorId = hidden.actor.context.actorId;
|
|
3442
|
+
this.options.observeActorAuthorityVersion?.(actorId, current.storeVersion.value);
|
|
3409
3443
|
const node = this.options.meshNode(this.meshName);
|
|
3410
3444
|
const restore = node?.restoreActorAuthority;
|
|
3411
3445
|
if (node === undefined || restore === undefined) {
|
|
@@ -3897,7 +3931,7 @@ function maintenanceReplyRelay(stage, coordinator, participantId, completion, pa
|
|
|
3897
3931
|
const value = completion.result.ok ? completion.result.response : undefined;
|
|
3898
3932
|
const direct = packet.messageFollowOrigin?.requestSource !== undefined;
|
|
3899
3933
|
const application = direct && completion.result.ok
|
|
3900
|
-
? (0, service_wire_m6a_codec_1.
|
|
3934
|
+
? (0, service_wire_m6a_codec_1.decodeApplicationPayload)((0, service_wire_m6a_codec_1.encodeMultipartApplicationPayload)((0, actor_reply_1.encodeActorReply)(Buffer.from(packet.header, 'base64'), protocol_1.ZLinkStreamMessageKind.Response, value, serializers, flowEnabled), service_wire_constants_generated_1.SERVICE_FRAMEWORK_MULTIPART_PACKET_NAME, service_wire_constants_generated_1.SERVICE_FRAMEWORK_MULTIPART_CONTENT_TYPE))
|
|
3901
3935
|
: undefined;
|
|
3902
3936
|
return {
|
|
3903
3937
|
relocation: relocationWireId(stage.staging.envelope.aggregateId),
|
|
@@ -100,35 +100,33 @@ class ZLinkHostSpotAddressTransport {
|
|
|
100
100
|
return this.requests.request(timeoutMs, call.signal, async (requestOperation) => {
|
|
101
101
|
const deadline = createSpotAddressDeadline(requestOperation, call.signal);
|
|
102
102
|
try {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
if (isSpotRouteRefreshError(error)) {
|
|
117
|
-
this.options.resolver()?.invalidate?.(spotId);
|
|
103
|
+
for (;;) {
|
|
104
|
+
deadline.requireRemaining();
|
|
105
|
+
const resolution = await (0, request_deadline_1.waitRequestReply)(this.resolveExisting(spotId, deadline.signal, call), 'Spot address resolve', requestOperation, () => deadline.close());
|
|
106
|
+
const existing = resolution !== undefined && !('kind' in resolution) ? resolution : undefined;
|
|
107
|
+
if (resolution !== undefined && 'kind' in resolution)
|
|
108
|
+
call = this.reactivationCall(resolution, call);
|
|
109
|
+
deadline.requireRemaining();
|
|
110
|
+
try {
|
|
111
|
+
if (existing === undefined) {
|
|
112
|
+
return await this.requestToMissingInstance(spotId, request, call, deadline, resolution);
|
|
113
|
+
}
|
|
114
|
+
this.validateExisting(existing, call);
|
|
115
|
+
return await this.requestToExistingSpot(spotId, request, call, existing, deadline);
|
|
118
116
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
117
|
+
catch (error) {
|
|
118
|
+
if ((existing !== undefined || isPreAdmissionStaleRoute(error)) &&
|
|
119
|
+
isSpotRouteRefreshError(error)) {
|
|
120
|
+
this.options.resolver()?.invalidate?.(spotId);
|
|
121
|
+
}
|
|
122
|
+
// §9 keeps admission-before-stale-route handling in this logical request.
|
|
123
|
+
if (call.instanceSpot && isPreAdmissionStaleRoute(error))
|
|
124
|
+
continue;
|
|
125
|
+
if (existing !== undefined) {
|
|
126
|
+
this.reportInstanceRequestError(spotId, request, error, existing.routerChannelId, existing.targetNodeRid, existing.stableType, addressedInstanceErrorReason(error));
|
|
127
|
+
}
|
|
128
|
+
throw error;
|
|
129
129
|
}
|
|
130
|
-
this.reportInstanceRequestError(spotId, request, error, existing.routerChannelId, existing.targetNodeRid, existing.stableType, addressedInstanceErrorReason(error));
|
|
131
|
-
throw error;
|
|
132
130
|
}
|
|
133
131
|
}
|
|
134
132
|
catch (error) {
|
|
@@ -145,15 +143,25 @@ class ZLinkHostSpotAddressTransport {
|
|
|
145
143
|
}
|
|
146
144
|
async requestToExistingSpot(spotId, request, call, existing, deadline) {
|
|
147
145
|
this.traceInstanceAddress(ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Sent, ZLinkDispatchOptions_1.ZLinkDispatchMessageKind.Request, spotId, request, existing.routerChannelId, existing.stableType, existing.targetNodeRid);
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
146
|
+
// The address request owns the terminal entry. Observe the wire stage so
|
|
147
|
+
// a pre-admission refusal can reach the authority decision in §9.
|
|
148
|
+
const stage = new Promise((resolve, reject) => {
|
|
149
|
+
const result = this.options.routed.requestToSpot(existing, request, {
|
|
150
|
+
instanceSpot: call.instanceSpot,
|
|
151
|
+
timeoutMs: deadline.requireRemaining(),
|
|
152
|
+
deadlineMs: deadline.deadlineMs,
|
|
153
|
+
signal: deadline.signal,
|
|
154
|
+
metadata: call.metadata,
|
|
155
|
+
onAdmitted: call.onAdmitted,
|
|
156
|
+
requestOperation: deadline.operation
|
|
157
|
+
}, {
|
|
158
|
+
operationCompleted: (_id, value) => resolve(value),
|
|
159
|
+
operationFailed: (_id, error) => reject(error)
|
|
160
|
+
});
|
|
161
|
+
if (result.operation === undefined)
|
|
162
|
+
void (0, request_result_1.mapZLinkRequestReply)(result).then(resolve, reject);
|
|
163
|
+
});
|
|
164
|
+
const reply = await (0, request_deadline_1.waitRequestReply)(stage, 'Spot request', deadline.operation);
|
|
157
165
|
this.traceInstanceAddress(ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.ReplyReceived, ZLinkDispatchOptions_1.ZLinkDispatchMessageKind.Request, spotId, request, existing.routerChannelId, existing.stableType, existing.targetNodeRid);
|
|
158
166
|
return reply;
|
|
159
167
|
}
|
|
@@ -367,16 +375,16 @@ function isSpotRouteRefreshError(error) {
|
|
|
367
375
|
if (!(error instanceof contracts_1.ZLinkFrameworkException))
|
|
368
376
|
return false;
|
|
369
377
|
const kind = (0, framework_errors_internal_1.internalFrameworkErrorKind)(error);
|
|
370
|
-
return (
|
|
371
|
-
kind === framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.
|
|
372
|
-
kind === framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.SpotMoving ||
|
|
378
|
+
return (isPreAdmissionStaleRoute(error) ||
|
|
379
|
+
kind === framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.SpotRouteNotFound ||
|
|
373
380
|
kind === framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.RequestTargetNotFound ||
|
|
374
|
-
kind === framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.ActorLocationStale ||
|
|
375
381
|
kind === framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.RouteNotConnected);
|
|
376
382
|
}
|
|
377
|
-
function
|
|
383
|
+
function isPreAdmissionStaleRoute(error) {
|
|
378
384
|
return (error instanceof contracts_1.ZLinkFrameworkException &&
|
|
379
|
-
(0, framework_errors_internal_1.internalFrameworkErrorKind)(error) === framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.SpotMoving
|
|
385
|
+
((0, framework_errors_internal_1.internalFrameworkErrorKind)(error) === framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.SpotMoving ||
|
|
386
|
+
(0, framework_errors_internal_1.internalFrameworkErrorKind)(error) === framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.ActorLocationStale ||
|
|
387
|
+
(0, framework_errors_internal_1.internalFrameworkErrorKind)(error) === framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.SpotGenerationStale));
|
|
380
388
|
}
|
|
381
389
|
function submitResultReason(status) {
|
|
382
390
|
switch (status) {
|
|
@@ -13,7 +13,6 @@ export interface ZLinkAutoConnectLoopOptions {
|
|
|
13
13
|
readonly clearTimer?: (handle: unknown) => void;
|
|
14
14
|
}
|
|
15
15
|
export declare class ZLinkAutoConnectLoop {
|
|
16
|
-
private readonly lane;
|
|
17
16
|
private readonly reconciler;
|
|
18
17
|
private readonly options;
|
|
19
18
|
private readonly meshName;
|