@zlink-systems/framework 0.30.1 → 0.30.2
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/Common/ZLinkEncodedPayload.d.ts +6 -0
- package/dist/contracts/Common/ZLinkEncodedPayload.js +18 -3
- package/dist/contracts/Common/encoded-payload-storage.d.ts +1 -1
- package/dist/contracts/Common/encoded-payload-storage.js +5 -2
- package/dist/contracts/Configuration/Builders.d.ts +1 -1
- package/dist/contracts/Configuration/RegistrationBuilderPolicy.d.ts +2 -1
- package/dist/contracts/Configuration/RegistrationBuilderPolicy.js +5 -1
- package/dist/contracts/Configuration/RegistrationBuilders.js +2 -2
- package/dist/contracts/Configuration/RegistrationTypes.d.ts +1 -0
- package/dist/contracts/Dispatch/ZLinkDispatchOptions.d.ts +2 -2
- package/dist/contracts/Locations/Rows.d.ts +2 -0
- package/dist/contracts/Spots/Contracts.d.ts +4 -0
- package/dist/contracts/Spots/ZLinkSpot.d.ts +3 -3
- package/dist/runtime/abort.d.ts +5 -0
- package/dist/runtime/abort.js +10 -0
- package/dist/runtime/actors/actor-authority-publication.js +3 -2
- package/dist/runtime/actors/actor-client.d.ts +0 -1
- package/dist/runtime/actors/actor-client.js +38 -45
- package/dist/runtime/actors/actor-context.d.ts +2 -0
- package/dist/runtime/actors/actor-context.js +46 -9
- package/dist/runtime/actors/actor-handoff.d.ts +7 -3
- package/dist/runtime/actors/actor-handoff.js +212 -88
- package/dist/runtime/actors/actor-join-relocation.d.ts +2 -0
- package/dist/runtime/actors/actor-local-native-join.js +4 -0
- package/dist/runtime/actors/actor-mailbox.js +27 -1
- package/dist/runtime/actors/actor-remote-joiner.js +3 -1
- package/dist/runtime/actors/actor-reply.d.ts +4 -0
- package/dist/runtime/actors/actor-reply.js +29 -0
- package/dist/runtime/actors/actor-runtime-contracts.d.ts +2 -0
- package/dist/runtime/actors/actor-runtime-state.js +2 -20
- package/dist/runtime/actors/actor-source-transfer.d.ts +1 -17
- package/dist/runtime/actors/index.d.ts +6 -2
- package/dist/runtime/actors/index.js +37 -21
- package/dist/runtime/actors/session-disconnected-wire.d.ts +8 -0
- package/dist/runtime/actors/session-disconnected-wire.js +48 -0
- package/dist/runtime/admission.d.ts +9 -1
- package/dist/runtime/admission.js +55 -32
- package/dist/runtime/application-jobs/application-job-queue-scope.d.ts +13 -0
- package/dist/runtime/application-jobs/application-job-queue-scope.js +27 -1
- package/dist/runtime/application-jobs/contracts.d.ts +2 -0
- package/dist/runtime/backend/contracts/index.d.ts +19 -3
- package/dist/runtime/backend/mesh-actor-session-node-adapter.js +2 -2
- package/dist/runtime/backend/mesh-completion-table.js +5 -0
- package/dist/runtime/backend/mesh-dispatch-pump.d.ts +26 -2
- package/dist/runtime/backend/mesh-dispatch-pump.js +193 -107
- package/dist/runtime/backend/node/node-raw-binding-port.js +90 -58
- package/dist/runtime/backend/node/node-raw-mesh-backend.d.ts +33 -8
- package/dist/runtime/backend/node/node-raw-mesh-backend.js +142 -143
- package/dist/runtime/backend/node/node-socket-backend-adapter.d.ts +1 -1
- package/dist/runtime/backend/node/node-socket-backend-adapter.js +5 -5
- package/dist/runtime/channels/channel-clients.d.ts +1 -0
- package/dist/runtime/channels/channel-clients.js +20 -5
- package/dist/runtime/channels/channel-dispatch-pipeline.d.ts +22 -3
- package/dist/runtime/channels/channel-dispatch-pipeline.js +103 -57
- package/dist/runtime/channels/channel-dispatchers.d.ts +3 -2
- package/dist/runtime/channels/channel-dispatchers.js +44 -37
- package/dist/runtime/channels/channel-envelope.d.ts +1 -0
- package/dist/runtime/channels/channel-envelope.js +74 -31
- package/dist/runtime/channels/channel-runtime-lifecycle.d.ts +4 -3
- package/dist/runtime/channels/channel-runtime-lifecycle.js +19 -24
- package/dist/runtime/channels/channel-runtime-manager.d.ts +3 -2
- package/dist/runtime/channels/channel-runtime-manager.js +4 -4
- package/dist/runtime/channels/channel-transports.d.ts +0 -1
- package/dist/runtime/channels/channel-transports.js +35 -33
- package/dist/runtime/channels/client-server-location-runtime.js +5 -4
- package/dist/runtime/channels/dispatch-error-reporter.d.ts +2 -1
- package/dist/runtime/channels/dispatch-error-reporter.js +2 -1
- package/dist/runtime/channels/fanout-location-runtime.d.ts +1 -1
- package/dist/runtime/channels/fanout-location-runtime.js +3 -3
- package/dist/runtime/diagnostics/flow-context.js +19 -7
- package/dist/runtime/diagnostics/index.js +4 -9
- package/dist/runtime/diagnostics/message-flow.d.ts +8 -0
- package/dist/runtime/diagnostics/message-flow.js +35 -5
- package/dist/runtime/diagnostics/runtime-metrics.d.ts +2 -2
- package/dist/runtime/diagnostics/runtime-metrics.js +10 -8
- package/dist/runtime/execution/index.d.ts +4 -2
- package/dist/runtime/execution/index.js +33 -10
- package/dist/runtime/execution/serial-execution-queue.d.ts +4 -0
- package/dist/runtime/execution/serial-execution-queue.js +21 -2
- package/dist/runtime/execution/state-lane.d.ts +2 -0
- package/dist/runtime/execution/state-lane.js +5 -0
- package/dist/runtime/foundation/operation-registry.d.ts +25 -1
- package/dist/runtime/foundation/operation-registry.js +86 -18
- package/dist/runtime/foundation/raw-service-mesh-runtime.d.ts +39 -3
- package/dist/runtime/foundation/raw-service-mesh-runtime.js +151 -55
- package/dist/runtime/foundation/service-liveness-registry.d.ts +12 -1
- package/dist/runtime/foundation/service-liveness-registry.js +38 -0
- package/dist/runtime/foundation/service-mailbox.d.ts +7 -0
- package/dist/runtime/foundation/service-maintenance-runtime.js +1 -6
- package/dist/runtime/foundation/service-relocation-object-owner.d.ts +2 -3
- package/dist/runtime/foundation/service-relocation-object-owner.js +48 -35
- package/dist/runtime/foundation/service-relocation-runtime.js +7 -3
- package/dist/runtime/foundation/service-runtime-contracts.d.ts +8 -1
- package/dist/runtime/foundation/service-session-binding-ingress-port.d.ts +2 -1
- package/dist/runtime/foundation/service-stateful-registry.d.ts +5 -4
- package/dist/runtime/foundation/service-stateful-registry.js +24 -26
- package/dist/runtime/foundation/service-stateful-runtime.d.ts +72 -6
- package/dist/runtime/foundation/service-stateful-runtime.js +444 -117
- package/dist/runtime/foundation/service-stateful-wire-codec.d.ts +14 -1
- package/dist/runtime/foundation/service-stateful-wire-codec.js +48 -27
- package/dist/runtime/foundation/service-wire-binary-primitives.d.ts +6 -1
- package/dist/runtime/foundation/service-wire-binary-primitives.js +27 -11
- package/dist/runtime/foundation/service-wire-constants.generated.d.ts +1 -0
- package/dist/runtime/foundation/service-wire-constants.generated.js +1 -0
- package/dist/runtime/foundation/service-wire-m6a-codec.d.ts +10 -0
- package/dist/runtime/foundation/service-wire-m6a-codec.js +166 -53
- package/dist/runtime/host/actor-packet-relay.d.ts +6 -4
- package/dist/runtime/host/actor-packet-relay.js +59 -72
- package/dist/runtime/host/actor-placement-coordinator.js +25 -8
- package/dist/runtime/host/actor-transfer-runtime.d.ts +7 -31
- package/dist/runtime/host/actor-transfer-runtime.js +85 -331
- package/dist/runtime/host/application-job-queue.d.ts +24 -3
- package/dist/runtime/host/application-job-queue.js +28 -41
- package/dist/runtime/host/index.d.ts +5 -1
- package/dist/runtime/host/index.js +171 -97
- package/dist/runtime/host/location-runtime-owner.js +2 -6
- package/dist/runtime/host/mesh-router-resolver.d.ts +4 -0
- package/dist/runtime/host/mesh-router-resolver.js +14 -6
- package/dist/runtime/host/remote-bound-session-relay.d.ts +2 -4
- package/dist/runtime/host/remote-bound-session-relay.js +71 -190
- package/dist/runtime/host/route-mesh-runtime.d.ts +2 -2
- package/dist/runtime/host/route-mesh-runtime.js +5 -3
- package/dist/runtime/host/runtime-shutdown.d.ts +1 -0
- package/dist/runtime/host/runtime-shutdown.js +3 -2
- package/dist/runtime/host/service-relocation-host-runtime.d.ts +17 -7
- package/dist/runtime/host/service-relocation-host-runtime.js +550 -367
- package/dist/runtime/host/spot-runtime-options-factory.js +15 -7
- package/dist/runtime/host/user-spot-creation-coordinator.js +33 -84
- package/dist/runtime/locations/auto-connect-loop.d.ts +2 -0
- package/dist/runtime/locations/auto-connect-loop.js +22 -14
- package/dist/runtime/locations/auto-connect-reconciler.js +0 -6
- package/dist/runtime/locations/auto-connect-types.d.ts +0 -1
- package/dist/runtime/locations/descriptor-publication.d.ts +4 -0
- package/dist/runtime/locations/descriptor-publication.js +11 -0
- package/dist/runtime/locations/domain-store-contract.d.ts +1 -0
- package/dist/runtime/locations/in-memory-authority-store.d.ts +7 -1
- package/dist/runtime/locations/in-memory-authority-store.js +56 -19
- package/dist/runtime/locations/in-memory-location-store.js +1 -10
- package/dist/runtime/locations/index.d.ts +1 -0
- package/dist/runtime/locations/index.js +1 -0
- package/dist/runtime/locations/lease-tracker.js +1 -6
- package/dist/runtime/locations/location-store-repository.d.ts +51 -1
- package/dist/runtime/locations/location-store-repository.js +363 -139
- package/dist/runtime/locations/relocation-blob.d.ts +18 -1
- package/dist/runtime/locations/relocation-blob.js +52 -1
- package/dist/runtime/locations/request-source-resolver.d.ts +37 -0
- package/dist/runtime/locations/request-source-resolver.js +80 -0
- package/dist/runtime/locations/resolvers.js +1 -1
- package/dist/runtime/locations/runtime.d.ts +6 -2
- package/dist/runtime/locations/runtime.js +37 -30
- package/dist/runtime/messaging/payload-codec.d.ts +7 -1
- package/dist/runtime/messaging/payload-codec.js +7 -6
- package/dist/runtime/messaging/request-result.js +29 -26
- package/dist/runtime/protocol/service_wire_codec.generated.d.ts +19 -1
- package/dist/runtime/protocol/service_wire_codec.generated.js +85 -0
- package/dist/runtime/protocol/service_wire_pilot_codec.generated.d.ts +7 -1
- package/dist/runtime/protocol/service_wire_pilot_codec.generated.js +23 -7
- package/dist/runtime/spots/formal-remote-actor-admission-registry.js +3 -2
- package/dist/runtime/spots/index.d.ts +18 -11
- package/dist/runtime/spots/index.js +234 -176
- package/dist/runtime/spots/spot-activation-registry.d.ts +4 -2
- package/dist/runtime/spots/spot-activation-registry.js +21 -11
- package/dist/runtime/spots/spot-activation-state.d.ts +1 -1
- package/dist/runtime/spots/spot-activation-state.js +7 -7
- package/dist/runtime/spots/spot-activation.d.ts +6 -3
- package/dist/runtime/spots/spot-activation.js +123 -44
- package/dist/runtime/spots/spot-actor-admission-coordinator.d.ts +1 -0
- package/dist/runtime/spots/spot-actor-admission-coordinator.js +13 -22
- package/dist/runtime/spots/spot-actor-membership.d.ts +0 -1
- package/dist/runtime/spots/spot-actor-membership.js +0 -8
- package/dist/runtime/spots/spot-actor-packet-dispatch.js +33 -8
- package/dist/runtime/spots/spot-actor-packet-drain.js +5 -33
- package/dist/runtime/spots/spot-entry-activation.d.ts +2 -0
- package/dist/runtime/spots/spot-entry-activation.js +14 -9
- package/dist/runtime/spots/spot-handler-registry.d.ts +4 -3
- package/dist/runtime/spots/spot-handler-registry.js +6 -2
- package/dist/runtime/spots/spot-manager-internal-contracts.d.ts +2 -2
- package/dist/runtime/spots/spot-manager-public.js +2 -2
- package/dist/runtime/spots/spot-node-autoconnect.d.ts +2 -1
- package/dist/runtime/spots/spot-node-autoconnect.js +18 -39
- package/dist/runtime/spots/spot-node-runtime-manager.d.ts +19 -2
- package/dist/runtime/spots/spot-node-runtime-manager.js +115 -50
- package/dist/runtime/spots/spot-outbound.js +3 -3
- package/dist/runtime/spots/spot-remote-codec.js +5 -1
- package/dist/runtime/spots/spot-runtime-ports.d.ts +0 -1
- package/dist/runtime/spots/spot-serial-executor.d.ts +10 -0
- package/dist/runtime/spots/spot-serial-executor.js +61 -8
- package/dist/runtime/spots/spot-serial-turn-executor.js +19 -2
- package/dist/runtime/spots/spot-subscription-dispatch.js +1 -1
- package/dist/runtime/spots/spot-timer.d.ts +57 -5
- package/dist/runtime/spots/spot-timer.js +287 -103
- package/dist/runtime/streams/actor-session-binding-registry.d.ts +42 -11
- package/dist/runtime/streams/actor-session-binding-registry.js +165 -48
- package/dist/runtime/streams/actor-session-binding-runtime-owner.d.ts +8 -4
- package/dist/runtime/streams/bound-actor-relay-sender.d.ts +2 -1
- package/dist/runtime/streams/bound-actor-relay-sender.js +15 -8
- package/dist/runtime/streams/bound-session-service.d.ts +1 -1
- package/dist/runtime/streams/bound-session-service.js +6 -11
- package/dist/runtime/streams/index.d.ts +3 -2
- package/dist/runtime/streams/index.js +6 -4
- package/dist/runtime/streams/managed-stream.js +3 -2
- package/dist/runtime/streams/native-fallback-bound-session.js +8 -73
- package/dist/runtime/streams/session-actor-coordinator.d.ts +2 -8
- package/dist/runtime/streams/session-actor-coordinator.js +15 -32
- package/dist/runtime/streams/stream-binding-runtime-ports.d.ts +3 -10
- package/dist/runtime/streams/stream-session-runtime.js +1 -4
- package/dist/runtime/workers/index.js +1 -1
- package/package.json +3 -3
- package/src/contracts/Common/ZLinkEncodedPayload.ts +24 -4
- package/src/contracts/Common/encoded-payload-storage.ts +6 -3
- package/src/contracts/Configuration/Builders.ts +4 -1
- package/src/contracts/Configuration/RegistrationBuilderPolicy.ts +7 -2
- package/src/contracts/Configuration/RegistrationBuilders.ts +6 -2
- package/src/contracts/Configuration/RegistrationTypes.ts +1 -0
- package/src/contracts/Dispatch/ZLinkDispatchOptions.ts +2 -1
- package/src/contracts/Locations/Rows.ts +2 -0
- package/src/contracts/Spots/Contracts.ts +8 -0
- package/src/contracts/Spots/ZLinkSpot.ts +3 -3
- package/src/runtime/abort.ts +12 -0
- package/src/runtime/actors/actor-authority-publication.ts +3 -2
- package/src/runtime/actors/actor-client.ts +61 -70
- package/src/runtime/actors/actor-context.ts +49 -9
- package/src/runtime/actors/actor-handoff.ts +282 -106
- package/src/runtime/actors/actor-join-relocation.ts +2 -0
- package/src/runtime/actors/actor-local-native-join.ts +4 -0
- package/src/runtime/actors/actor-mailbox.ts +40 -2
- package/src/runtime/actors/actor-remote-joiner.ts +6 -1
- package/src/runtime/actors/actor-reply.ts +42 -0
- package/src/runtime/actors/actor-runtime-contracts.ts +2 -0
- package/src/runtime/actors/actor-runtime-state.ts +2 -20
- package/src/runtime/actors/actor-source-transfer.ts +1 -34
- package/src/runtime/actors/index.ts +41 -27
- package/src/runtime/actors/session-disconnected-wire.ts +66 -0
- package/src/runtime/admission.ts +69 -34
- package/src/runtime/application-jobs/application-job-queue-scope.ts +33 -1
- package/src/runtime/application-jobs/contracts.ts +2 -0
- package/src/runtime/backend/contracts/index.ts +39 -4
- package/src/runtime/backend/mesh-actor-session-node-adapter.ts +5 -3
- package/src/runtime/backend/mesh-completion-table.ts +4 -0
- package/src/runtime/backend/mesh-dispatch-pump.ts +223 -124
- package/src/runtime/backend/node/node-raw-binding-port.ts +106 -70
- package/src/runtime/backend/node/node-raw-mesh-backend.ts +221 -170
- package/src/runtime/backend/node/node-socket-backend-adapter.ts +5 -5
- package/src/runtime/channels/channel-clients.ts +49 -24
- package/src/runtime/channels/channel-dispatch-pipeline.ts +173 -124
- package/src/runtime/channels/channel-dispatchers.ts +116 -72
- package/src/runtime/channels/channel-envelope.ts +105 -36
- package/src/runtime/channels/channel-runtime-lifecycle.ts +13 -13
- package/src/runtime/channels/channel-runtime-manager.ts +12 -5
- package/src/runtime/channels/channel-transports.ts +49 -58
- package/src/runtime/channels/client-server-location-runtime.ts +11 -10
- package/src/runtime/channels/dispatch-error-reporter.ts +4 -2
- package/src/runtime/channels/fanout-location-runtime.ts +17 -9
- package/src/runtime/diagnostics/flow-context.ts +20 -7
- package/src/runtime/diagnostics/index.ts +1 -7
- package/src/runtime/diagnostics/message-flow.ts +47 -9
- package/src/runtime/diagnostics/runtime-metrics.ts +12 -10
- package/src/runtime/execution/index.ts +40 -14
- package/src/runtime/execution/serial-execution-queue.ts +31 -4
- package/src/runtime/execution/state-lane.ts +7 -0
- package/src/runtime/foundation/operation-registry.ts +98 -20
- package/src/runtime/foundation/raw-service-mesh-runtime.ts +244 -67
- package/src/runtime/foundation/service-liveness-registry.ts +39 -0
- package/src/runtime/foundation/service-mailbox.ts +8 -0
- package/src/runtime/foundation/service-maintenance-runtime.ts +1 -8
- package/src/runtime/foundation/service-relocation-object-owner.ts +54 -37
- package/src/runtime/foundation/service-relocation-runtime.ts +7 -3
- package/src/runtime/foundation/service-runtime-contracts.ts +12 -1
- package/src/runtime/foundation/service-session-binding-ingress-port.ts +2 -1
- package/src/runtime/foundation/service-stateful-registry.ts +38 -35
- package/src/runtime/foundation/service-stateful-runtime.ts +667 -152
- package/src/runtime/foundation/service-stateful-wire-codec.ts +49 -11
- package/src/runtime/foundation/service-wire-binary-primitives.ts +35 -12
- package/src/runtime/foundation/service-wire-constants.generated.ts +1 -0
- package/src/runtime/foundation/service-wire-m6a-codec.ts +187 -51
- package/src/runtime/host/actor-packet-relay.ts +113 -94
- package/src/runtime/host/actor-placement-coordinator.ts +31 -8
- package/src/runtime/host/actor-transfer-runtime.ts +104 -430
- package/src/runtime/host/application-job-queue.ts +29 -44
- package/src/runtime/host/index.ts +286 -129
- package/src/runtime/host/location-runtime-owner.ts +2 -6
- package/src/runtime/host/mesh-router-resolver.ts +13 -5
- package/src/runtime/host/remote-bound-session-relay.ts +86 -248
- package/src/runtime/host/route-mesh-runtime.ts +11 -5
- package/src/runtime/host/runtime-shutdown.ts +15 -4
- package/src/runtime/host/service-relocation-host-runtime.ts +784 -475
- package/src/runtime/host/spot-runtime-options-factory.ts +18 -7
- package/src/runtime/host/user-spot-creation-coordinator.ts +41 -100
- package/src/runtime/locations/auto-connect-loop.ts +22 -14
- package/src/runtime/locations/auto-connect-reconciler.ts +0 -6
- package/src/runtime/locations/auto-connect-types.ts +0 -1
- package/src/runtime/locations/descriptor-publication.ts +7 -0
- package/src/runtime/locations/domain-store-contract.ts +5 -0
- package/src/runtime/locations/in-memory-authority-store.ts +85 -23
- package/src/runtime/locations/in-memory-location-store.ts +1 -12
- package/src/runtime/locations/index.ts +1 -0
- package/src/runtime/locations/lease-tracker.ts +2 -9
- package/src/runtime/locations/location-store-repository.ts +628 -152
- package/src/runtime/locations/relocation-blob.ts +75 -1
- package/src/runtime/locations/request-source-resolver.ts +138 -0
- package/src/runtime/locations/resolvers.ts +2 -2
- package/src/runtime/locations/runtime.ts +70 -40
- package/src/runtime/messaging/payload-codec.ts +8 -11
- package/src/runtime/messaging/request-result.ts +33 -29
- package/src/runtime/protocol/service_wire_codec.generated.ts +87 -4
- package/src/runtime/protocol/service_wire_pilot_codec.generated.ts +13 -10
- package/src/runtime/spots/formal-remote-actor-admission-registry.ts +3 -2
- package/src/runtime/spots/index.ts +375 -281
- package/src/runtime/spots/spot-activation-registry.ts +25 -13
- package/src/runtime/spots/spot-activation-state.ts +12 -19
- package/src/runtime/spots/spot-activation.ts +170 -86
- package/src/runtime/spots/spot-actor-admission-coordinator.ts +25 -55
- package/src/runtime/spots/spot-actor-membership.ts +0 -15
- package/src/runtime/spots/spot-actor-packet-dispatch.ts +56 -11
- package/src/runtime/spots/spot-actor-packet-drain.ts +9 -52
- package/src/runtime/spots/spot-entry-activation.ts +24 -19
- package/src/runtime/spots/spot-handler-registry.ts +15 -4
- package/src/runtime/spots/spot-manager-internal-contracts.ts +2 -2
- package/src/runtime/spots/spot-manager-public.ts +2 -2
- package/src/runtime/spots/spot-node-autoconnect.ts +22 -45
- package/src/runtime/spots/spot-node-runtime-manager.ts +197 -67
- package/src/runtime/spots/spot-outbound.ts +3 -3
- package/src/runtime/spots/spot-remote-codec.ts +9 -2
- package/src/runtime/spots/spot-runtime-ports.ts +0 -1
- package/src/runtime/spots/spot-serial-executor.ts +97 -25
- package/src/runtime/spots/spot-serial-turn-executor.ts +22 -3
- package/src/runtime/spots/spot-subscription-dispatch.ts +1 -1
- package/src/runtime/spots/spot-timer.ts +413 -157
- package/src/runtime/streams/actor-session-binding-registry.ts +236 -64
- package/src/runtime/streams/actor-session-binding-runtime-owner.ts +16 -8
- package/src/runtime/streams/bound-actor-relay-sender.ts +23 -9
- package/src/runtime/streams/bound-session-service.ts +7 -10
- package/src/runtime/streams/index.ts +12 -6
- package/src/runtime/streams/managed-stream.ts +4 -2
- package/src/runtime/streams/native-fallback-bound-session.ts +14 -103
- package/src/runtime/streams/session-actor-coordinator.ts +39 -88
- package/src/runtime/streams/stream-binding-runtime-ports.ts +3 -9
- package/src/runtime/streams/stream-session-runtime.ts +1 -5
- package/src/runtime/workers/index.ts +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ZLinkSpotRuntimeOptionsFactory = void 0;
|
|
4
|
+
const routing_id_1 = require("../routing-id");
|
|
4
5
|
const contracts_1 = require("../../contracts");
|
|
5
6
|
const actors_1 = require("../actors");
|
|
6
7
|
const channels_1 = require("../channels");
|
|
@@ -39,6 +40,13 @@ class ZLinkSpotRuntimeOptionsFactory {
|
|
|
39
40
|
}
|
|
40
41
|
await runtime.dispatchEntryActorJoin(meshName, actor, handoffBacklog);
|
|
41
42
|
},
|
|
43
|
+
admitEntryActorPacketPrefix: (meshName, actorId, records) => {
|
|
44
|
+
const runtime = this.options.spotNodeRuntime();
|
|
45
|
+
if (runtime === undefined) {
|
|
46
|
+
throw new configuration_1.ZLinkConfigurationException('Entry Actor replay requires the MeshNode runtime.');
|
|
47
|
+
}
|
|
48
|
+
return runtime.admitEntryActorPacketPrefix(meshName, actorId, records);
|
|
49
|
+
},
|
|
42
50
|
executeEntryActor: (meshName, actorId, operation) => {
|
|
43
51
|
const runtime = this.options.spotNodeRuntime();
|
|
44
52
|
if (runtime === undefined) {
|
|
@@ -135,8 +143,9 @@ class ZLinkSpotRuntimeOptionsFactory {
|
|
|
135
143
|
nativeSpotNodeProvider: (meshName) => this.options.spotNodeRuntime()?.meshNode(meshName),
|
|
136
144
|
spotRouteResolver: this.options.createLocationSpotRouteResolver(),
|
|
137
145
|
actorResolver: (actorId) => {
|
|
138
|
-
const
|
|
139
|
-
|
|
146
|
+
const manager = this.options.actorManager();
|
|
147
|
+
const state = manager?.getState(actorId);
|
|
148
|
+
return state?.isMoving === true ? undefined : manager?.resolveLocalActor(actorId);
|
|
140
149
|
},
|
|
141
150
|
canonicalActorJoinResolver: (fence) => this.options.boundSessionRelay.actorJoins.prepareCanonicalActorJoin({
|
|
142
151
|
actorId: fence.actorId,
|
|
@@ -152,13 +161,12 @@ class ZLinkSpotRuntimeOptionsFactory {
|
|
|
152
161
|
const actorRef = state?.nativeActorRef === undefined
|
|
153
162
|
? undefined
|
|
154
163
|
: (0, actors_1.toFrameworkActorRef)(state.nativeActorRef, state.meshName ?? '');
|
|
155
|
-
const localNodeRid = this.
|
|
164
|
+
const localNodeRid = state?.meshName === undefined ? undefined : this.meshNodeRoutingId(state.meshName);
|
|
156
165
|
if (state?.actor === undefined ||
|
|
157
|
-
state.spot === undefined ||
|
|
158
166
|
state.remoteActorPacketTarget !== undefined ||
|
|
159
167
|
actorRef === undefined ||
|
|
160
168
|
localNodeRid === undefined ||
|
|
161
|
-
|
|
169
|
+
!(0, routing_id_1.routingIdsEqual)(actorRef.nodeRid, localNodeRid)) {
|
|
162
170
|
return {};
|
|
163
171
|
}
|
|
164
172
|
return {
|
|
@@ -193,11 +201,11 @@ class ZLinkSpotRuntimeOptionsFactory {
|
|
|
193
201
|
}
|
|
194
202
|
primaryNodeRoutingId() {
|
|
195
203
|
const node = this.primaryNode();
|
|
196
|
-
return node === undefined ? undefined :
|
|
204
|
+
return node === undefined ? undefined : node.status().routingId;
|
|
197
205
|
}
|
|
198
206
|
meshNodeRoutingId(meshName) {
|
|
199
207
|
const node = this.options.spotNodeRuntime()?.meshNode(meshName);
|
|
200
|
-
return node === undefined ? undefined :
|
|
208
|
+
return node === undefined ? undefined : node.status().routingId;
|
|
201
209
|
}
|
|
202
210
|
}
|
|
203
211
|
exports.ZLinkSpotRuntimeOptionsFactory = ZLinkSpotRuntimeOptionsFactory;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ZLinkUserSpotCreationCoordinator = void 0;
|
|
4
4
|
exports.encodeLocationCreationContent = encodeLocationCreationContent;
|
|
5
5
|
exports.decodeLocationCreationContent = decodeLocationCreationContent;
|
|
6
|
+
const routing_id_1 = require("../routing-id");
|
|
6
7
|
const node_crypto_1 = require("node:crypto");
|
|
7
8
|
const contracts_1 = require("../../contracts");
|
|
8
9
|
const service_authority_payload_codec_1 = require("../foundation/service-authority-payload-codec");
|
|
@@ -32,7 +33,6 @@ class ZLinkUserSpotCreationCoordinator {
|
|
|
32
33
|
const contentReference = encodeLocationCreationContent(request.requestPayload);
|
|
33
34
|
const excludedNodeRids = new Set();
|
|
34
35
|
let target;
|
|
35
|
-
let authorityTarget;
|
|
36
36
|
let reserved;
|
|
37
37
|
for (;;) {
|
|
38
38
|
try {
|
|
@@ -48,12 +48,12 @@ class ZLinkUserSpotCreationCoordinator {
|
|
|
48
48
|
deadline.close();
|
|
49
49
|
throw (0, framework_errors_internal_1.createInternalFrameworkException)(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.PlacementCapacityExhausted, 'No eligible User Spot placement target is ready.', true);
|
|
50
50
|
}
|
|
51
|
-
if (excludedNodeRids.has(
|
|
51
|
+
if (excludedNodeRids.has((0, routing_id_1.encodeRoutingIdStorageHex)(target.nodeRid))) {
|
|
52
52
|
deadline.close();
|
|
53
53
|
throw (0, framework_errors_internal_1.createInternalFrameworkException)(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.PlacementCapacityExhausted, 'No additional User Spot placement target is ready.', true);
|
|
54
54
|
}
|
|
55
55
|
const owner = target.owner;
|
|
56
|
-
authorityTarget = {
|
|
56
|
+
const authorityTarget = {
|
|
57
57
|
meshName: target.meshName,
|
|
58
58
|
nodeRid: target.nodeRid,
|
|
59
59
|
nodeLifecycleGeneration: target.nodeGeneration,
|
|
@@ -97,84 +97,31 @@ class ZLinkUserSpotCreationCoordinator {
|
|
|
97
97
|
throw error;
|
|
98
98
|
throw (0, framework_errors_internal_1.createInternalFrameworkException)(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.RequestFailed, 'User Spot reservation Store operation failed.', false, error);
|
|
99
99
|
}
|
|
100
|
-
if (reserved.kind
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
(reserved.kind === 'conflict' &&
|
|
106
|
-
reserved.current.kind === 'snapshot' &&
|
|
107
|
-
reserved.current.allocation.objectKind === 'user_spot' &&
|
|
108
|
-
reserved.current.allocation.stableType === request.stableType)) {
|
|
109
|
-
const current = reserved.kind === 'alreadyExists' ? reserved.current : reserved.current;
|
|
110
|
-
if (current.kind === 'snapshot' && current.allocation.state === 'active') {
|
|
100
|
+
if (reserved.kind === 'alreadyExists' ||
|
|
101
|
+
(reserved.kind === 'conflict' &&
|
|
102
|
+
reserved.current.kind === 'snapshot' &&
|
|
103
|
+
reserved.current.allocation.objectKind === 'user_spot' &&
|
|
104
|
+
reserved.current.allocation.stableType === request.stableType)) {
|
|
111
105
|
if (request.generatedIdentity === true) {
|
|
112
106
|
deadline.close();
|
|
113
107
|
throw spotIdConflict(request.spotId);
|
|
114
108
|
}
|
|
115
|
-
const spot = spotRef(current, request);
|
|
116
|
-
deadline.close();
|
|
117
|
-
return {
|
|
118
|
-
result: { spot, state: contracts_1.ZLinkSpotCreateState.Existing },
|
|
119
|
-
spot
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
if (current.kind !== 'snapshot' || !sameCreationTarget(current, authorityTarget)) {
|
|
123
|
-
deadline.close();
|
|
124
|
-
if (request.generatedIdentity === true) {
|
|
125
|
-
throw spotIdConflict(request.spotId);
|
|
126
|
-
}
|
|
127
|
-
throw (0, framework_errors_internal_1.createInternalFrameworkException)(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.RequestFailed, 'User Spot creation requires a remote generation-fenced create operation.');
|
|
128
|
-
}
|
|
129
|
-
if (current.allocation.state === 'reserved' && !target.isLocal) {
|
|
130
109
|
try {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
finally {
|
|
134
|
-
deadline.close();
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
if (current.allocation.state === 'reserved' && target.isLocal) {
|
|
138
|
-
const pending = current.pendingCreation;
|
|
139
|
-
const admitted = pending === undefined ? undefined : this.localCreations.get(pending.reservationId);
|
|
140
|
-
if (admitted === undefined) {
|
|
141
|
-
try {
|
|
142
|
-
const spot = await this.awaitReady(request, signal);
|
|
143
|
-
return {
|
|
144
|
-
result: { spot, state: contracts_1.ZLinkSpotCreateState.Existing },
|
|
145
|
-
spot
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
finally {
|
|
110
|
+
const spot = await this.awaitReady(request, signal);
|
|
111
|
+
if (spot !== undefined) {
|
|
149
112
|
deadline.close();
|
|
113
|
+
return { result: { spot, state: contracts_1.ZLinkSpotCreateState.Existing }, spot };
|
|
150
114
|
}
|
|
151
115
|
}
|
|
152
|
-
|
|
153
|
-
const result = await admitted;
|
|
154
|
-
return result.result.state === contracts_1.ZLinkSpotCreateState.Created
|
|
155
|
-
? {
|
|
156
|
-
result: {
|
|
157
|
-
...result.result,
|
|
158
|
-
state: contracts_1.ZLinkSpotCreateState.Existing
|
|
159
|
-
},
|
|
160
|
-
spot: result.spot
|
|
161
|
-
}
|
|
162
|
-
: result;
|
|
163
|
-
}
|
|
164
|
-
finally {
|
|
116
|
+
catch (error) {
|
|
165
117
|
deadline.close();
|
|
118
|
+
throw error;
|
|
166
119
|
}
|
|
120
|
+
continue;
|
|
167
121
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
result: { spot, state: contracts_1.ZLinkSpotCreateState.Existing },
|
|
172
|
-
spot
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
finally {
|
|
176
|
-
deadline.close();
|
|
177
|
-
}
|
|
122
|
+
if (reserved.kind !== 'placementCapacityExhausted')
|
|
123
|
+
break;
|
|
124
|
+
excludedNodeRids.add((0, routing_id_1.encodeRoutingIdStorageHex)(target.nodeRid));
|
|
178
125
|
}
|
|
179
126
|
if (reserved.kind === 'typeMismatch') {
|
|
180
127
|
deadline.close();
|
|
@@ -272,7 +219,7 @@ class ZLinkUserSpotCreationCoordinator {
|
|
|
272
219
|
current.allocation.stableType === record.stableType &&
|
|
273
220
|
current.objectGeneration === record.reservation.objectGeneration &&
|
|
274
221
|
current.authorityOwnerGeneration === record.reservation.authorityOwnerGeneration &&
|
|
275
|
-
|
|
222
|
+
(0, routing_id_1.routingIdsEqual)(current.allocation.descriptor.rid, record.reservation.targetNodeRid) &&
|
|
276
223
|
current.allocation.descriptorLifecycleGeneration ===
|
|
277
224
|
record.reservation.targetNodeGeneration &&
|
|
278
225
|
current.ownerId === record.reservation.targetOwnerId &&
|
|
@@ -313,7 +260,7 @@ class ZLinkUserSpotCreationCoordinator {
|
|
|
313
260
|
try {
|
|
314
261
|
local = await materialize(requestPayload, current, signal ?? new AbortController().signal);
|
|
315
262
|
if (local.state === contracts_1.ZLinkSpotCreateState.Rejected) {
|
|
316
|
-
local.publication?.abort();
|
|
263
|
+
await local.publication?.abort();
|
|
317
264
|
await this.options.store.abort({
|
|
318
265
|
key: { kind: 'user_spot', globalId: record.spotId },
|
|
319
266
|
reservationId: pending.reservationId,
|
|
@@ -372,14 +319,16 @@ class ZLinkUserSpotCreationCoordinator {
|
|
|
372
319
|
objectGeneration: committed.ready.objectGeneration
|
|
373
320
|
};
|
|
374
321
|
this.options.publishReadyRoute?.(committed.ready.allocation.descriptor.meshName, readySpotRoute(record.spotId, committed.ready));
|
|
375
|
-
local.publication?.publish();
|
|
322
|
+
await local.publication?.publish();
|
|
376
323
|
return {
|
|
377
324
|
result: { spot: readySpot, state: local.state, reply: local.reply },
|
|
378
325
|
spot: readySpot
|
|
379
326
|
};
|
|
380
327
|
}
|
|
381
328
|
catch (error) {
|
|
382
|
-
|
|
329
|
+
const publicationCleanup = await Promise.allSettled([
|
|
330
|
+
Promise.resolve().then(() => local?.publication?.abort())
|
|
331
|
+
]);
|
|
383
332
|
const cleanupDeadline = createDeadline(this.options.cleanupTimeoutMs ?? DEFAULT_USER_SPOT_CLEANUP_TIMEOUT_MS);
|
|
384
333
|
const cleanupSignal = cleanupDeadline.signal;
|
|
385
334
|
const cleanup = await Promise.allSettled([
|
|
@@ -400,7 +349,7 @@ class ZLinkUserSpotCreationCoordinator {
|
|
|
400
349
|
waitForAbort(discard?.(cleanupSignal) ?? Promise.resolve(), cleanupSignal)
|
|
401
350
|
]);
|
|
402
351
|
cleanupDeadline.close();
|
|
403
|
-
const cleanupErrors = cleanup
|
|
352
|
+
const cleanupErrors = [...publicationCleanup, ...cleanup]
|
|
404
353
|
.filter((item) => item.status === 'rejected')
|
|
405
354
|
.map((item) => item.reason);
|
|
406
355
|
if (cleanupErrors.length > 0) {
|
|
@@ -475,7 +424,14 @@ class ZLinkUserSpotCreationCoordinator {
|
|
|
475
424
|
for (;;) {
|
|
476
425
|
signal.throwIfAborted();
|
|
477
426
|
const current = await this.options.store.readAuthority(key, signal);
|
|
478
|
-
if (current.kind === '
|
|
427
|
+
if (current.kind === 'missing')
|
|
428
|
+
return undefined;
|
|
429
|
+
if (current.allocation.objectKind !== 'user_spot' ||
|
|
430
|
+
current.allocation.stableType !== request.stableType) {
|
|
431
|
+
throw (0, framework_errors_internal_1.createInternalFrameworkException)(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.SpotTypeMismatch, `User Spot '${String(request.spotId)}' has another stable type.`);
|
|
432
|
+
}
|
|
433
|
+
if (current.allocation.state === 'active' &&
|
|
434
|
+
(0, service_authority_payload_codec_1.decodeServiceClosingSpotAuthority)(current.payload) === undefined) {
|
|
479
435
|
return spotRef(current, request);
|
|
480
436
|
}
|
|
481
437
|
await wait(this.options.pollIntervalMs ?? DEFAULT_USER_SPOT_POLL_INTERVAL_MS, signal);
|
|
@@ -574,7 +530,7 @@ function requireCloseTarget(current, spotId, fence) {
|
|
|
574
530
|
decoded.ownerLeaseGeneration !== current.ownerLeaseGeneration ||
|
|
575
531
|
allocation.objectKind !== 'user_spot' ||
|
|
576
532
|
allocation.state !== 'active' ||
|
|
577
|
-
|
|
533
|
+
!(0, routing_id_1.routingIdsEqual)(allocation.descriptor.rid, fence.nodeRid) ||
|
|
578
534
|
(fence.meshName !== undefined && allocation.descriptor.meshName !== fence.meshName) ||
|
|
579
535
|
(fence.nodeGeneration !== undefined &&
|
|
580
536
|
allocation.descriptorLifecycleGeneration !== fence.nodeGeneration) ||
|
|
@@ -662,13 +618,6 @@ function decodeLocationCreationContent(reference, expectedSha256, expectedEncode
|
|
|
662
618
|
}
|
|
663
619
|
return payload;
|
|
664
620
|
}
|
|
665
|
-
function sameCreationTarget(snapshot, target) {
|
|
666
|
-
return (snapshot.allocation.descriptor.meshName === target.meshName &&
|
|
667
|
-
String(snapshot.allocation.descriptor.rid) === String(target.nodeRid) &&
|
|
668
|
-
snapshot.allocation.descriptorLifecycleGeneration === target.nodeLifecycleGeneration &&
|
|
669
|
-
snapshot.ownerId === target.owner.ownerId &&
|
|
670
|
-
snapshot.ownerLeaseGeneration === target.owner.leaseGeneration);
|
|
671
|
-
}
|
|
672
621
|
function remoteCreationFingerprint(record) {
|
|
673
622
|
return JSON.stringify({
|
|
674
623
|
spotId: record.spotId,
|
|
@@ -28,10 +28,12 @@ export declare class ZLinkAutoConnectLoop {
|
|
|
28
28
|
private lastTickFailed;
|
|
29
29
|
constructor(options: ZLinkAutoConnectLoopOptions);
|
|
30
30
|
start(signal?: AbortSignal): Promise<void>;
|
|
31
|
+
requestPeerReconcile(meshName: string, _peerRid: string): Promise<void>;
|
|
31
32
|
stop(signal?: AbortSignal): Promise<void>;
|
|
32
33
|
prepareTransportShutdown(): Promise<void>;
|
|
33
34
|
finishTransportShutdown(signal?: AbortSignal): Promise<void>;
|
|
34
35
|
tick(signal?: AbortSignal): Promise<void>;
|
|
36
|
+
private tickCore;
|
|
35
37
|
private runReconcile;
|
|
36
38
|
private scheduleNext;
|
|
37
39
|
}
|
|
@@ -40,6 +40,16 @@ class ZLinkAutoConnectLoop {
|
|
|
40
40
|
return;
|
|
41
41
|
this.scheduleNext();
|
|
42
42
|
}
|
|
43
|
+
async requestPeerReconcile(meshName, _peerRid) {
|
|
44
|
+
const controller = this.controller;
|
|
45
|
+
if (meshName !== this.meshName || controller === undefined)
|
|
46
|
+
return;
|
|
47
|
+
// A fresh descriptor scan uses the same RID ordering and connection owner as a periodic tick.
|
|
48
|
+
await this.lane.run(async () => {
|
|
49
|
+
if (!controller.signal.aborted)
|
|
50
|
+
await this.runReconcile(controller.signal);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
43
53
|
async stop(signal) {
|
|
44
54
|
await this.prepareTransportShutdown();
|
|
45
55
|
await this.finishTransportShutdown(signal);
|
|
@@ -60,7 +70,10 @@ class ZLinkAutoConnectLoop {
|
|
|
60
70
|
await this.reconciler.unpublishLocal(signal);
|
|
61
71
|
}
|
|
62
72
|
async tick(signal) {
|
|
63
|
-
|
|
73
|
+
await this.lane.run(() => this.tickCore(signal));
|
|
74
|
+
}
|
|
75
|
+
async tickCore(signal) {
|
|
76
|
+
const lastTickFailed = this.lastTickFailed;
|
|
64
77
|
if (this.changeStampStore?.getMeshNodeChangeStamp !== undefined && !lastTickFailed) {
|
|
65
78
|
try {
|
|
66
79
|
const stamp = await this.changeStampStore.getMeshNodeChangeStamp(this.meshName, signal);
|
|
@@ -73,11 +86,10 @@ class ZLinkAutoConnectLoop {
|
|
|
73
86
|
return;
|
|
74
87
|
}
|
|
75
88
|
const tickFailed = await this.runReconcile(signal);
|
|
76
|
-
if (!tickFailed)
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
});
|
|
89
|
+
if (!tickFailed) {
|
|
90
|
+
this.lastStamp = stamp;
|
|
91
|
+
this.lastLiveOwnerSetVersion = liveOwners;
|
|
92
|
+
}
|
|
81
93
|
return;
|
|
82
94
|
}
|
|
83
95
|
catch {
|
|
@@ -85,17 +97,13 @@ class ZLinkAutoConnectLoop {
|
|
|
85
97
|
}
|
|
86
98
|
}
|
|
87
99
|
await this.runReconcile(signal);
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
this.lastLiveOwnerSetVersion = undefined;
|
|
91
|
-
});
|
|
100
|
+
this.lastStamp = undefined;
|
|
101
|
+
this.lastLiveOwnerSetVersion = undefined;
|
|
92
102
|
}
|
|
93
103
|
async runReconcile(signal) {
|
|
94
104
|
await this.reconciler.tick(signal);
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return this.lastTickFailed;
|
|
98
|
-
});
|
|
105
|
+
this.lastTickFailed = this.reconciler.storeFailed;
|
|
106
|
+
return this.lastTickFailed;
|
|
99
107
|
}
|
|
100
108
|
scheduleNext() {
|
|
101
109
|
if (this.controller === undefined || this.controller.signal.aborted) {
|
|
@@ -148,17 +148,12 @@ class ZLinkAutoConnectReconciler {
|
|
|
148
148
|
desired.set(key, target);
|
|
149
149
|
}
|
|
150
150
|
const deferringMissingTargets = this.monotonicNowMs() < (await this.lane.run(() => this.recoveryDeferUntilMs));
|
|
151
|
-
let staleCandidates = candidates;
|
|
152
151
|
if (deferringMissingTargets) {
|
|
153
|
-
const retainedCandidates = new Map(candidates);
|
|
154
152
|
const lastDesired = await this.lane.run(() => [...this.lastDesired]);
|
|
155
153
|
for (const [key, target] of lastDesired) {
|
|
156
154
|
if (!desired.has(key))
|
|
157
155
|
desired.set(key, target);
|
|
158
|
-
if (!retainedCandidates.has(key))
|
|
159
|
-
retainedCandidates.set(key, target);
|
|
160
156
|
}
|
|
161
|
-
staleCandidates = retainedCandidates;
|
|
162
157
|
}
|
|
163
158
|
await this.lane.run(() => {
|
|
164
159
|
this.lastDesired = new Map(desired);
|
|
@@ -219,7 +214,6 @@ class ZLinkAutoConnectReconciler {
|
|
|
219
214
|
});
|
|
220
215
|
}
|
|
221
216
|
}
|
|
222
|
-
this.executor.disconnectStalePeers?.([...staleCandidates.values()]);
|
|
223
217
|
const activeTargets = await this.lane.run(() => [...this.active]);
|
|
224
218
|
for (const [key, target] of activeTargets) {
|
|
225
219
|
if (!desired.has(key)) {
|
|
@@ -22,7 +22,6 @@ export interface ZLinkAutoConnectTarget {
|
|
|
22
22
|
export interface IZLinkAutoConnectExecutor {
|
|
23
23
|
connect(target: ZLinkAutoConnectTarget): Promise<boolean>;
|
|
24
24
|
disconnect(target: ZLinkAutoConnectTarget): void;
|
|
25
|
-
disconnectStalePeers?(targets: readonly ZLinkAutoConnectTarget[]): void;
|
|
26
25
|
isDisconnected?(target: ZLinkAutoConnectTarget): boolean;
|
|
27
26
|
onDisconnected?(handler: (endpoint: string) => void): void;
|
|
28
27
|
replaceNotRequired?(targets: readonly ZLinkAutoConnectTarget[]): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZLinkDescriptorPublicationUnconfirmedError = void 0;
|
|
4
|
+
/** A descriptor Store write failed without a confirmed result (Location runtime section 5). */
|
|
5
|
+
class ZLinkDescriptorPublicationUnconfirmedError extends Error {
|
|
6
|
+
constructor(cause) {
|
|
7
|
+
super(cause instanceof Error ? cause.message : String(cause), { cause });
|
|
8
|
+
this.name = 'ZLinkDescriptorPublicationUnconfirmedError';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.ZLinkDescriptorPublicationUnconfirmedError = ZLinkDescriptorPublicationUnconfirmedError;
|
|
@@ -6,6 +6,7 @@ import type { ZLinkObjectReserveRequest, ZLinkEndedOwnerReleaseIntent } from './
|
|
|
6
6
|
* implement this interface; the framework maps it to the opaque Store SPI.
|
|
7
7
|
*/
|
|
8
8
|
export interface ZLinkDomainLocationStore {
|
|
9
|
+
confirmedCapacity?(key: ZLinkMeshNodeDescriptorKey, limits: ZLinkMeshNodeDescriptor['populationCapacity']): ZLinkMeshNodeDescriptor['populationCapacity'] | undefined;
|
|
9
10
|
updateMeshNode(descriptor: ZLinkMeshNodeDescriptor, intent: ZLinkLocationWriteIntent, signal?: AbortSignal): Promise<ZLinkLocationWriteResult>;
|
|
10
11
|
removeMeshNode(key: ZLinkMeshNodeDescriptorKey, owner: ZLinkLocationOwnerToken, signal?: AbortSignal): Promise<ZLinkLocationWriteStatus>;
|
|
11
12
|
listMeshNodes(meshName: string, page?: ZLinkPageRequest, signal?: AbortSignal): Promise<ZLinkLocationPage<ZLinkMeshNodeDescriptor>>;
|
|
@@ -4,7 +4,6 @@ export interface ZLinkInMemoryAuthorityValidation {
|
|
|
4
4
|
isTargetLive(descriptor: ZLinkMeshNodeDescriptorKey, lifecycleGeneration: bigint, owner: ZLinkLocationOwnerToken): boolean;
|
|
5
5
|
placementCapacityAvailable?(descriptor: ZLinkMeshNodeDescriptorKey, requested: ZLinkCapacityVector, currentReserved: ZLinkCapacityVector, currentActive: ZLinkCapacityVector): boolean;
|
|
6
6
|
identityClaimed?(authorityKey: string): boolean;
|
|
7
|
-
hasSpotMembers?(spotId: string, objectGeneration: bigint): boolean;
|
|
8
7
|
}
|
|
9
8
|
/**
|
|
10
9
|
* In-memory reference provider for the provider-owned authority state machine.
|
|
@@ -31,6 +30,13 @@ export declare class ZLinkInMemoryAuthorityStore {
|
|
|
31
30
|
releaseEndedReservation(key: ZLinkAuthorityKey, expectedStoreVersion: string, signal?: AbortSignal, request?: ZLinkEndedOwnerReleaseIntent): Promise<boolean>;
|
|
32
31
|
acceptsUserSpotMembership(spotId: string, objectGeneration: bigint): boolean;
|
|
33
32
|
private tryReleaseEndedReservation;
|
|
33
|
+
/**
|
|
34
|
+
* Every Actor membership of the old User Spot incarnation must belong to an ended-owner
|
|
35
|
+
* member (location runtime §6.1): a steady Ready, activated authority outside any aggregate
|
|
36
|
+
* with an invalid owner lease. The release must fit one provider batch; its key set mirrors
|
|
37
|
+
* the provider repository batch (authorities, owner leases, descriptor and capacity records).
|
|
38
|
+
*/
|
|
39
|
+
private endedSpotMembers;
|
|
34
40
|
reserve(request: ZLinkObjectReserveRequest, signal?: AbortSignal): Promise<ZLinkObjectReserveResult>;
|
|
35
41
|
commit(request: ZLinkObjectCommitRequest, signal?: AbortSignal): Promise<ZLinkObjectCommitResult>;
|
|
36
42
|
completeCreation(request: ZLinkObjectCreationCompleteRequest, signal?: AbortSignal): Promise<ZLinkObjectCreationCompleteResult>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ZLinkInMemoryAuthorityStore = void 0;
|
|
4
|
+
const routing_id_1 = require("../routing-id");
|
|
4
5
|
const InternalDefaults_1 = require("../../contracts/Configuration/InternalDefaults");
|
|
5
6
|
const stream_wire_1 = require("@zlink-systems/stream-wire");
|
|
6
7
|
const CoreTypes_1 = require("../../contracts/Common/CoreTypes");
|
|
@@ -210,6 +211,7 @@ class ZLinkInMemoryAuthorityStore {
|
|
|
210
211
|
? request === undefined
|
|
211
212
|
: current.creation === undefined))
|
|
212
213
|
return false;
|
|
214
|
+
let members = [];
|
|
213
215
|
if (current.snapshot.allocation.state === 'active') {
|
|
214
216
|
let unavailable = false;
|
|
215
217
|
for (const aggregate of this.aggregates.values()) {
|
|
@@ -233,20 +235,10 @@ class ZLinkInMemoryAuthorityStore {
|
|
|
233
235
|
spot.stableType !== request.intent.stableType ||
|
|
234
236
|
spot.spotId !== request.key.globalId ||
|
|
235
237
|
spot.activationRecovery !== undefined;
|
|
236
|
-
if (spot?.kind === 'user_spot'
|
|
237
|
-
unavailable
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
for (const row of this.rows.values()) {
|
|
241
|
-
if (row.snapshot.allocation.objectKind !== 'actor')
|
|
242
|
-
continue;
|
|
243
|
-
const actor = (0, actor_authority_payload_codec_1.decodeActorAuthorityPayload)((0, service_relocation_runtime_1.serviceRelocationAuthorityApplicationPayload)(row.snapshot.payload));
|
|
244
|
-
unavailable ||=
|
|
245
|
-
actor?.currentSpotKind === contracts_2.ZLinkSpotKind.User &&
|
|
246
|
-
actor.currentSpotId === spot.spotId &&
|
|
247
|
-
actor.currentSpotGeneration === current.snapshot.objectGeneration;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
238
|
+
if (spot?.kind === 'user_spot' &&
|
|
239
|
+
!unavailable &&
|
|
240
|
+
request?.actorRelocationPolicy === 'disabled')
|
|
241
|
+
members = this.endedSpotMembers(key.value, current.snapshot, spot.spotId);
|
|
250
242
|
}
|
|
251
243
|
if (unavailable || request?.actorRelocationPolicy !== 'disabled')
|
|
252
244
|
throw new contracts_1.ZLinkFrameworkException(contracts_1.ZLinkFrameworkErrorKind.Unavailable, 'Object owner lease is unavailable.');
|
|
@@ -258,11 +250,59 @@ class ZLinkInMemoryAuthorityStore {
|
|
|
258
250
|
return false;
|
|
259
251
|
this.adjustCapacity(current.snapshot.allocation.state === 'active' ? this.activeCapacity : this.pendingCapacity, current.snapshot.allocation, -1);
|
|
260
252
|
this.rows.delete(key.value);
|
|
253
|
+
for (const memberKey of members) {
|
|
254
|
+
const member = this.rows.get(memberKey);
|
|
255
|
+
this.adjustCapacity(this.activeCapacity, member.snapshot.allocation, -1);
|
|
256
|
+
this.rows.delete(memberKey);
|
|
257
|
+
}
|
|
261
258
|
if (current.snapshot.allocation.state === 'reserved' && current.creation !== undefined)
|
|
262
259
|
this.creationTerminals.set(current.creation.reservationId, 'aborted');
|
|
263
260
|
this.scanRevision++;
|
|
264
261
|
return true;
|
|
265
262
|
}
|
|
263
|
+
/**
|
|
264
|
+
* Every Actor membership of the old User Spot incarnation must belong to an ended-owner
|
|
265
|
+
* member (location runtime §6.1): a steady Ready, activated authority outside any aggregate
|
|
266
|
+
* with an invalid owner lease. The release must fit one provider batch; its key set mirrors
|
|
267
|
+
* the provider repository batch (authorities, owner leases, descriptor and capacity records).
|
|
268
|
+
*/
|
|
269
|
+
endedSpotMembers(spotKey, spot, spotId) {
|
|
270
|
+
const descriptorKey = (descriptor) => `${descriptor.meshName}\0${String(descriptor.rid)}`;
|
|
271
|
+
const batchKeys = new Set([
|
|
272
|
+
`authority:${spotKey}`,
|
|
273
|
+
`owner:${spot.ownerId}`,
|
|
274
|
+
`descriptor:${descriptorKey(spot.allocation.descriptor)}`,
|
|
275
|
+
`capacity:${descriptorKey(spot.allocation.descriptor)}`
|
|
276
|
+
]);
|
|
277
|
+
const members = [];
|
|
278
|
+
for (const [memberKey, row] of this.rows) {
|
|
279
|
+
if (row.snapshot.allocation.objectKind !== 'actor')
|
|
280
|
+
continue;
|
|
281
|
+
const actor = (0, actor_authority_payload_codec_1.decodeActorAuthorityPayload)((0, service_relocation_runtime_1.serviceRelocationAuthorityApplicationPayload)(row.snapshot.payload));
|
|
282
|
+
if (actor?.currentSpotKind !== contracts_2.ZLinkSpotKind.User ||
|
|
283
|
+
actor.currentSpotId !== spotId ||
|
|
284
|
+
actor.currentSpotGeneration !== spot.objectGeneration)
|
|
285
|
+
continue;
|
|
286
|
+
if (row.snapshot.allocation.state !== 'active' ||
|
|
287
|
+
[...this.aggregates.values()].some((aggregate) => aggregate.state === 'prepared' &&
|
|
288
|
+
aggregate.request.participants.some((participant) => participant.authorityKey.value === memberKey)) ||
|
|
289
|
+
relocationAuthorityCodec.read(row.snapshot.payload) !== undefined ||
|
|
290
|
+
(0, actor_authority_payload_codec_1.decodeActorAuthorityPayload)(row.snapshot.payload)?.state !== 'ready')
|
|
291
|
+
throw new contracts_1.ZLinkFrameworkException(contracts_1.ZLinkFrameworkErrorKind.Unavailable, 'User Spot still has a relocating or unactivated member.');
|
|
292
|
+
if (this.validation.isOwnerLive({
|
|
293
|
+
ownerId: row.snapshot.ownerId,
|
|
294
|
+
leaseGeneration: row.snapshot.ownerLeaseGeneration
|
|
295
|
+
}))
|
|
296
|
+
throw new contracts_1.ZLinkFrameworkException(contracts_1.ZLinkFrameworkErrorKind.Unavailable, 'User Spot still has a member with a live owner lease.');
|
|
297
|
+
members.push(memberKey);
|
|
298
|
+
batchKeys.add(`authority:${memberKey}`);
|
|
299
|
+
batchKeys.add(`owner:${row.snapshot.ownerId}`);
|
|
300
|
+
batchKeys.add(`capacity:${descriptorKey(row.snapshot.allocation.descriptor)}`);
|
|
301
|
+
}
|
|
302
|
+
if (batchKeys.size > Stores_1.ZLINK_PROVIDER_MAX_WRITE_KEYS)
|
|
303
|
+
throw new contracts_1.ZLinkFrameworkException(contracts_1.ZLinkFrameworkErrorKind.Unavailable, 'User Spot member release exceeds one Location Store batch.');
|
|
304
|
+
return members;
|
|
305
|
+
}
|
|
266
306
|
async reserve(request, signal) {
|
|
267
307
|
signal?.throwIfAborted();
|
|
268
308
|
validateReserve(request);
|
|
@@ -882,7 +922,7 @@ function creationTarget(request) {
|
|
|
882
922
|
}
|
|
883
923
|
function sameCreationTarget(target, actual) {
|
|
884
924
|
return (target.descriptor.meshName === actual.meshName &&
|
|
885
|
-
|
|
925
|
+
(0, routing_id_1.routingIdsEqual)(target.descriptor.rid, actual.nodeRid) &&
|
|
886
926
|
target.lifecycleGeneration === actual.nodeLifecycleGeneration &&
|
|
887
927
|
sameOwner(target.owner, actual.owner));
|
|
888
928
|
}
|
|
@@ -890,10 +930,7 @@ function sameOwner(left, right) {
|
|
|
890
930
|
return left.ownerId === right.ownerId && left.leaseGeneration === right.leaseGeneration;
|
|
891
931
|
}
|
|
892
932
|
function sameDescriptor(left, right) {
|
|
893
|
-
return left.meshName === right.meshName &&
|
|
894
|
-
}
|
|
895
|
-
function sameRid(left, right) {
|
|
896
|
-
return String(left) === String(right);
|
|
933
|
+
return left.meshName === right.meshName && (0, routing_id_1.routingIdsEqual)(left.rid, right.rid);
|
|
897
934
|
}
|
|
898
935
|
function capacityEntries(descriptor, lifecycle, capacity) {
|
|
899
936
|
return [
|
|
@@ -63,16 +63,7 @@ class ZLinkInMemoryLocationStore {
|
|
|
63
63
|
spotType.count <=
|
|
64
64
|
typeCapacity.limit))));
|
|
65
65
|
},
|
|
66
|
-
identityClaimed: (authorityKey) => this.entrySpotClaims.has(authorityKey)
|
|
67
|
-
hasSpotMembers: (spotId, objectGeneration) => {
|
|
68
|
-
for (const actor of this.actors.rows.values()) {
|
|
69
|
-
if (actor.spotKind === contracts_1.ZLinkSpotKind.User &&
|
|
70
|
-
String(actor.spotId) === spotId &&
|
|
71
|
-
actor.spotGeneration === objectGeneration)
|
|
72
|
-
return true;
|
|
73
|
-
}
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
66
|
+
identityClaimed: (authorityKey) => this.entrySpotClaims.has(authorityKey)
|
|
76
67
|
}, now);
|
|
77
68
|
}
|
|
78
69
|
async readAuthority(key, signal) {
|
|
@@ -6,6 +6,7 @@ export * from './in-memory-provider-location-store';
|
|
|
6
6
|
export * from './location-store-repository';
|
|
7
7
|
export * from './in-memory-authority-store';
|
|
8
8
|
export * from './lease-tracker';
|
|
9
|
+
export * from './request-source-resolver';
|
|
9
10
|
export * from './lifecycle';
|
|
10
11
|
export * from './resolvers';
|
|
11
12
|
export * from './runtime';
|
|
@@ -22,6 +22,7 @@ __exportStar(require("./in-memory-provider-location-store"), exports);
|
|
|
22
22
|
__exportStar(require("./location-store-repository"), exports);
|
|
23
23
|
__exportStar(require("./in-memory-authority-store"), exports);
|
|
24
24
|
__exportStar(require("./lease-tracker"), exports);
|
|
25
|
+
__exportStar(require("./request-source-resolver"), exports);
|
|
25
26
|
__exportStar(require("./lifecycle"), exports);
|
|
26
27
|
__exportStar(require("./resolvers"), exports);
|
|
27
28
|
__exportStar(require("./runtime"), exports);
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ZLinkLiveRowFilter = exports.ZLinkOwnerLeaseTracker = void 0;
|
|
4
4
|
const Options_1 = require("../../contracts/Locations/Options");
|
|
5
|
-
const node_async_hooks_1 = require("node:async_hooks");
|
|
6
5
|
const state_lane_1 = require("../execution/state-lane");
|
|
7
|
-
const detachedLeaseRefreshResource = new node_async_hooks_1.AsyncResource('zlink:owner-lease-tracker');
|
|
8
6
|
class ZLinkOwnerLeaseTracker {
|
|
9
7
|
lane = new state_lane_1.ZLinkStateLane();
|
|
10
8
|
store;
|
|
@@ -65,7 +63,7 @@ class ZLinkOwnerLeaseTracker {
|
|
|
65
63
|
if (prepared.snapshot !== undefined)
|
|
66
64
|
return prepared.snapshot;
|
|
67
65
|
if (prepared.start) {
|
|
68
|
-
void
|
|
66
|
+
void (0, state_lane_1.startOutsideStateLane)(() => this.refreshSnapshot(ownerId, signal, prepared.refresh));
|
|
69
67
|
}
|
|
70
68
|
return await prepared.refresh.promise;
|
|
71
69
|
}
|
|
@@ -148,6 +146,3 @@ class ZLinkLiveRowFilter {
|
|
|
148
146
|
}
|
|
149
147
|
}
|
|
150
148
|
exports.ZLinkLiveRowFilter = ZLinkLiveRowFilter;
|
|
151
|
-
function runDetachedLeaseRefresh(work) {
|
|
152
|
-
return detachedLeaseRefreshResource.runInAsyncScope(work);
|
|
153
|
-
}
|