@zlink-systems/framework 0.29.1 → 0.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +150 -68
- package/dist/.tsbuildinfo +1 -1
- package/dist/contracts/Actors/ZLinkActorClient.d.ts +2 -1
- package/dist/contracts/Channels/Calls.d.ts +2 -1
- package/dist/contracts/Common/ZLinkMessageMetadata.js +11 -5
- package/dist/contracts/Configuration/Builders.d.ts +1 -2
- package/dist/contracts/Configuration/Configs.d.ts +0 -5
- package/dist/contracts/Configuration/RegistrationBuilders.js +6 -4
- package/dist/contracts/Configuration/RegistrationTypes.d.ts +1 -6
- package/dist/contracts/Configuration/RegistrationValidators.js +4 -4
- package/dist/contracts/Configuration/index.d.ts +1 -1
- package/dist/contracts/Handlers/Attributes.d.ts +5 -13
- package/dist/contracts/Handlers/Attributes.js +7 -11
- package/dist/contracts/Handlers/JsonContract.d.ts +2 -46
- package/dist/contracts/Handlers/JsonContract.js +4 -153
- package/dist/contracts/Spots/Contracts.d.ts +2 -1
- package/dist/internal.d.ts +1 -0
- package/dist/internal.js +3 -1
- package/dist/nest-integration.d.ts +1 -1
- package/dist/nest-integration.js +2 -1
- package/dist/runtime/actors/actor-client.d.ts +1 -1
- package/dist/runtime/actors/actor-client.js +14 -12
- package/dist/runtime/actors/actor-handoff.d.ts +3 -2
- package/dist/runtime/actors/actor-handoff.js +15 -7
- package/dist/runtime/actors/actor-join-relocation.d.ts +1 -0
- package/dist/runtime/actors/actor-local-native-join.js +9 -12
- package/dist/runtime/actors/actor-remote-wire.js +15 -0
- package/dist/runtime/actors/actor-routed-join-transport.d.ts +6 -2
- package/dist/runtime/actors/actor-routed-json-request.d.ts +2 -0
- package/dist/runtime/actors/index.d.ts +2 -1
- package/dist/runtime/actors/index.js +18 -6
- package/dist/runtime/actors/spot-actor-dispatch.js +2 -2
- package/dist/runtime/admission.d.ts +1 -1
- package/dist/runtime/admission.js +15 -5
- package/dist/runtime/application-jobs/application-ingress-record-owner.d.ts +9 -9
- package/dist/runtime/application-jobs/application-ingress-record-owner.js +45 -23
- package/dist/runtime/application-jobs/application-job-queue-scope.d.ts +5 -2
- package/dist/runtime/application-jobs/application-job-queue-scope.js +41 -21
- package/dist/runtime/application-jobs/contracts.d.ts +15 -2
- package/dist/runtime/backend/contracts/index.d.ts +27 -27
- package/dist/runtime/backend/mesh-completion-table.d.ts +15 -5
- package/dist/runtime/backend/mesh-completion-table.js +160 -50
- package/dist/runtime/backend/mesh-dispatch-pump.d.ts +3 -0
- package/dist/runtime/backend/mesh-dispatch-pump.js +53 -36
- package/dist/runtime/backend/node/node-backend-adapter-factory.js +6 -1
- package/dist/runtime/backend/node/node-backend-adapter-support.d.ts +3 -3
- package/dist/runtime/backend/node/node-backend-adapter-support.js +33 -31
- package/dist/runtime/backend/node/node-dealer-channel-client-transport.d.ts +1 -1
- package/dist/runtime/backend/node/node-dealer-channel-client-transport.js +5 -2
- package/dist/runtime/backend/node/node-mesh-backend-adapter.d.ts +1 -9
- package/dist/runtime/backend/node/node-mesh-backend-adapter.js +1 -1
- package/dist/runtime/backend/node/node-raw-binding-port.js +50 -25
- package/dist/runtime/backend/node/node-raw-mesh-backend.d.ts +22 -16
- package/dist/runtime/backend/node/node-raw-mesh-backend.js +133 -149
- package/dist/runtime/backend/node/node-socket-backend-adapter.js +15 -10
- package/dist/runtime/backend/raw-binding-port.d.ts +10 -3
- package/dist/runtime/backend/runtime-message.d.ts +1 -0
- package/dist/runtime/backend/runtime-message.js +5 -0
- package/dist/runtime/backend/runtime-values.d.ts +1 -0
- package/dist/runtime/backend/runtime-values.js +2 -1
- package/dist/runtime/channels/channel-clients.d.ts +1 -0
- package/dist/runtime/channels/channel-clients.js +58 -21
- package/dist/runtime/channels/channel-dispatch-pipeline.d.ts +3 -2
- package/dist/runtime/channels/channel-dispatch-pipeline.js +20 -11
- package/dist/runtime/channels/channel-dispatch-services.d.ts +1 -0
- package/dist/runtime/channels/channel-dispatch-services.js +45 -0
- package/dist/runtime/channels/channel-dispatchers.d.ts +1 -1
- package/dist/runtime/channels/channel-dispatchers.js +27 -26
- package/dist/runtime/channels/channel-envelope-inspection.d.ts +1 -2
- package/dist/runtime/channels/channel-envelope-inspection.js +1 -16
- package/dist/runtime/channels/channel-envelope.d.ts +1 -0
- package/dist/runtime/channels/channel-envelope.js +83 -8
- package/dist/runtime/channels/channel-outbound-operations.d.ts +2 -2
- package/dist/runtime/channels/channel-outbound-operations.js +8 -8
- package/dist/runtime/channels/channel-receive-loops.js +3 -3
- package/dist/runtime/channels/channel-runtime-lifecycle.js +2 -1
- package/dist/runtime/channels/channel-runtime-manager.d.ts +6 -6
- package/dist/runtime/channels/channel-runtime-manager.js +12 -12
- package/dist/runtime/channels/channel-socket-registry.d.ts +10 -3
- package/dist/runtime/channels/channel-socket-registry.js +59 -82
- package/dist/runtime/channels/channel-transports.d.ts +18 -15
- package/dist/runtime/channels/channel-transports.js +48 -31
- package/dist/runtime/channels/local-spot-route-transport.d.ts +1 -1
- package/dist/runtime/channels/local-spot-route-transport.js +2 -1
- package/dist/runtime/channels/router-socket-spot-route-transport.d.ts +2 -2
- package/dist/runtime/channels/router-socket-spot-route-transport.js +4 -4
- package/dist/runtime/channels/source-spot-router.d.ts +2 -2
- package/dist/runtime/channels/source-spot-router.js +4 -4
- package/dist/runtime/channels/spot-node-route-transport.d.ts +2 -2
- package/dist/runtime/channels/spot-node-route-transport.js +4 -4
- package/dist/runtime/channels/spot-route-bridge-transport.d.ts +2 -2
- package/dist/runtime/channels/spot-route-bridge-transport.js +4 -4
- package/dist/runtime/channels/spot-route-dispatch-strategy.d.ts +5 -4
- package/dist/runtime/channels/spot-route-dispatch-strategy.js +18 -18
- package/dist/runtime/diagnostics/message-flow.d.ts +1 -0
- package/dist/runtime/diagnostics/message-flow.js +3 -3
- package/dist/runtime/execution/serial-execution-queue.d.ts +1 -0
- package/dist/runtime/execution/serial-execution-queue.js +1 -0
- package/dist/runtime/foundation/actor-join-recovery-codec.js +2 -2
- package/dist/runtime/foundation/durable-service-request.d.ts +14 -0
- package/dist/runtime/foundation/durable-service-request.js +98 -0
- package/dist/runtime/foundation/operation-identity.d.ts +1 -0
- package/dist/runtime/foundation/operation-identity.js +5 -1
- package/dist/runtime/foundation/raw-service-mesh-runtime.d.ts +37 -6
- package/dist/runtime/foundation/raw-service-mesh-runtime.js +473 -220
- package/dist/runtime/foundation/service-liveness-registry.d.ts +20 -8
- package/dist/runtime/foundation/service-liveness-registry.js +57 -44
- package/dist/runtime/foundation/service-mailbox.d.ts +3 -0
- package/dist/runtime/foundation/service-mailbox.js +2 -1
- package/dist/runtime/foundation/service-relocation-object-owner.d.ts +1 -0
- package/dist/runtime/foundation/service-relocation-object-owner.js +1 -0
- package/dist/runtime/foundation/service-relocation-runtime.d.ts +2 -0
- package/dist/runtime/foundation/service-relocation-runtime.js +13 -1
- package/dist/runtime/foundation/service-runtime-contracts.d.ts +2 -0
- package/dist/runtime/foundation/service-stateful-runtime.d.ts +10 -9
- package/dist/runtime/foundation/service-stateful-runtime.js +78 -126
- package/dist/runtime/foundation/service-stateful-wire-codec.d.ts +5 -7
- package/dist/runtime/foundation/service-stateful-wire-codec.js +43 -61
- package/dist/runtime/foundation/service-topology-registry.d.ts +16 -4
- package/dist/runtime/foundation/service-topology-registry.js +69 -30
- package/dist/runtime/foundation/service-wire-m6a-codec.d.ts +3 -3
- package/dist/runtime/foundation/service-wire-m6a-codec.js +36 -38
- package/dist/runtime/handlers/handler-instance-scope.d.ts +8 -0
- package/dist/runtime/handlers/handler-instance-scope.js +54 -11
- package/dist/runtime/host/actor-packet-relay.js +7 -7
- package/dist/runtime/host/actor-runtime-options-factory.js +2 -2
- package/dist/runtime/host/application-job-queue.d.ts +28 -9
- package/dist/runtime/host/application-job-queue.js +214 -50
- package/dist/runtime/host/entry-actor-runtime.d.ts +1 -0
- package/dist/runtime/host/entry-actor-runtime.js +4 -1
- package/dist/runtime/host/index.d.ts +7 -1
- package/dist/runtime/host/index.js +154 -126
- package/dist/runtime/host/instance-activation-authority.d.ts +2 -1
- package/dist/runtime/host/instance-activation-authority.js +89 -25
- package/dist/runtime/host/remote-bound-session-relay.js +2 -18
- package/dist/runtime/host/route-mesh-runtime.js +1 -1
- package/dist/runtime/host/service-relocation-control.d.ts +1 -0
- package/dist/runtime/host/service-relocation-control.js +10 -4
- package/dist/runtime/host/service-relocation-host-runtime.d.ts +6 -8
- package/dist/runtime/host/service-relocation-host-runtime.js +215 -243
- package/dist/runtime/host/spot-address-transport.d.ts +1 -0
- package/dist/runtime/host/spot-address-transport.js +28 -14
- package/dist/runtime/host/spot-runtime-options-factory.js +3 -2
- package/dist/runtime/host/user-spot-creation-coordinator.d.ts +1 -0
- package/dist/runtime/host/user-spot-creation-coordinator.js +1 -0
- package/dist/runtime/locations/actor-location-claims.d.ts +2 -2
- package/dist/runtime/locations/actor-location-claims.js +34 -19
- package/dist/runtime/locations/domain-store-contract.d.ts +2 -2
- package/dist/runtime/locations/in-memory-authority-store.d.ts +4 -2
- package/dist/runtime/locations/in-memory-authority-store.js +80 -8
- package/dist/runtime/locations/in-memory-location-store.d.ts +2 -2
- package/dist/runtime/locations/in-memory-location-store.js +19 -3
- package/dist/runtime/locations/internal-location-contracts.d.ts +3 -0
- package/dist/runtime/locations/lifecycle.d.ts +1 -2
- package/dist/runtime/locations/lifecycle.js +2 -5
- package/dist/runtime/locations/location-store-repository.d.ts +3 -2
- package/dist/runtime/locations/location-store-repository.js +165 -22
- package/dist/runtime/locations/resolvers.d.ts +2 -1
- package/dist/runtime/locations/resolvers.js +10 -1
- package/dist/runtime/locations/runtime.d.ts +1 -1
- package/dist/runtime/locations/runtime.js +24 -23
- package/dist/runtime/messaging/framework-json-v1.d.ts +4 -6
- package/dist/runtime/messaging/framework-json-v1.js +38 -294
- package/dist/runtime/messaging/packet-name.d.ts +1 -1
- package/dist/runtime/messaging/packet-name.js +8 -24
- package/dist/runtime/messaging/request-result.d.ts +2 -0
- package/dist/runtime/messaging/request-result.js +54 -0
- package/dist/runtime/messaging/submission-result.d.ts +2 -1
- package/dist/runtime/messaging/submission-result.js +7 -4
- package/dist/runtime/protocol/service_wire_codec.generated.d.ts +15 -0
- package/dist/runtime/protocol/service_wire_codec.generated.js +144 -0
- package/dist/runtime/protocol/service_wire_pilot_codec.generated.d.ts +9 -0
- package/dist/runtime/protocol/service_wire_pilot_codec.generated.js +14 -1
- package/dist/runtime/spots/formal-remote-actor-admission-registry.d.ts +9 -2
- package/dist/runtime/spots/formal-remote-actor-admission-registry.js +33 -19
- package/dist/runtime/spots/index.d.ts +7 -3
- package/dist/runtime/spots/index.js +23 -16
- package/dist/runtime/spots/spot-activation.d.ts +3 -1
- package/dist/runtime/spots/spot-activation.js +21 -12
- package/dist/runtime/spots/spot-actor-admission-coordinator.d.ts +2 -1
- package/dist/runtime/spots/spot-actor-admission-coordinator.js +11 -10
- package/dist/runtime/spots/spot-actor-packet-dispatch.d.ts +4 -1
- package/dist/runtime/spots/spot-actor-packet-dispatch.js +7 -5
- package/dist/runtime/spots/spot-actor-packet-drain.js +2 -0
- package/dist/runtime/spots/spot-actor-packet-relay-dispatch.js +1 -0
- package/dist/runtime/spots/spot-entry-activation.js +9 -3
- package/dist/runtime/spots/spot-handler-registry.d.ts +3 -1
- package/dist/runtime/spots/spot-handler-registry.js +18 -8
- package/dist/runtime/spots/spot-node-autoconnect.js +4 -3
- package/dist/runtime/spots/spot-node-runtime-manager.d.ts +2 -1
- package/dist/runtime/spots/spot-node-runtime-manager.js +4 -11
- package/dist/runtime/spots/spot-outbound.d.ts +3 -0
- package/dist/runtime/spots/spot-outbound.js +24 -15
- package/dist/runtime/spots/spot-routed-spot-packet-dispatch.d.ts +1 -0
- package/dist/runtime/spots/spot-routed-spot-packet-dispatch.js +1 -1
- package/dist/runtime/spots/spot-routing-internal.d.ts +6 -0
- package/dist/runtime/spots/spot-runtime-ports.d.ts +3 -1
- package/dist/runtime/spots/spot-subscription-dispatch.js +0 -3
- package/dist/runtime/spots/spot-timer.js +1 -0
- package/dist/runtime/streams/stream-session-runtime.d.ts +1 -1
- package/dist/runtime/streams/stream-session-runtime.js +14 -28
- package/package.json +3 -3
- package/src/contracts/Actors/ZLinkActorClient.ts +2 -1
- package/src/contracts/Channels/Calls.ts +2 -1
- package/src/contracts/Common/ZLinkMessageMetadata.ts +13 -8
- package/src/contracts/Configuration/Builders.ts +1 -2
- package/src/contracts/Configuration/Configs.ts +0 -6
- package/src/contracts/Configuration/RegistrationBuilders.ts +8 -12
- package/src/contracts/Configuration/RegistrationTypes.ts +1 -6
- package/src/contracts/Configuration/RegistrationValidators.ts +9 -10
- package/src/contracts/Configuration/index.ts +1 -6
- package/src/contracts/Handlers/Attributes.ts +14 -21
- package/src/contracts/Handlers/JsonContract.ts +8 -216
- package/src/contracts/Spots/Contracts.ts +2 -1
- package/src/internal.ts +1 -0
- package/src/nest-integration.ts +1 -0
- package/src/runtime/actors/actor-client.ts +40 -16
- package/src/runtime/actors/actor-handoff.ts +22 -8
- package/src/runtime/actors/actor-join-relocation.ts +1 -0
- package/src/runtime/actors/actor-local-native-join.ts +17 -26
- package/src/runtime/actors/actor-remote-wire.ts +17 -0
- package/src/runtime/actors/actor-routed-join-transport.ts +14 -4
- package/src/runtime/actors/actor-routed-json-request.ts +10 -2
- package/src/runtime/actors/index.ts +19 -5
- package/src/runtime/actors/spot-actor-dispatch.ts +4 -2
- package/src/runtime/admission.ts +18 -5
- package/src/runtime/application-jobs/application-ingress-record-owner.ts +53 -27
- package/src/runtime/application-jobs/application-job-queue-scope.ts +56 -22
- package/src/runtime/application-jobs/contracts.ts +28 -2
- package/src/runtime/backend/contracts/index.ts +63 -32
- package/src/runtime/backend/mesh-completion-table.ts +175 -59
- package/src/runtime/backend/mesh-dispatch-pump.ts +59 -32
- package/src/runtime/backend/node/node-backend-adapter-factory.ts +12 -5
- package/src/runtime/backend/node/node-backend-adapter-support.ts +42 -31
- package/src/runtime/backend/node/node-dealer-channel-client-transport.ts +12 -2
- package/src/runtime/backend/node/node-mesh-backend-adapter.ts +3 -10
- package/src/runtime/backend/node/node-raw-binding-port.ts +73 -37
- package/src/runtime/backend/node/node-raw-mesh-backend.ts +209 -176
- package/src/runtime/backend/node/node-socket-backend-adapter.ts +32 -13
- package/src/runtime/backend/raw-binding-port.ts +18 -3
- package/src/runtime/backend/runtime-message.ts +6 -0
- package/src/runtime/backend/runtime-values.ts +1 -0
- package/src/runtime/channels/channel-clients.ts +90 -41
- package/src/runtime/channels/channel-dispatch-pipeline.ts +69 -34
- package/src/runtime/channels/channel-dispatch-services.ts +69 -1
- package/src/runtime/channels/channel-dispatchers.ts +29 -27
- package/src/runtime/channels/channel-envelope-inspection.ts +2 -16
- package/src/runtime/channels/channel-envelope.ts +133 -8
- package/src/runtime/channels/channel-outbound-operations.ts +22 -8
- package/src/runtime/channels/channel-receive-loops.ts +3 -3
- package/src/runtime/channels/channel-runtime-lifecycle.ts +7 -1
- package/src/runtime/channels/channel-runtime-manager.ts +29 -12
- package/src/runtime/channels/channel-socket-registry.ts +84 -130
- package/src/runtime/channels/channel-transports.ts +128 -60
- package/src/runtime/channels/local-spot-route-transport.ts +3 -1
- package/src/runtime/channels/router-socket-spot-route-transport.ts +13 -4
- package/src/runtime/channels/source-spot-router.ts +8 -4
- package/src/runtime/channels/spot-node-route-transport.ts +8 -4
- package/src/runtime/channels/spot-route-bridge-transport.ts +6 -4
- package/src/runtime/channels/spot-route-dispatch-strategy.ts +47 -18
- package/src/runtime/diagnostics/message-flow.ts +1 -1
- package/src/runtime/execution/serial-execution-queue.ts +2 -0
- package/src/runtime/foundation/actor-join-recovery-codec.ts +2 -2
- package/src/runtime/foundation/durable-service-request.ts +137 -0
- package/src/runtime/foundation/operation-identity.ts +5 -1
- package/src/runtime/foundation/raw-service-mesh-runtime.ts +642 -253
- package/src/runtime/foundation/service-liveness-registry.ts +68 -59
- package/src/runtime/foundation/service-mailbox.ts +7 -1
- package/src/runtime/foundation/service-relocation-object-owner.ts +2 -0
- package/src/runtime/foundation/service-relocation-runtime.ts +18 -1
- package/src/runtime/foundation/service-runtime-contracts.ts +7 -1
- package/src/runtime/foundation/service-stateful-runtime.ts +128 -160
- package/src/runtime/foundation/service-stateful-wire-codec.ts +55 -84
- package/src/runtime/foundation/service-topology-registry.ts +103 -42
- package/src/runtime/foundation/service-wire-m6a-codec.ts +57 -38
- package/src/runtime/handlers/handler-instance-scope.ts +67 -16
- package/src/runtime/host/actor-packet-relay.ts +7 -0
- package/src/runtime/host/actor-runtime-options-factory.ts +14 -2
- package/src/runtime/host/application-job-queue.ts +249 -48
- package/src/runtime/host/entry-actor-runtime.ts +5 -0
- package/src/runtime/host/index.ts +224 -160
- package/src/runtime/host/instance-activation-authority.ts +132 -27
- package/src/runtime/host/remote-bound-session-relay.ts +2 -23
- package/src/runtime/host/route-mesh-runtime.ts +1 -1
- package/src/runtime/host/service-relocation-control.ts +11 -5
- package/src/runtime/host/service-relocation-host-runtime.ts +317 -291
- package/src/runtime/host/spot-address-transport.ts +49 -24
- package/src/runtime/host/spot-runtime-options-factory.ts +4 -0
- package/src/runtime/host/user-spot-creation-coordinator.ts +8 -0
- package/src/runtime/locations/actor-location-claims.ts +52 -30
- package/src/runtime/locations/domain-store-contract.ts +6 -2
- package/src/runtime/locations/in-memory-authority-store.ts +113 -9
- package/src/runtime/locations/in-memory-location-store.ts +25 -3
- package/src/runtime/locations/internal-location-contracts.ts +4 -0
- package/src/runtime/locations/lifecycle.ts +8 -26
- package/src/runtime/locations/location-store-repository.ts +220 -15
- package/src/runtime/locations/resolvers.ts +25 -2
- package/src/runtime/locations/runtime.ts +28 -24
- package/src/runtime/messaging/framework-json-v1.ts +5 -325
- package/src/runtime/messaging/packet-name.ts +5 -25
- package/src/runtime/messaging/request-result.ts +58 -0
- package/src/runtime/messaging/submission-result.ts +7 -3
- package/src/runtime/protocol/service_wire_codec.generated.ts +131 -1
- package/src/runtime/protocol/service_wire_pilot_codec.generated.ts +4 -4
- package/src/runtime/spots/formal-remote-actor-admission-registry.ts +45 -23
- package/src/runtime/spots/index.ts +30 -2
- package/src/runtime/spots/spot-activation.ts +33 -10
- package/src/runtime/spots/spot-actor-admission-coordinator.ts +13 -0
- package/src/runtime/spots/spot-actor-packet-dispatch.ts +10 -0
- package/src/runtime/spots/spot-actor-packet-drain.ts +2 -0
- package/src/runtime/spots/spot-actor-packet-relay-dispatch.ts +1 -0
- package/src/runtime/spots/spot-entry-activation.ts +12 -2
- package/src/runtime/spots/spot-handler-registry.ts +41 -8
- package/src/runtime/spots/spot-node-autoconnect.ts +6 -2
- package/src/runtime/spots/spot-node-runtime-manager.ts +7 -12
- package/src/runtime/spots/spot-outbound.ts +36 -16
- package/src/runtime/spots/spot-routed-spot-packet-dispatch.ts +2 -1
- package/src/runtime/spots/spot-routing-internal.ts +14 -0
- package/src/runtime/spots/spot-runtime-ports.ts +3 -0
- package/src/runtime/spots/spot-subscription-dispatch.ts +0 -3
- package/src/runtime/spots/spot-timer.ts +5 -1
- package/src/runtime/streams/stream-session-runtime.ts +13 -30
|
@@ -31,6 +31,7 @@ export declare class ZLinkHostSpotAddressTransport implements ZLinkSpotAddressTr
|
|
|
31
31
|
private reportInstanceRequestError;
|
|
32
32
|
private traceInstanceAddress;
|
|
33
33
|
private resolveExisting;
|
|
34
|
+
private reactivationCall;
|
|
34
35
|
private selectMissingTarget;
|
|
35
36
|
private validateExisting;
|
|
36
37
|
private encode;
|
|
@@ -30,7 +30,10 @@ class ZLinkHostSpotAddressTransport {
|
|
|
30
30
|
}
|
|
31
31
|
async sendToSpotAddressScoped(spotId, message, call) {
|
|
32
32
|
const activationDeadlineUnixMs = BigInt(Math.round(Date.now() + this.options.defaultRequestTimeoutMs));
|
|
33
|
-
const
|
|
33
|
+
const resolution = await this.resolveExisting(spotId, undefined, call);
|
|
34
|
+
const existing = resolution !== undefined && !('kind' in resolution) ? resolution : undefined;
|
|
35
|
+
if (resolution !== undefined && 'kind' in resolution)
|
|
36
|
+
call = this.reactivationCall(resolution, call);
|
|
34
37
|
if (existing !== undefined) {
|
|
35
38
|
this.validateExisting(existing, call);
|
|
36
39
|
try {
|
|
@@ -64,7 +67,7 @@ class ZLinkHostSpotAddressTransport {
|
|
|
64
67
|
if (!call.instanceSpot) {
|
|
65
68
|
return { status: submission_result_1.ZLinkSubmitStatus.TargetNotFound };
|
|
66
69
|
}
|
|
67
|
-
const selected = this.selectMissingTarget(spotId, call);
|
|
70
|
+
const selected = this.selectMissingTarget(spotId, call, resolution);
|
|
68
71
|
if (selected.kind === 'unsupported') {
|
|
69
72
|
this.traceInstanceAddress(ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Dropped, ZLinkDispatchOptions_1.ZLinkDispatchMessageKind.Send, spotId, message, call.initialMeshName, call.instanceSpotType, undefined, ZLinkDispatchOptions_1.ZLinkRuntimeDispatchErrorReason.StaleTarget);
|
|
70
73
|
return { status: submission_result_1.ZLinkSubmitStatus.TargetNotFound };
|
|
@@ -91,10 +94,13 @@ class ZLinkHostSpotAddressTransport {
|
|
|
91
94
|
const timeoutMs = call.timeoutMs ?? this.options.defaultRequestTimeoutMs;
|
|
92
95
|
const deadline = createSpotAddressDeadline(timeoutMs, call.signal);
|
|
93
96
|
try {
|
|
94
|
-
const
|
|
97
|
+
const resolution = await this.resolveExisting(spotId, deadline.signal, call);
|
|
98
|
+
const existing = resolution !== undefined && !('kind' in resolution) ? resolution : undefined;
|
|
99
|
+
if (resolution !== undefined && 'kind' in resolution)
|
|
100
|
+
call = this.reactivationCall(resolution, call);
|
|
95
101
|
deadline.requireRemaining();
|
|
96
102
|
if (existing === undefined) {
|
|
97
|
-
return await this.requestToMissingInstance(spotId, request, call, deadline);
|
|
103
|
+
return await this.requestToMissingInstance(spotId, request, call, deadline, resolution);
|
|
98
104
|
}
|
|
99
105
|
this.validateExisting(existing, call);
|
|
100
106
|
try {
|
|
@@ -138,16 +144,17 @@ class ZLinkHostSpotAddressTransport {
|
|
|
138
144
|
instanceSpot: call.instanceSpot,
|
|
139
145
|
timeoutMs: deadline.requireRemaining(),
|
|
140
146
|
signal: deadline.signal,
|
|
141
|
-
metadata: call.metadata
|
|
147
|
+
metadata: call.metadata,
|
|
148
|
+
onAdmitted: call.onAdmitted
|
|
142
149
|
}), deadline.signal);
|
|
143
150
|
this.traceInstanceAddress(ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.ReplyReceived, ZLinkDispatchOptions_1.ZLinkDispatchMessageKind.Request, spotId, request, existing.routerChannelId, existing.stableType, existing.targetNodeRid);
|
|
144
151
|
return reply;
|
|
145
152
|
}
|
|
146
|
-
async requestToMissingInstance(spotId, request, call, deadline) {
|
|
153
|
+
async requestToMissingInstance(spotId, request, call, deadline, current) {
|
|
147
154
|
if (!call.instanceSpot) {
|
|
148
155
|
throw (0, framework_errors_internal_1.createInternalFrameworkException)(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.RequestTargetNotFound, `Spot '${String(spotId)}' has no Ready authority.`);
|
|
149
156
|
}
|
|
150
|
-
const selected = this.selectMissingTarget(spotId, call);
|
|
157
|
+
const selected = this.selectMissingTarget(spotId, call, current);
|
|
151
158
|
if (selected.kind === 'capacity') {
|
|
152
159
|
throw missingInstancePlacementCapacity(spotId, call.instanceSpotType);
|
|
153
160
|
}
|
|
@@ -167,7 +174,7 @@ class ZLinkHostSpotAddressTransport {
|
|
|
167
174
|
const table = this.options.completions(selected.meshName);
|
|
168
175
|
if (table === undefined)
|
|
169
176
|
throw new Error(`MeshNode '${selected.meshName}' completion table is not started.`);
|
|
170
|
-
const completionPromise = table.submit(() => selected.node.requestToMissingInstanceSpot(selected.target, encoded, deadlineUnixMs, call.sourceSpot === undefined ? undefined : String(call.sourceSpot.routingId), call.metadata), deadline.signal);
|
|
177
|
+
const completionPromise = table.submit(() => selected.node.requestToMissingInstanceSpot(selected.target, encoded, deadlineUnixMs, call.sourceSpot === undefined ? undefined : String(call.sourceSpot.routingId), call.metadata, call.onAdmitted), deadline.signal);
|
|
171
178
|
this.traceInstanceAddress(ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Sent, ZLinkDispatchOptions_1.ZLinkDispatchMessageKind.Request, spotId, request, selected.meshName, selected.target.stableType, selected.target.targetNodeRid);
|
|
172
179
|
const completion = await (0, abort_1.awaitWithAbort)(completionPromise, deadline.signal);
|
|
173
180
|
try {
|
|
@@ -214,13 +221,15 @@ class ZLinkHostSpotAddressTransport {
|
|
|
214
221
|
errorReason
|
|
215
222
|
});
|
|
216
223
|
}
|
|
217
|
-
async resolveExisting(spotId, signal) {
|
|
224
|
+
async resolveExisting(spotId, signal, call) {
|
|
218
225
|
const resolver = this.options.resolver();
|
|
219
226
|
if (resolver === undefined) {
|
|
220
227
|
throw new Error('Global Spot address resolution requires a Location Store.');
|
|
221
228
|
}
|
|
222
229
|
try {
|
|
223
|
-
return await (0, abort_1.awaitWithAbort)(
|
|
230
|
+
return await (0, abort_1.awaitWithAbort)(call?.instanceSpot === true
|
|
231
|
+
? resolver.resolve(spotId, signal, true)
|
|
232
|
+
: resolver.resolve(spotId, signal), signal);
|
|
224
233
|
}
|
|
225
234
|
catch (error) {
|
|
226
235
|
if (error instanceof contracts_1.ZLinkFrameworkException &&
|
|
@@ -230,7 +239,11 @@ class ZLinkHostSpotAddressTransport {
|
|
|
230
239
|
throw error;
|
|
231
240
|
}
|
|
232
241
|
}
|
|
233
|
-
|
|
242
|
+
reactivationCall(route, call) {
|
|
243
|
+
this.validateExisting(route, call);
|
|
244
|
+
return { ...call, initialMeshName: route.meshName, instanceSpotType: route.stableType };
|
|
245
|
+
}
|
|
246
|
+
selectMissingTarget(spotId, call, current) {
|
|
234
247
|
const configuredMeshes = this.options.meshNames();
|
|
235
248
|
if (call.initialMeshName !== undefined &&
|
|
236
249
|
this.options.isMeshConfigured?.(call.initialMeshName) === false) {
|
|
@@ -253,11 +266,11 @@ class ZLinkHostSpotAddressTransport {
|
|
|
253
266
|
const stableType = call.instanceSpotType ?? (distinctTypes.length === 1 ? distinctTypes[0] : undefined);
|
|
254
267
|
if (stableType === undefined) {
|
|
255
268
|
if (distinctTypes.length === 0)
|
|
256
|
-
return { kind: 'unsupported' };
|
|
269
|
+
return { kind: current === undefined ? 'unsupported' : 'unavailable' };
|
|
257
270
|
throw (0, framework_errors_internal_1.createInternalFrameworkException)(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.InvalidOperation, 'Instance Spot type is required when multiple types are registered.');
|
|
258
271
|
}
|
|
259
272
|
if (canInspectPlacementTypes && !distinctTypes.includes(stableType)) {
|
|
260
|
-
return { kind: 'unsupported' };
|
|
273
|
+
return { kind: current === undefined ? 'unsupported' : 'unavailable' };
|
|
261
274
|
}
|
|
262
275
|
let unavailable = false;
|
|
263
276
|
let capacity = false;
|
|
@@ -276,6 +289,7 @@ class ZLinkHostSpotAddressTransport {
|
|
|
276
289
|
node,
|
|
277
290
|
target: {
|
|
278
291
|
...placement.target,
|
|
292
|
+
targetMeshName: meshName,
|
|
279
293
|
targetSpotId: String(spotId),
|
|
280
294
|
stableType
|
|
281
295
|
}
|
|
@@ -293,7 +307,7 @@ class ZLinkHostSpotAddressTransport {
|
|
|
293
307
|
if (capacity)
|
|
294
308
|
return { kind: 'capacity' };
|
|
295
309
|
if (unsupported)
|
|
296
|
-
return { kind: 'unsupported' };
|
|
310
|
+
return { kind: current === undefined ? 'unsupported' : 'unavailable' };
|
|
297
311
|
return { kind: 'unavailable' };
|
|
298
312
|
}
|
|
299
313
|
validateExisting(target, call) {
|
|
@@ -25,12 +25,12 @@ class ZLinkSpotRuntimeOptionsFactory {
|
|
|
25
25
|
?.notifyPrimaryEntrySpotActorLeft(actor, signal, actorRef, membershipEpoch) ??
|
|
26
26
|
Promise.resolve()
|
|
27
27
|
},
|
|
28
|
-
dispatchEntryActorPacket: (actorId, parts, returnResponse, remoteBoundSessionTarget, fallbackActorRef, requestTerminal, messageFollowOrigin) => {
|
|
28
|
+
dispatchEntryActorPacket: (origin, actorId, parts, returnResponse, remoteBoundSessionTarget, fallbackActorRef, requestTerminal, messageFollowOrigin) => {
|
|
29
29
|
const runtime = this.options.spotNodeRuntime();
|
|
30
30
|
if (runtime === undefined) {
|
|
31
31
|
throw new configuration_1.ZLinkConfigurationException('Entry Spot actor packet dispatch requires the MeshNode runtime.');
|
|
32
32
|
}
|
|
33
|
-
return runtime.dispatchEntryActorPacket(actorId, parts, returnResponse, remoteBoundSessionTarget, fallbackActorRef, requestTerminal, messageFollowOrigin);
|
|
33
|
+
return runtime.dispatchEntryActorPacket(origin, actorId, parts, returnResponse, remoteBoundSessionTarget, fallbackActorRef, requestTerminal, messageFollowOrigin);
|
|
34
34
|
},
|
|
35
35
|
dispatchEntryActorJoin: async (meshName, actor, handoffBacklog) => {
|
|
36
36
|
const runtime = this.options.spotNodeRuntime();
|
|
@@ -178,6 +178,7 @@ class ZLinkSpotRuntimeOptionsFactory {
|
|
|
178
178
|
contracts_1.ZLinkSpotRelocationCoordinationMode.FrameworkManaged);
|
|
179
179
|
},
|
|
180
180
|
actorTransferRuntime,
|
|
181
|
+
releaseActorMembers: (meshName, spotId) => this.options.actorManager()?.releaseSpotActorMembers(meshName, spotId) ?? Promise.resolve(),
|
|
181
182
|
boundSessionRuntime: this.options.boundSessionRelay.boundSessions,
|
|
182
183
|
actorHandoffRuntime: this.options.actorHandoff,
|
|
183
184
|
metrics: this.options.metrics,
|
|
@@ -5,6 +5,7 @@ import type { ZLinkAuthoritySnapshot, ZLinkLocationOwnerToken } from '../locatio
|
|
|
5
5
|
import type { ZLinkAuthorityStore, ZLinkObjectCreationStore } from '../locations/internal-store-contracts';
|
|
6
6
|
import type { ZLinkLocalSpotCreateResult } from '../spots/spot-manager-internal-contracts';
|
|
7
7
|
export interface ZLinkUserSpotCreationCoordinatorOptions {
|
|
8
|
+
readonly relocationPolicy?: (meshName: string, stableType: string) => import('../locations/internal-location-contracts').ZLinkObjectReserveRequest['actorRelocationPolicy'];
|
|
8
9
|
readonly store: ZLinkObjectCreationStore & ZLinkAuthorityStore;
|
|
9
10
|
readonly target: (request: Pick<ZLinkUserSpotCreationRequest, 'meshName' | 'stableType'>, signal?: AbortSignal, excludedNodeRids?: ReadonlySet<string>) => Promise<{
|
|
10
11
|
readonly meshName: string;
|
|
@@ -62,6 +62,7 @@ class ZLinkUserSpotCreationCoordinator {
|
|
|
62
62
|
try {
|
|
63
63
|
reserved = await this.options.store.reserve({
|
|
64
64
|
key: { kind: 'user_spot', globalId: String(request.spotId) },
|
|
65
|
+
actorRelocationPolicy: this.options.relocationPolicy?.(target.meshName, request.stableType),
|
|
65
66
|
intent: {
|
|
66
67
|
stableType: request.stableType,
|
|
67
68
|
requestContentReference: contentReference,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ActorRef, RoutingId } from '../../contracts/Common';
|
|
2
2
|
import { type ZLinkActorLocation } from './internal-location-contracts';
|
|
3
3
|
import type { ZLinkActorLocationStore, ZLinkAuthorityStore } from './internal-store-contracts';
|
|
4
|
+
import { ZLinkSpotKind } from '../../contracts/Spots';
|
|
4
5
|
import type { IZLinkLocationLifecycleRuntime, ZLinkOwnershipLostEvent } from './lifecycle-runtime';
|
|
5
6
|
export declare enum ZLinkActorClaimStatus {
|
|
6
7
|
Claimed = "claimed",
|
|
@@ -31,8 +32,7 @@ export declare class ZLinkActorLocationClaims {
|
|
|
31
32
|
claim(actorType: string, actorId: string, nodeRid: RoutingId, deactivate?: () => Promise<void>): Promise<ZLinkActorClaimResult>;
|
|
32
33
|
setRef(actorType: string, actorId: string, actorRef: ActorRef, ownerNodeGeneration: bigint): Promise<void>;
|
|
33
34
|
takeoverJoinedSpot(actorType: string, actorId: string, actorRef: ActorRef, spotMeshName: string, spotId: RoutingId, spotGeneration: bigint, membershipEpoch: bigint, ownerNodeGeneration: bigint, deactivate?: () => Promise<void>): Promise<ZLinkActorClaimResult>;
|
|
34
|
-
|
|
35
|
-
notifyLeftSpot(actorType: string, actorId: string, entrySpotId: RoutingId, entrySpotGeneration: bigint, membershipEpoch: bigint, ownerNodeGeneration: bigint): Promise<void>;
|
|
35
|
+
commitMembership(actorType: string, actorRef: ActorRef, authorityOwnerGeneration: bigint, spotId: RoutingId, spotGeneration: bigint, spotKind: ZLinkSpotKind.Entry | ZLinkSpotKind.User, ownerNodeGeneration: bigint): Promise<void>;
|
|
36
36
|
release(_actorType: string, actorId: string, actorRef?: ActorRef): Promise<void>;
|
|
37
37
|
owns(_actorType: string, actorId: string): boolean;
|
|
38
38
|
snapshot(actorId: string): ZLinkActorLocation | undefined;
|
|
@@ -6,6 +6,7 @@ const Spots_1 = require("../../contracts/Spots");
|
|
|
6
6
|
const key_codec_1 = require("./key-codec");
|
|
7
7
|
const authority_key_codec_1 = require("./authority-key-codec");
|
|
8
8
|
const routing_id_1 = require("../routing-id");
|
|
9
|
+
const actor_authority_publication_1 = require("../actors/actor-authority-publication");
|
|
9
10
|
var ZLinkActorClaimStatus;
|
|
10
11
|
(function (ZLinkActorClaimStatus) {
|
|
11
12
|
ZLinkActorClaimStatus["Claimed"] = "claimed";
|
|
@@ -149,25 +150,39 @@ class ZLinkActorLocationClaims {
|
|
|
149
150
|
});
|
|
150
151
|
return { status: ZLinkActorClaimStatus.Claimed, claimed, generation: result.generation };
|
|
151
152
|
}
|
|
152
|
-
async
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
153
|
+
async commitMembership(actorType, actorRef, authorityOwnerGeneration, spotId, spotGeneration, spotKind, ownerNodeGeneration) {
|
|
154
|
+
const actorId = actorRef.actorId;
|
|
155
|
+
const store = this.authorityStore;
|
|
156
|
+
const owner = this.runtime.currentOwnerToken;
|
|
157
|
+
if (store === undefined || owner === undefined) {
|
|
158
|
+
throw new Error('Actor membership commit requires Location Store authority and owner.');
|
|
159
|
+
}
|
|
160
|
+
const key = (0, authority_key_codec_1.encodeAuthorityKey)('actor', actorId);
|
|
161
|
+
const current = await store.readAuthority(key);
|
|
162
|
+
if (!matchesActorAuthority(current, actorRef, owner) ||
|
|
163
|
+
current.allocation.stableType !== actorType ||
|
|
164
|
+
current.authorityOwnerGeneration !== authorityOwnerGeneration ||
|
|
165
|
+
current.allocation.descriptorLifecycleGeneration !== ownerNodeGeneration) {
|
|
166
|
+
throw new Error(`Actor '${actorId}' membership authority fence does not match.`);
|
|
167
|
+
}
|
|
168
|
+
const identity = (0, actor_authority_publication_1.decodeActorAuthorityIdentity)(current.payload, current.objectGeneration);
|
|
169
|
+
if (identity === undefined ||
|
|
170
|
+
identity.actorType !== actorType ||
|
|
171
|
+
identity.ownerNodeGeneration !== ownerNodeGeneration ||
|
|
172
|
+
identity.owner.ownerId !== owner.ownerId ||
|
|
173
|
+
identity.owner.leaseGeneration !== owner.leaseGeneration ||
|
|
174
|
+
!(0, routing_id_1.routingIdsEqual)(identity.actor.nodeRid, actorRef.nodeRid) ||
|
|
175
|
+
identity.meshName !== actorRef.meshName) {
|
|
176
|
+
throw new Error(`Actor '${actorId}' membership authority identity does not match.`);
|
|
177
|
+
}
|
|
178
|
+
const result = await store.compareExchangeAuthority(key, current.storeVersion, {
|
|
179
|
+
kind: 'put',
|
|
180
|
+
generationTransition: 'preserve',
|
|
181
|
+
payload: (0, actor_authority_publication_1.rewriteActorAuthorityRoute)(current.payload, actorRef, String(spotId), spotGeneration, spotKind)
|
|
182
|
+
});
|
|
183
|
+
if (result.kind !== 'stored') {
|
|
184
|
+
throw new Error(`Actor '${actorId}' membership commit was rejected with status ${result.kind}.`);
|
|
185
|
+
}
|
|
171
186
|
}
|
|
172
187
|
async release(_actorType, actorId, actorRef) {
|
|
173
188
|
const key = { meshName: this.entryMeshName, actorId };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ZLinkLocationOwnerToken, ZLinkLocationPage, ZLinkLocationWriteIntent, ZLinkLocationWriteResult, ZLinkLocationWriteStatus, ZLinkMeshNodeDescriptor, ZLinkMeshNodeDescriptorKey, ZLinkClientServerServerDescriptor, ZLinkClientServerServerDescriptorKey, ZLinkFanoutPublisherDescriptor, ZLinkFanoutPublisherDescriptorKey, ZLinkOwnerLeaseClaimResult, ZLinkOwnerLeaseReadResult, ZLinkOwnerLeaseReleaseResult, ZLinkOwnerLeaseRenewResult, ZLinkPageRequest } from '../../contracts/Locations/Models';
|
|
2
2
|
import type { ZLinkAggregateAbortResult, ZLinkAggregateCommitResult, ZLinkAggregateFence, ZLinkAggregatePrepareRequest, ZLinkAggregatePrepareResult, ZLinkAuthorityCompareExchangeResult, ZLinkAuthorityKey, ZLinkAuthorityMutation, ZLinkAuthorityReadResult, ZLinkAuthorityScanCursor, ZLinkAuthorityScanResult, ZLinkAuthorityStoreVersion, ZLinkCreationOperationIdentity, ZLinkCreationTerminalReadResult, ZLinkObjectAbortRequest, ZLinkObjectAbortResult, ZLinkObjectCommitRequest, ZLinkObjectCommitResult, ZLinkObjectCreationCompleteRequest, ZLinkObjectCreationCompleteResult, ZLinkObjectReserveResult } from '../../contracts/Locations/Authority';
|
|
3
|
-
import type { ZLinkObjectReserveRequest } from './internal-location-contracts';
|
|
3
|
+
import type { ZLinkObjectReserveRequest, ZLinkEndedOwnerReleaseIntent } from './internal-location-contracts';
|
|
4
4
|
/**
|
|
5
5
|
* Framework-private domain repository. Provider implementations never
|
|
6
6
|
* implement this interface; the framework maps it to the opaque Store SPI.
|
|
@@ -26,7 +26,7 @@ export interface ZLinkDomainLocationStore {
|
|
|
26
26
|
reserve(request: ZLinkObjectReserveRequest, signal?: AbortSignal, deadlineUnixMs?: bigint): Promise<ZLinkObjectReserveResult>;
|
|
27
27
|
commit(request: ZLinkObjectCommitRequest, signal?: AbortSignal, deadlineUnixMs?: bigint): Promise<ZLinkObjectCommitResult>;
|
|
28
28
|
completeCreation(request: ZLinkObjectCreationCompleteRequest, signal?: AbortSignal): Promise<ZLinkObjectCreationCompleteResult>;
|
|
29
|
-
releaseEndedReservation?(key: ZLinkAuthorityKey, expectedStoreVersion: string, signal?: AbortSignal): Promise<boolean>;
|
|
29
|
+
releaseEndedReservation?(key: ZLinkAuthorityKey, expectedStoreVersion: string, signal?: AbortSignal, request?: ZLinkEndedOwnerReleaseIntent): Promise<boolean>;
|
|
30
30
|
abort(request: ZLinkObjectAbortRequest, signal?: AbortSignal, deadlineUnixMs?: bigint): Promise<ZLinkObjectAbortResult>;
|
|
31
31
|
prepareAggregate(request: ZLinkAggregatePrepareRequest, signal?: AbortSignal): Promise<ZLinkAggregatePrepareResult>;
|
|
32
32
|
commitAggregate(fence: ZLinkAggregateFence, signal?: AbortSignal): Promise<ZLinkAggregateCommitResult>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { ZLinkAggregateAbortResult, ZLinkAggregateCommitResult, ZLinkAggregateFence, ZLinkAggregatePrepareRequest, ZLinkAggregatePrepareResult, ZLinkAuthorityCompareExchangeResult, ZLinkAuthorityKey, ZLinkAuthorityMutation, ZLinkAuthorityReadResult, ZLinkAuthorityScanCursor, ZLinkAuthorityScanResult, ZLinkAuthorityStoreVersion, ZLinkCapacityVector, ZLinkLocationOwnerToken, ZLinkMeshNodeDescriptorKey, ZLinkObjectAbortRequest, ZLinkObjectAbortResult, ZLinkObjectCommitRequest, ZLinkObjectCommitResult, ZLinkObjectCreationCompleteRequest, ZLinkObjectCreationCompleteResult, ZLinkObjectReserveRequest, ZLinkObjectReserveResult, ZLinkCreationOperationIdentity, ZLinkCreationTerminalReadResult } from './internal-location-contracts';
|
|
1
|
+
import type { ZLinkAggregateAbortResult, ZLinkAggregateCommitResult, ZLinkAggregateFence, ZLinkAggregatePrepareRequest, ZLinkAggregatePrepareResult, ZLinkAuthorityCompareExchangeResult, ZLinkAuthorityKey, ZLinkAuthorityMutation, ZLinkAuthorityReadResult, ZLinkAuthorityScanCursor, ZLinkAuthorityScanResult, ZLinkAuthorityStoreVersion, ZLinkCapacityVector, ZLinkLocationOwnerToken, ZLinkMeshNodeDescriptorKey, ZLinkObjectAbortRequest, ZLinkObjectAbortResult, ZLinkObjectCommitRequest, ZLinkObjectCommitResult, ZLinkObjectCreationCompleteRequest, ZLinkObjectCreationCompleteResult, ZLinkEndedOwnerReleaseIntent, ZLinkObjectReserveRequest, ZLinkObjectReserveResult, ZLinkCreationOperationIdentity, ZLinkCreationTerminalReadResult } from './internal-location-contracts';
|
|
2
2
|
export interface ZLinkInMemoryAuthorityValidation {
|
|
3
3
|
isOwnerLive(owner: ZLinkLocationOwnerToken): boolean;
|
|
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;
|
|
7
8
|
}
|
|
8
9
|
/**
|
|
9
10
|
* In-memory reference provider for the provider-owned authority state machine.
|
|
@@ -27,7 +28,8 @@ export declare class ZLinkInMemoryAuthorityStore {
|
|
|
27
28
|
compareExchangeAuthority(key: ZLinkAuthorityKey, expectedStoreVersion: ZLinkAuthorityStoreVersion, mutation: ZLinkAuthorityMutation, signal?: AbortSignal): Promise<ZLinkAuthorityCompareExchangeResult>;
|
|
28
29
|
listAuthorities(prefix: string, cursor: ZLinkAuthorityScanCursor | undefined, limit: number, signal?: AbortSignal): Promise<ZLinkAuthorityScanResult>;
|
|
29
30
|
removeAllByOwner(owner: ZLinkLocationOwnerToken, signal?: AbortSignal): Promise<bigint>;
|
|
30
|
-
releaseEndedReservation(key: ZLinkAuthorityKey, expectedStoreVersion: string, signal?: AbortSignal): Promise<boolean>;
|
|
31
|
+
releaseEndedReservation(key: ZLinkAuthorityKey, expectedStoreVersion: string, signal?: AbortSignal, request?: ZLinkEndedOwnerReleaseIntent): Promise<boolean>;
|
|
32
|
+
acceptsUserSpotMembership(spotId: string, objectGeneration: bigint): boolean;
|
|
31
33
|
private tryReleaseEndedReservation;
|
|
32
34
|
reserve(request: ZLinkObjectReserveRequest, signal?: AbortSignal): Promise<ZLinkObjectReserveResult>;
|
|
33
35
|
commit(request: ZLinkObjectCommitRequest, signal?: AbortSignal): Promise<ZLinkObjectCommitResult>;
|
|
@@ -11,6 +11,9 @@ const actor_join_recovery_codec_1 = require("../foundation/actor-join-recovery-c
|
|
|
11
11
|
const authority_key_codec_1 = require("./authority-key-codec");
|
|
12
12
|
const opaque_record_key_1 = require("./opaque-record-key");
|
|
13
13
|
const service_relocation_runtime_1 = require("../foundation/service-relocation-runtime");
|
|
14
|
+
const service_authority_payload_codec_1 = require("../foundation/service-authority-payload-codec");
|
|
15
|
+
const actor_authority_payload_codec_1 = require("../actors/actor-authority-payload-codec");
|
|
16
|
+
const contracts_2 = require("../../contracts");
|
|
14
17
|
const MAX_GENERATION = 0x7fffffffffffffffn;
|
|
15
18
|
const CREATION_TERMINAL_RETENTION_MS = 5 * 60 * 1000;
|
|
16
19
|
const MAX_U64 = stream_wire_1.UINT64_MAX;
|
|
@@ -108,6 +111,18 @@ class ZLinkInMemoryAuthorityStore {
|
|
|
108
111
|
if (!this.isOwnerLive(row.snapshot)) {
|
|
109
112
|
return { kind: 'conflict', current: this.read(keyValue) };
|
|
110
113
|
}
|
|
114
|
+
const actor = row.snapshot.allocation.objectKind === 'actor'
|
|
115
|
+
? (0, actor_authority_payload_codec_1.decodeActorAuthorityPayload)((0, service_relocation_runtime_1.serviceRelocationAuthorityApplicationPayload)(mutation.payload))
|
|
116
|
+
: undefined;
|
|
117
|
+
const previousActor = actor === undefined
|
|
118
|
+
? undefined
|
|
119
|
+
: (0, actor_authority_payload_codec_1.decodeActorAuthorityPayload)((0, service_relocation_runtime_1.serviceRelocationAuthorityApplicationPayload)(row.snapshot.payload));
|
|
120
|
+
if (actor?.currentSpotKind === contracts_2.ZLinkSpotKind.User &&
|
|
121
|
+
(previousActor?.currentSpotKind !== contracts_2.ZLinkSpotKind.User ||
|
|
122
|
+
previousActor.currentSpotId !== actor.currentSpotId ||
|
|
123
|
+
previousActor.currentSpotGeneration !== actor.currentSpotGeneration) &&
|
|
124
|
+
!this.acceptsUserSpotMembership(actor.currentSpotId, actor.currentSpotGeneration))
|
|
125
|
+
return { kind: 'conflict', current: this.read(keyValue) };
|
|
111
126
|
if (mutation.generationTransition === 'reincarnate' &&
|
|
112
127
|
(this.objectGeneration >= MAX_GENERATION || this.ownerGeneration >= MAX_GENERATION)) {
|
|
113
128
|
return { kind: 'generationExhausted' };
|
|
@@ -174,33 +189,67 @@ class ZLinkInMemoryAuthorityStore {
|
|
|
174
189
|
this.scanRevision++;
|
|
175
190
|
return BigInt(removed);
|
|
176
191
|
}
|
|
177
|
-
async releaseEndedReservation(key, expectedStoreVersion, signal) {
|
|
192
|
+
async releaseEndedReservation(key, expectedStoreVersion, signal, request) {
|
|
178
193
|
signal?.throwIfAborted();
|
|
179
|
-
return this.tryReleaseEndedReservation(key, expectedStoreVersion);
|
|
194
|
+
return this.tryReleaseEndedReservation(key, expectedStoreVersion, request);
|
|
195
|
+
}
|
|
196
|
+
acceptsUserSpotMembership(spotId, objectGeneration) {
|
|
197
|
+
const row = this.rows.get((0, authority_key_codec_1.encodeAuthorityKey)('user_spot', spotId).value);
|
|
198
|
+
return (row !== undefined &&
|
|
199
|
+
row.snapshot.allocation.objectKind === 'user_spot' &&
|
|
200
|
+
row.snapshot.allocation.state === 'active' &&
|
|
201
|
+
row.snapshot.objectGeneration === objectGeneration &&
|
|
202
|
+
(0, service_authority_payload_codec_1.decodeServiceReadySpotAuthority)(row.snapshot.payload)?.kind === 'user_spot' &&
|
|
203
|
+
this.isOwnerLive(row.snapshot));
|
|
180
204
|
}
|
|
181
205
|
tryReleaseEndedReservation(key, expectedStoreVersion, request) {
|
|
182
206
|
const current = this.rows.get(key.value);
|
|
183
207
|
if (current === undefined ||
|
|
184
208
|
current.snapshot.storeVersion.value !== expectedStoreVersion ||
|
|
185
209
|
(current.snapshot.allocation.state === 'active'
|
|
186
|
-
? request
|
|
210
|
+
? request === undefined
|
|
187
211
|
: current.creation === undefined))
|
|
188
212
|
return false;
|
|
189
213
|
if (current.snapshot.allocation.state === 'active') {
|
|
214
|
+
let unavailable = false;
|
|
190
215
|
for (const aggregate of this.aggregates.values()) {
|
|
191
216
|
if (aggregate.state === 'prepared' &&
|
|
192
217
|
aggregate.request.participants.some((participant) => participant.authorityKey.value === key.value))
|
|
193
|
-
|
|
218
|
+
unavailable = true;
|
|
194
219
|
}
|
|
195
|
-
|
|
196
|
-
return false;
|
|
220
|
+
unavailable ||= relocationAuthorityCodec.read(current.snapshot.payload) !== undefined;
|
|
197
221
|
if (this.validation.isOwnerLive({
|
|
198
222
|
ownerId: current.snapshot.ownerId,
|
|
199
223
|
leaseGeneration: current.snapshot.ownerLeaseGeneration
|
|
200
224
|
}))
|
|
201
225
|
return false;
|
|
202
|
-
|
|
203
|
-
|
|
226
|
+
const spot = current.snapshot.allocation.objectKind === 'actor'
|
|
227
|
+
? undefined
|
|
228
|
+
: (0, service_authority_payload_codec_1.decodeServiceReadySpotAuthority)(current.snapshot.payload);
|
|
229
|
+
if (current.snapshot.allocation.objectKind !== 'actor') {
|
|
230
|
+
unavailable ||=
|
|
231
|
+
spot === undefined ||
|
|
232
|
+
spot.kind !== request?.key.kind ||
|
|
233
|
+
spot.stableType !== request.intent.stableType ||
|
|
234
|
+
spot.spotId !== request.key.globalId ||
|
|
235
|
+
spot.activationRecovery !== undefined;
|
|
236
|
+
if (spot?.kind === 'user_spot') {
|
|
237
|
+
unavailable ||=
|
|
238
|
+
this.validation.hasSpotMembers?.(spot.spotId, current.snapshot.objectGeneration) ===
|
|
239
|
+
true;
|
|
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
|
+
}
|
|
250
|
+
}
|
|
251
|
+
if (unavailable || request?.actorRelocationPolicy !== 'disabled')
|
|
252
|
+
throw new contracts_1.ZLinkFrameworkException(contracts_1.ZLinkFrameworkErrorKind.Unavailable, 'Object owner lease is unavailable.');
|
|
204
253
|
}
|
|
205
254
|
else if (this.validation.isTargetLive(current.snapshot.allocation.descriptor, current.snapshot.allocation.descriptorLifecycleGeneration, {
|
|
206
255
|
ownerId: current.snapshot.ownerId,
|
|
@@ -357,6 +406,12 @@ class ZLinkInMemoryAuthorityStore {
|
|
|
357
406
|
if (!this.creationTerminalAvailable(terminalRecord)) {
|
|
358
407
|
return { kind: 'stale' };
|
|
359
408
|
}
|
|
409
|
+
const actor = request.completion.kind === 'created'
|
|
410
|
+
? (0, actor_authority_payload_codec_1.decodeActorAuthorityPayload)((0, service_relocation_runtime_1.serviceRelocationAuthorityApplicationPayload)(request.completion.readyPayload))
|
|
411
|
+
: undefined;
|
|
412
|
+
if (actor?.currentSpotKind === contracts_2.ZLinkSpotKind.User &&
|
|
413
|
+
!this.acceptsUserSpotMembership(actor.currentSpotId, actor.currentSpotGeneration))
|
|
414
|
+
return { kind: 'stale' };
|
|
360
415
|
const nextVersion = this.tryNextStoreVersion();
|
|
361
416
|
if (nextVersion === undefined)
|
|
362
417
|
return { kind: 'generationExhausted' };
|
|
@@ -500,6 +555,23 @@ class ZLinkInMemoryAuthorityStore {
|
|
|
500
555
|
row.snapshot.storeVersion.value !== participant.expectedStoreVersion.value) {
|
|
501
556
|
return { kind: 'stale' };
|
|
502
557
|
}
|
|
558
|
+
const actor = row.snapshot.allocation.objectKind === 'actor'
|
|
559
|
+
? (0, actor_authority_payload_codec_1.decodeActorAuthorityPayload)((0, service_relocation_runtime_1.serviceRelocationAuthorityApplicationPayload)(participant.authorityPayload))
|
|
560
|
+
: undefined;
|
|
561
|
+
if (actor?.currentSpotKind === contracts_2.ZLinkSpotKind.User) {
|
|
562
|
+
const participantSpot = aggregate.request.participants.find((candidate) => candidate.authorityKey.value ===
|
|
563
|
+
(0, authority_key_codec_1.encodeAuthorityKey)('user_spot', actor.currentSpotId).value);
|
|
564
|
+
if (participantSpot === undefined) {
|
|
565
|
+
if (!this.acceptsUserSpotMembership(actor.currentSpotId, actor.currentSpotGeneration))
|
|
566
|
+
return { kind: 'stale' };
|
|
567
|
+
}
|
|
568
|
+
else {
|
|
569
|
+
const spot = this.rows.get(participantSpot.authorityKey.value);
|
|
570
|
+
if (spot?.snapshot.allocation.objectKind !== 'user_spot' ||
|
|
571
|
+
spot.snapshot.objectGeneration !== actor.currentSpotGeneration)
|
|
572
|
+
return { kind: 'stale' };
|
|
573
|
+
}
|
|
574
|
+
}
|
|
503
575
|
if (participant.ownerTransition === 'newOwner') {
|
|
504
576
|
if (!this.validation.isTargetLive(aggregate.request.targetDescriptor, aggregate.request.targetDescriptorLifecycleGeneration, aggregate.request.targetOwner)) {
|
|
505
577
|
return { kind: 'stale' };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ZLinkActorTransferPrepareRequest, ZLinkActorTransferRecord, ZLinkActorTransferWriteResult } from '../../contracts/Locations/ActorTransfer';
|
|
2
2
|
import type { ZLinkDomainLocationStore } from './domain-store-contract';
|
|
3
|
-
import { ZLinkLocationWriteIntent, ZLinkLocationWriteStatus, type ZLinkActorLocation, type ZLinkActorLocationFilter, type ZLinkActorLocationKey, type ZLinkAggregateAbortResult, type ZLinkAggregateCommitResult, type ZLinkAggregateFence, type ZLinkAggregatePrepareRequest, type ZLinkAggregatePrepareResult, type ZLinkAuthorityCompareExchangeResult, type ZLinkAuthorityKey, type ZLinkAuthorityMutation, type ZLinkAuthorityReadResult, type ZLinkAuthorityScanCursor, type ZLinkAuthorityScanResult, type ZLinkAuthorityStoreVersion, type ZLinkClientServerServerDescriptor, type ZLinkClientServerServerDescriptorKey, type ZLinkCreationOperationIdentity, type ZLinkCreationTerminalReadResult, type ZLinkFanoutPublisherDescriptor, type ZLinkFanoutPublisherDescriptorKey, type ZLinkLocationChangeStampScope, type ZLinkLocationOwnerToken, type ZLinkLocationPage, type ZLinkLocationWriteResult, type ZLinkMeshNodeDescriptor, type ZLinkMeshNodeDescriptorKey, type ZLinkObjectAbortRequest, type ZLinkObjectAbortResult, type ZLinkObjectCommitRequest, type ZLinkObjectCommitResult, type ZLinkObjectCreationCompleteRequest, type ZLinkObjectCreationCompleteResult, type ZLinkObjectReserveRequest, type ZLinkObjectReserveResult, type ZLinkOwnerLeaseClaimResult, type ZLinkOwnerLeaseReadResult, type ZLinkOwnerLeaseReleaseResult, type ZLinkOwnerLeaseRenewResult, type ZLinkPageRequest, type ZLinkPeerLocation, type ZLinkPeerLocationFilter, type ZLinkPeerLocationKey, type ZLinkRouteLocation, type ZLinkRouteLocationFilter, type ZLinkRouteLocationKey, type ZLinkSpotLocation, type ZLinkSpotLocationFilter, type ZLinkSpotLocationKey } from './internal-location-contracts';
|
|
3
|
+
import { ZLinkLocationWriteIntent, ZLinkLocationWriteStatus, type ZLinkActorLocation, type ZLinkActorLocationFilter, type ZLinkActorLocationKey, type ZLinkAggregateAbortResult, type ZLinkAggregateCommitResult, type ZLinkAggregateFence, type ZLinkAggregatePrepareRequest, type ZLinkAggregatePrepareResult, type ZLinkAuthorityCompareExchangeResult, type ZLinkAuthorityKey, type ZLinkAuthorityMutation, type ZLinkAuthorityReadResult, type ZLinkAuthorityScanCursor, type ZLinkAuthorityScanResult, type ZLinkAuthorityStoreVersion, type ZLinkClientServerServerDescriptor, type ZLinkClientServerServerDescriptorKey, type ZLinkCreationOperationIdentity, type ZLinkCreationTerminalReadResult, type ZLinkFanoutPublisherDescriptor, type ZLinkFanoutPublisherDescriptorKey, type ZLinkLocationChangeStampScope, type ZLinkLocationOwnerToken, type ZLinkLocationPage, type ZLinkLocationWriteResult, type ZLinkMeshNodeDescriptor, type ZLinkMeshNodeDescriptorKey, type ZLinkObjectAbortRequest, type ZLinkObjectAbortResult, type ZLinkObjectCommitRequest, type ZLinkObjectCommitResult, type ZLinkObjectCreationCompleteRequest, type ZLinkObjectCreationCompleteResult, type ZLinkEndedOwnerReleaseIntent, type ZLinkObjectReserveRequest, type ZLinkObjectReserveResult, type ZLinkOwnerLeaseClaimResult, type ZLinkOwnerLeaseReadResult, type ZLinkOwnerLeaseReleaseResult, type ZLinkOwnerLeaseRenewResult, type ZLinkPageRequest, type ZLinkPeerLocation, type ZLinkPeerLocationFilter, type ZLinkPeerLocationKey, type ZLinkRouteLocation, type ZLinkRouteLocationFilter, type ZLinkRouteLocationKey, type ZLinkSpotLocation, type ZLinkSpotLocationFilter, type ZLinkSpotLocationKey } from './internal-location-contracts';
|
|
4
4
|
import type { ZLinkFanoutLocationStore } from './internal-store-contracts';
|
|
5
5
|
export declare class ZLinkInMemoryLocationStore implements ZLinkDomainLocationStore, ZLinkFanoutLocationStore {
|
|
6
6
|
private readonly now;
|
|
@@ -25,7 +25,7 @@ export declare class ZLinkInMemoryLocationStore implements ZLinkDomainLocationSt
|
|
|
25
25
|
commit(request: ZLinkObjectCommitRequest, signal?: AbortSignal): Promise<ZLinkObjectCommitResult>;
|
|
26
26
|
completeCreation(request: ZLinkObjectCreationCompleteRequest, signal?: AbortSignal): Promise<ZLinkObjectCreationCompleteResult>;
|
|
27
27
|
readCreationTerminal(operation: ZLinkCreationOperationIdentity, signal?: AbortSignal): Promise<ZLinkCreationTerminalReadResult>;
|
|
28
|
-
releaseEndedReservation(key: ZLinkAuthorityKey, expectedStoreVersion: string, signal?: AbortSignal): Promise<boolean>;
|
|
28
|
+
releaseEndedReservation(key: ZLinkAuthorityKey, expectedStoreVersion: string, signal?: AbortSignal, request?: ZLinkEndedOwnerReleaseIntent): Promise<boolean>;
|
|
29
29
|
abort(request: ZLinkObjectAbortRequest, signal?: AbortSignal): Promise<ZLinkObjectAbortResult>;
|
|
30
30
|
prepareAggregate(request: ZLinkAggregatePrepareRequest, signal?: AbortSignal): Promise<ZLinkAggregatePrepareResult>;
|
|
31
31
|
commitAggregate(fence: ZLinkAggregateFence, signal?: AbortSignal): Promise<ZLinkAggregateCommitResult>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ZLinkInMemoryLocationStore = void 0;
|
|
4
|
+
const contracts_1 = require("../../contracts");
|
|
4
5
|
const CoreTypes_1 = require("../../contracts/Common/CoreTypes");
|
|
5
6
|
const RegistrationBuilderPolicy_1 = require("../../contracts/Configuration/RegistrationBuilderPolicy");
|
|
6
7
|
const location_store_integration_1 = require("../../location-store-integration");
|
|
@@ -62,7 +63,16 @@ class ZLinkInMemoryLocationStore {
|
|
|
62
63
|
spotType.count <=
|
|
63
64
|
typeCapacity.limit))));
|
|
64
65
|
},
|
|
65
|
-
identityClaimed: (authorityKey) => this.entrySpotClaims.has(authorityKey)
|
|
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
76
|
}, now);
|
|
67
77
|
}
|
|
68
78
|
async readAuthority(key, signal) {
|
|
@@ -86,8 +96,8 @@ class ZLinkInMemoryLocationStore {
|
|
|
86
96
|
async readCreationTerminal(operation, signal) {
|
|
87
97
|
return this.authority.readCreationTerminal(operation, signal);
|
|
88
98
|
}
|
|
89
|
-
async releaseEndedReservation(key, expectedStoreVersion, signal) {
|
|
90
|
-
return this.authority.releaseEndedReservation(key, expectedStoreVersion, signal);
|
|
99
|
+
async releaseEndedReservation(key, expectedStoreVersion, signal, request) {
|
|
100
|
+
return this.authority.releaseEndedReservation(key, expectedStoreVersion, signal, request);
|
|
91
101
|
}
|
|
92
102
|
async abort(request, signal) {
|
|
93
103
|
return this.authority.abort(request, signal);
|
|
@@ -389,6 +399,12 @@ class ZLinkInMemoryLocationStore {
|
|
|
389
399
|
});
|
|
390
400
|
const updatedAt = this.now();
|
|
391
401
|
const current = this.actors.rows.get(key);
|
|
402
|
+
if (actor.spotKind === contracts_1.ZLinkSpotKind.User &&
|
|
403
|
+
(current?.spotKind !== contracts_1.ZLinkSpotKind.User ||
|
|
404
|
+
String(current.spotId) !== String(actor.spotId) ||
|
|
405
|
+
current.spotGeneration !== actor.spotGeneration) &&
|
|
406
|
+
!this.authority.acceptsUserSpotMembership(String(actor.spotId), actor.spotGeneration))
|
|
407
|
+
return rejectedConflict();
|
|
392
408
|
if (intent === internal_location_contracts_1.ZLinkLocationWriteIntent.NewClaim &&
|
|
393
409
|
current !== undefined &&
|
|
394
410
|
this.liveOwnerLease(current.ownerId, updatedAt) !== undefined) {
|
|
@@ -4,6 +4,9 @@ import type { ZLinkRelocationConfiguration } from '../../contracts/Configuration
|
|
|
4
4
|
export interface ZLinkObjectReserveRequest extends ReserveRequest {
|
|
5
5
|
readonly actorRelocationPolicy?: ZLinkRelocationConfiguration<unknown>['kind'];
|
|
6
6
|
}
|
|
7
|
+
export type ZLinkEndedOwnerReleaseIntent = Pick<ZLinkObjectReserveRequest, 'key' | 'actorRelocationPolicy'> & {
|
|
8
|
+
readonly intent: Pick<ZLinkObjectReserveRequest['intent'], 'stableType'>;
|
|
9
|
+
};
|
|
7
10
|
export type * from '../../contracts/Locations/Authority';
|
|
8
11
|
export type { ZLinkActorLocation, ZLinkPeerLocation, ZLinkRouteLocation, ZLinkSpotLocation } from '../../contracts/Locations/Rows';
|
|
9
12
|
export type { ZLinkActorLocationFilter, ZLinkActorLocationKey, ZLinkLocationKey, ZLinkPeerLocationFilter, ZLinkPeerLocationKey, ZLinkRouteLocationFilter, ZLinkRouteLocationKey, ZLinkSpotLocationFilter, ZLinkSpotLocationKey } from '../../contracts/Locations/Keys';
|
|
@@ -19,8 +19,7 @@ export declare class ZLinkLocationLifecycle {
|
|
|
19
19
|
claimActor(actorType: string, actorId: string, nodeRid: RoutingId, deactivate?: () => Promise<void>): Promise<ZLinkActorClaimResult>;
|
|
20
20
|
setActorRef(actorType: string, actorId: string, actorRef: ActorRef, ownerNodeGeneration?: bigint): Promise<void>;
|
|
21
21
|
takeoverActorJoinedSpot(actorType: string, actorId: string, actorRef: ActorRef, spotMeshName: string, spotId: RoutingId, spotGeneration: bigint, membershipEpoch: bigint, ownerNodeGeneration: bigint, deactivate?: () => Promise<void>): Promise<ZLinkActorClaimResult>;
|
|
22
|
-
|
|
23
|
-
notifyActorLeftSpot(actorType: string, actorId: string, entrySpotId: RoutingId, entrySpotGeneration: bigint, membershipEpoch: bigint, ownerNodeGeneration: bigint): Promise<void>;
|
|
22
|
+
commitActorMembership(actorType: string, actorRef: ActorRef, authorityOwnerGeneration: bigint, spotId: RoutingId, spotGeneration: bigint, spotKind: ZLinkSpotKind.Entry | ZLinkSpotKind.User, ownerNodeGeneration: bigint): Promise<void>;
|
|
24
23
|
releaseActor(actorType: string, actorId: string, actorRef?: ActorRef): Promise<void>;
|
|
25
24
|
ownsActor(actorType: string, actorId: string): boolean;
|
|
26
25
|
actorLocationSnapshot(actorId: string): ZLinkActorLocation | undefined;
|
|
@@ -34,11 +34,8 @@ class ZLinkLocationLifecycle {
|
|
|
34
34
|
async takeoverActorJoinedSpot(actorType, actorId, actorRef, spotMeshName, spotId, spotGeneration, membershipEpoch, ownerNodeGeneration, deactivate) {
|
|
35
35
|
return await this.actorClaims.takeoverJoinedSpot(actorType, actorId, actorRef, spotMeshName, spotId, spotGeneration, membershipEpoch, ownerNodeGeneration, deactivate);
|
|
36
36
|
}
|
|
37
|
-
async
|
|
38
|
-
await this.actorClaims.
|
|
39
|
-
}
|
|
40
|
-
async notifyActorLeftSpot(actorType, actorId, entrySpotId, entrySpotGeneration, membershipEpoch, ownerNodeGeneration) {
|
|
41
|
-
await this.actorClaims.notifyLeftSpot(actorType, actorId, entrySpotId, entrySpotGeneration, membershipEpoch, ownerNodeGeneration);
|
|
37
|
+
async commitActorMembership(actorType, actorRef, authorityOwnerGeneration, spotId, spotGeneration, spotKind, ownerNodeGeneration) {
|
|
38
|
+
await this.actorClaims.commitMembership(actorType, actorRef, authorityOwnerGeneration, spotId, spotGeneration, spotKind, ownerNodeGeneration);
|
|
42
39
|
}
|
|
43
40
|
async releaseActor(actorType, actorId, actorRef) {
|
|
44
41
|
await this.actorClaims.release(actorType, actorId, actorRef);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ZLinkClientServerServerDescriptor, type ZLinkClientServerServerDescriptorKey, type ZLinkFanoutPublisherDescriptor, type ZLinkFanoutPublisherDescriptorKey, type ZLinkLocationPage, type ZLinkLocationStore, type ZLinkMeshNodeDescriptor, type ZLinkMeshNodeDescriptorKey, type ZLinkPageRequest } from '../../contracts';
|
|
2
2
|
import { ZLinkInMemoryLocationStore } from './in-memory-location-store';
|
|
3
|
-
import { type ZLinkActorLocation, type ZLinkActorLocationFilter, type ZLinkActorLocationKey, type ZLinkAggregateAbortResult, type ZLinkAggregateCommitResult, type ZLinkAggregateFence, type ZLinkAggregatePrepareRequest, type ZLinkAggregatePrepareResult, type ZLinkAuthorityCompareExchangeResult, type ZLinkAuthorityKey, type ZLinkAuthorityMutation, type ZLinkAuthorityReadResult, type ZLinkAuthorityScanCursor, type ZLinkAuthorityScanResult, type ZLinkAuthorityStoreVersion, type ZLinkCreationOperationIdentity, type ZLinkCreationTerminalReadResult, type ZLinkLocationOwnerToken, type ZLinkLocationWriteResult, type ZLinkLocationWriteStatus, type ZLinkObjectAbortRequest, type ZLinkObjectAbortResult, type ZLinkObjectCommitRequest, type ZLinkObjectCommitResult, type ZLinkObjectCreationCompleteRequest, type ZLinkObjectCreationCompleteResult, type ZLinkObjectReserveRequest, type ZLinkObjectReserveResult, type ZLinkOwnerLeaseClaimResult, type ZLinkOwnerLeaseReadResult, type ZLinkOwnerLeaseReleaseResult, type ZLinkOwnerLeaseRenewResult, type ZLinkRouteLocation, type ZLinkRouteLocationFilter, type ZLinkRouteLocationKey, type ZLinkSpotLocation, type ZLinkSpotLocationFilter, type ZLinkSpotLocationKey, ZLinkLocationWriteIntent } from './internal-location-contracts';
|
|
3
|
+
import { type ZLinkActorLocation, type ZLinkActorLocationFilter, type ZLinkActorLocationKey, type ZLinkAggregateAbortResult, type ZLinkAggregateCommitResult, type ZLinkAggregateFence, type ZLinkAggregatePrepareRequest, type ZLinkAggregatePrepareResult, type ZLinkAuthorityCompareExchangeResult, type ZLinkAuthorityKey, type ZLinkAuthorityMutation, type ZLinkAuthorityReadResult, type ZLinkAuthorityScanCursor, type ZLinkAuthorityScanResult, type ZLinkAuthorityStoreVersion, type ZLinkCreationOperationIdentity, type ZLinkCreationTerminalReadResult, type ZLinkLocationOwnerToken, type ZLinkLocationWriteResult, type ZLinkLocationWriteStatus, type ZLinkObjectAbortRequest, type ZLinkObjectAbortResult, type ZLinkObjectCommitRequest, type ZLinkObjectCommitResult, type ZLinkObjectCreationCompleteRequest, type ZLinkObjectCreationCompleteResult, type ZLinkEndedOwnerReleaseIntent, type ZLinkObjectReserveRequest, type ZLinkObjectReserveResult, type ZLinkOwnerLeaseClaimResult, type ZLinkOwnerLeaseReadResult, type ZLinkOwnerLeaseReleaseResult, type ZLinkOwnerLeaseRenewResult, type ZLinkRouteLocation, type ZLinkRouteLocationFilter, type ZLinkRouteLocationKey, type ZLinkSpotLocation, type ZLinkSpotLocationFilter, type ZLinkSpotLocationKey, ZLinkLocationWriteIntent } from './internal-location-contracts';
|
|
4
4
|
/**
|
|
5
5
|
* Maps framework domain records to the minimal provider SPI.
|
|
6
6
|
*
|
|
@@ -20,7 +20,7 @@ export declare class ZLinkLocationStoreRepository extends ZLinkInMemoryLocationS
|
|
|
20
20
|
commitAggregate(fence: ZLinkAggregateFence, signal?: AbortSignal): Promise<ZLinkAggregateCommitResult>;
|
|
21
21
|
private commitAggregateCore;
|
|
22
22
|
abortAggregate(fence: ZLinkAggregateFence, signal?: AbortSignal): Promise<ZLinkAggregateAbortResult>;
|
|
23
|
-
releaseEndedReservation(key: ZLinkAuthorityKey, expectedStoreVersion: string, signal?: AbortSignal): Promise<boolean>;
|
|
23
|
+
releaseEndedReservation(key: ZLinkAuthorityKey, expectedStoreVersion: string, signal?: AbortSignal, request?: ZLinkEndedOwnerReleaseIntent): Promise<boolean>;
|
|
24
24
|
private tryReleaseEndedReservation;
|
|
25
25
|
reserve(request: ZLinkObjectReserveRequest, signal?: AbortSignal, deadlineUnixMs?: bigint): Promise<ZLinkObjectReserveResult>;
|
|
26
26
|
commit(request: ZLinkObjectCommitRequest, signal?: AbortSignal, deadlineUnixMs?: bigint): Promise<ZLinkObjectCommitResult>;
|
|
@@ -59,6 +59,7 @@ export declare class ZLinkLocationStoreRepository extends ZLinkInMemoryLocationS
|
|
|
59
59
|
private writeDescriptorWithReconciliation;
|
|
60
60
|
private removeDescriptor;
|
|
61
61
|
private listDescriptors;
|
|
62
|
+
private userSpotMembershipConditions;
|
|
62
63
|
private updateOwnedLocation;
|
|
63
64
|
private removeOwnedLocation;
|
|
64
65
|
private readOwnedLocation;
|