@zlink-systems/framework 0.30.3 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/contracts/Actors/ZLinkActor.d.ts +2 -0
- package/dist/contracts/Actors/ZLinkSessionBindingIdentity.d.ts +6 -0
- package/dist/contracts/Actors/ZLinkSessionBindingIdentity.js +2 -0
- package/dist/contracts/Actors/index.d.ts +1 -0
- package/dist/contracts/Actors/index.js +1 -0
- package/dist/contracts/Common/CoreTypes.d.ts +1 -0
- package/dist/contracts/Common/HandlerMessageType.d.ts +8 -0
- package/dist/contracts/Common/HandlerMessageType.js +41 -0
- package/dist/contracts/Common/ZLinkEncodedPayload.d.ts +1 -1
- package/dist/contracts/Common/ZLinkEncodedPayload.js +12 -20
- package/dist/contracts/Common/ZLinkMessage.js +11 -7
- package/dist/contracts/Common/encoded-payload-storage.d.ts +0 -2
- package/dist/contracts/Common/encoded-payload-storage.js +4 -16
- package/dist/contracts/Common/index.d.ts +1 -1
- package/dist/contracts/Common/payload-slab.d.ts +4 -0
- package/dist/contracts/Common/payload-slab.js +30 -0
- package/dist/contracts/Configuration/RegistrationBuilders.js +15 -9
- package/dist/contracts/Configuration/RegistrationTypes.d.ts +19 -0
- package/dist/contracts/Handlers/Contexts.d.ts +1 -0
- package/dist/contracts/Locations/Authority.d.ts +2 -0
- package/dist/internal.d.ts +9 -0
- package/dist/internal.js +23 -1
- package/dist/nest-integration.d.ts +1 -0
- package/dist/nest-integration.js +3 -1
- package/dist/runtime/actors/actor-client.d.ts +6 -2
- package/dist/runtime/actors/actor-client.js +120 -82
- package/dist/runtime/actors/actor-context.js +16 -5
- package/dist/runtime/actors/actor-execution-context.js +2 -2
- package/dist/runtime/actors/actor-handoff.d.ts +12 -1
- package/dist/runtime/actors/actor-handoff.js +79 -34
- package/dist/runtime/actors/actor-join-deferred-scope.js +6 -6
- package/dist/runtime/actors/actor-local-native-join.d.ts +2 -2
- package/dist/runtime/actors/actor-local-native-join.js +19 -17
- package/dist/runtime/actors/actor-mailbox.d.ts +1 -1
- package/dist/runtime/actors/actor-remote-joiner.d.ts +2 -2
- package/dist/runtime/actors/actor-remote-joiner.js +4 -4
- package/dist/runtime/actors/actor-routed-join-transport.d.ts +9 -3
- package/dist/runtime/actors/actor-routed-json-request.d.ts +3 -0
- package/dist/runtime/actors/actor-runtime-contracts.d.ts +2 -2
- package/dist/runtime/actors/actor-runtime-state.d.ts +1 -1
- package/dist/runtime/actors/spot-actor-dispatch.d.ts +9 -5
- package/dist/runtime/actors/spot-actor-dispatch.js +60 -38
- package/dist/runtime/admission.d.ts +6 -4
- package/dist/runtime/admission.js +21 -10
- package/dist/runtime/application-jobs/application-ingress-record-owner.d.ts +1 -0
- package/dist/runtime/application-jobs/application-ingress-record-owner.js +3 -0
- package/dist/runtime/backend/contracts/index.d.ts +26 -10
- package/dist/runtime/backend/mesh-completion-table.d.ts +7 -1
- package/dist/runtime/backend/mesh-completion-table.js +84 -20
- package/dist/runtime/backend/mesh-dispatch-pump.d.ts +19 -6
- package/dist/runtime/backend/mesh-dispatch-pump.js +246 -147
- package/dist/runtime/backend/node/node-backend-adapter-support.d.ts +3 -2
- package/dist/runtime/backend/node/node-backend-adapter-support.js +27 -19
- package/dist/runtime/backend/node/node-dealer-channel-client-transport.d.ts +5 -2
- package/dist/runtime/backend/node/node-dealer-channel-client-transport.js +70 -13
- package/dist/runtime/backend/node/node-event-loop-poller.d.ts +2 -2
- package/dist/runtime/backend/node/node-event-loop-poller.js +4 -3
- package/dist/runtime/backend/node/node-mesh-backend-adapter.js +5 -1
- package/dist/runtime/backend/node/node-raw-binding-port.d.ts +7 -2
- package/dist/runtime/backend/node/node-raw-binding-port.js +99 -63
- package/dist/runtime/backend/node/node-raw-mesh-backend.d.ts +34 -16
- package/dist/runtime/backend/node/node-raw-mesh-backend.js +210 -106
- package/dist/runtime/backend/node/node-socket-backend-adapter.js +20 -6
- package/dist/runtime/backend/raw-binding-port.d.ts +6 -3
- package/dist/runtime/channels/channel-clients.js +3 -3
- package/dist/runtime/channels/channel-dispatch-pipeline.d.ts +11 -7
- package/dist/runtime/channels/channel-dispatch-pipeline.js +40 -22
- package/dist/runtime/channels/channel-dispatch-services.d.ts +3 -1
- package/dist/runtime/channels/channel-dispatch-services.js +7 -6
- package/dist/runtime/channels/channel-dispatchers.d.ts +13 -6
- package/dist/runtime/channels/channel-dispatchers.js +57 -36
- package/dist/runtime/channels/channel-envelope.d.ts +2 -2
- package/dist/runtime/channels/channel-envelope.js +609 -83
- package/dist/runtime/channels/channel-multipart.d.ts +1 -0
- package/dist/runtime/channels/channel-multipart.js +10 -6
- package/dist/runtime/channels/channel-outbound-operations.d.ts +6 -9
- package/dist/runtime/channels/channel-outbound-operations.js +107 -105
- package/dist/runtime/channels/channel-receive-loops.d.ts +9 -7
- package/dist/runtime/channels/channel-receive-loops.js +126 -90
- package/dist/runtime/channels/channel-runtime-lifecycle.d.ts +23 -6
- package/dist/runtime/channels/channel-runtime-lifecycle.js +47 -38
- package/dist/runtime/channels/channel-runtime-manager.d.ts +13 -6
- package/dist/runtime/channels/channel-runtime-manager.js +32 -14
- package/dist/runtime/channels/channel-socket-registry.d.ts +28 -4
- package/dist/runtime/channels/channel-socket-registry.js +9 -1
- package/dist/runtime/channels/channel-transports.d.ts +23 -16
- package/dist/runtime/channels/channel-transports.js +139 -119
- package/dist/runtime/channels/dispatch-error-reporter.d.ts +4 -4
- package/dist/runtime/channels/dispatch-error-reporter.js +5 -5
- package/dist/runtime/channels/fanout-location-runtime.d.ts +1 -1
- package/dist/runtime/channels/local-spot-route-transport.d.ts +5 -2
- package/dist/runtime/channels/local-spot-route-transport.js +15 -18
- package/dist/runtime/channels/router-socket-spot-route-transport.d.ts +6 -3
- package/dist/runtime/channels/router-socket-spot-route-transport.js +33 -19
- package/dist/runtime/channels/source-spot-router.d.ts +6 -3
- package/dist/runtime/channels/source-spot-router.js +34 -23
- package/dist/runtime/channels/spot-node-route-transport.d.ts +6 -3
- package/dist/runtime/channels/spot-node-route-transport.js +23 -17
- package/dist/runtime/channels/spot-route-bridge-transport.d.ts +6 -3
- package/dist/runtime/channels/spot-route-bridge-transport.js +38 -24
- package/dist/runtime/channels/spot-route-dispatch-strategy.d.ts +8 -4
- package/dist/runtime/channels/spot-route-dispatch-strategy.js +36 -23
- package/dist/runtime/diagnostics/dispatch-error-details.js +9 -3
- package/dist/runtime/diagnostics/message-flow-bootstrap.d.ts +1 -0
- package/dist/runtime/diagnostics/message-flow-bootstrap.js +8 -0
- package/dist/runtime/diagnostics/message-flow-delivery.d.ts +47 -0
- package/dist/runtime/diagnostics/message-flow-delivery.js +149 -0
- package/dist/runtime/diagnostics/message-flow-record.d.ts +50 -0
- package/dist/runtime/diagnostics/message-flow-record.js +228 -0
- package/dist/runtime/diagnostics/message-flow-worker.d.ts +1 -0
- package/dist/runtime/diagnostics/message-flow-worker.js +118 -0
- package/dist/runtime/diagnostics/message-flow.d.ts +7 -19
- package/dist/runtime/diagnostics/message-flow.js +42 -290
- package/dist/runtime/diagnostics/runtime-metrics.d.ts +4 -3
- package/dist/runtime/diagnostics/runtime-metrics.js +8 -4
- package/dist/runtime/execution/index.d.ts +1 -0
- package/dist/runtime/execution/index.js +6 -3
- package/dist/runtime/execution/serial-execution-queue.d.ts +26 -13
- package/dist/runtime/execution/serial-execution-queue.js +75 -71
- package/dist/runtime/foundation/durable-service-request.d.ts +12 -3
- package/dist/runtime/foundation/durable-service-request.js +158 -73
- package/dist/runtime/foundation/operation-registry.d.ts +33 -3
- package/dist/runtime/foundation/operation-registry.js +272 -33
- package/dist/runtime/foundation/raw-service-mesh-runtime.d.ts +62 -23
- package/dist/runtime/foundation/raw-service-mesh-runtime.js +373 -194
- package/dist/runtime/foundation/request-runtime.d.ts +17 -0
- package/dist/runtime/foundation/request-runtime.js +163 -0
- package/dist/runtime/foundation/service-discovery-registry.d.ts +4 -0
- package/dist/runtime/foundation/service-discovery-registry.js +6 -0
- package/dist/runtime/foundation/service-liveness-registry.d.ts +1 -1
- package/dist/runtime/foundation/service-mailbox.d.ts +4 -2
- package/dist/runtime/foundation/service-mailbox.js +4 -1
- package/dist/runtime/foundation/service-relocation-object-owner.d.ts +2 -2
- package/dist/runtime/foundation/service-relocation-object-owner.js +12 -5
- package/dist/runtime/foundation/service-runtime-contracts.d.ts +7 -2
- package/dist/runtime/foundation/service-stateful-registry.d.ts +6 -2
- package/dist/runtime/foundation/service-stateful-registry.js +38 -17
- package/dist/runtime/foundation/service-stateful-runtime.d.ts +91 -26
- package/dist/runtime/foundation/service-stateful-runtime.js +245 -120
- package/dist/runtime/foundation/service-stateful-wire-codec.d.ts +3 -0
- package/dist/runtime/foundation/service-stateful-wire-codec.js +15 -0
- package/dist/runtime/foundation/service-topology-registry.d.ts +2 -0
- package/dist/runtime/foundation/service-topology-registry.js +13 -3
- package/dist/runtime/foundation/service-wire-constants.generated.d.ts +1 -0
- package/dist/runtime/foundation/service-wire-constants.generated.js +12 -0
- package/dist/runtime/foundation/service-wire-m6a-codec.d.ts +5 -1
- package/dist/runtime/foundation/service-wire-m6a-codec.js +50 -15
- package/dist/runtime/host/actor-packet-relay.d.ts +5 -6
- package/dist/runtime/host/actor-packet-relay.js +58 -57
- package/dist/runtime/host/actor-placement-coordinator.d.ts +1 -1
- package/dist/runtime/host/actor-runtime-options-factory.d.ts +2 -0
- package/dist/runtime/host/actor-runtime-options-factory.js +3 -2
- package/dist/runtime/host/actor-transfer-runtime.d.ts +3 -3
- package/dist/runtime/host/application-job-queue.d.ts +7 -5
- package/dist/runtime/host/application-job-queue.js +33 -21
- package/dist/runtime/host/bound-session-relay.js +0 -1
- package/dist/runtime/host/channel-runtime-options-factory.d.ts +2 -0
- package/dist/runtime/host/channel-runtime-options-factory.js +1 -0
- package/dist/runtime/host/entry-actor-runtime.d.ts +5 -2
- package/dist/runtime/host/entry-actor-runtime.js +2 -2
- package/dist/runtime/host/index.d.ts +106 -37
- package/dist/runtime/host/index.js +303 -151
- package/dist/runtime/host/location-runtime-owner.d.ts +2 -2
- package/dist/runtime/host/location-runtime-owner.js +1 -1
- package/dist/runtime/host/service-relocation-host-runtime.d.ts +195 -45
- package/dist/runtime/host/service-relocation-host-runtime.js +257 -144
- package/dist/runtime/host/spot-address-transport.d.ts +3 -0
- package/dist/runtime/host/spot-address-transport.js +73 -76
- package/dist/runtime/host/spot-runtime-options-factory.js +2 -0
- package/dist/runtime/host/user-spot-creation-coordinator.d.ts +3 -1
- package/dist/runtime/host/user-spot-creation-coordinator.js +49 -21
- package/dist/runtime/internal-observation.d.ts +1 -0
- package/dist/runtime/internal-observation.js +5 -0
- package/dist/runtime/locations/actor-location-claims.d.ts +1 -1
- package/dist/runtime/locations/actor-location-claims.js +15 -6
- package/dist/runtime/locations/auto-connect-loop.d.ts +0 -1
- package/dist/runtime/locations/auto-connect-loop.js +25 -19
- package/dist/runtime/locations/auto-connect-planner.js +2 -5
- package/dist/runtime/locations/auto-connect-reconciler.d.ts +1 -0
- package/dist/runtime/locations/auto-connect-reconciler.js +35 -23
- package/dist/runtime/locations/in-memory-authority-store.d.ts +1 -0
- package/dist/runtime/locations/in-memory-authority-store.js +15 -5
- package/dist/runtime/locations/in-memory-location-store.d.ts +0 -2
- package/dist/runtime/locations/in-memory-location-store.js +1 -38
- package/dist/runtime/locations/lifecycle.d.ts +1 -1
- package/dist/runtime/locations/lifecycle.js +2 -2
- package/dist/runtime/locations/location-store-repository.d.ts +0 -1
- package/dist/runtime/locations/location-store-repository.js +163 -246
- package/dist/runtime/locations/resolvers.d.ts +8 -1
- package/dist/runtime/locations/resolvers.js +16 -2
- package/dist/runtime/locations/runtime.d.ts +3 -3
- package/dist/runtime/locations/runtime.js +12 -16
- package/dist/runtime/messaging/creation-payload-codec.js +8 -7
- package/dist/runtime/messaging/framework-json-v1.d.ts +1 -1
- package/dist/runtime/messaging/framework-json-v1.js +6 -2
- package/dist/runtime/messaging/payload-codec.js +21 -35
- package/dist/runtime/messaging/request-deadline.d.ts +4 -2
- package/dist/runtime/messaging/request-deadline.js +40 -25
- package/dist/runtime/messaging/request-result.d.ts +14 -1
- package/dist/runtime/messaging/request-result.js +74 -13
- package/dist/runtime/protocol/service_wire_codec.generated.d.ts +4 -0
- package/dist/runtime/protocol/service_wire_codec.generated.js +17 -7
- package/dist/runtime/spots/index.d.ts +28 -7
- package/dist/runtime/spots/index.js +31 -6
- package/dist/runtime/spots/spot-activation-registry.d.ts +3 -2
- package/dist/runtime/spots/spot-activation-registry.js +13 -8
- package/dist/runtime/spots/spot-activation-state.d.ts +2 -0
- package/dist/runtime/spots/spot-activation-state.js +1 -0
- package/dist/runtime/spots/spot-actor-admission-coordinator.d.ts +9 -4
- package/dist/runtime/spots/spot-actor-admission-coordinator.js +33 -12
- package/dist/runtime/spots/spot-actor-ingress-admission.d.ts +40 -0
- package/dist/runtime/spots/spot-actor-ingress-admission.js +78 -0
- package/dist/runtime/spots/spot-actor-membership.js +3 -3
- package/dist/runtime/spots/spot-actor-packet-dispatch.d.ts +16 -43
- package/dist/runtime/spots/spot-actor-packet-dispatch.js +56 -113
- package/dist/runtime/spots/spot-actor-packet-drain.d.ts +1 -0
- package/dist/runtime/spots/spot-actor-packet-drain.js +12 -5
- package/dist/runtime/spots/spot-entry-activation.d.ts +4 -3
- package/dist/runtime/spots/spot-entry-activation.js +7 -12
- package/dist/runtime/spots/spot-handler-registry.d.ts +5 -1
- package/dist/runtime/spots/spot-handler-registry.js +31 -15
- package/dist/runtime/spots/spot-manager-public.js +3 -2
- package/dist/runtime/spots/spot-node-runtime-manager.d.ts +11 -6
- package/dist/runtime/spots/spot-node-runtime-manager.js +6 -1
- package/dist/runtime/spots/spot-outbound.d.ts +8 -2
- package/dist/runtime/spots/spot-outbound.js +5 -5
- package/dist/runtime/spots/spot-route-packet-dispatch.js +13 -8
- package/dist/runtime/spots/spot-routed-spot-packet-dispatch.d.ts +3 -3
- package/dist/runtime/spots/spot-routed-spot-packet-dispatch.js +9 -5
- package/dist/runtime/spots/spot-runtime-ports.d.ts +2 -2
- package/dist/runtime/spots/spot-serial-executor.d.ts +2 -1
- package/dist/runtime/spots/spot-serial-turn-executor.js +20 -26
- package/dist/runtime/spots/spot-subscription-dispatch.js +5 -2
- package/dist/runtime/spots/spot-timer.d.ts +1 -1
- package/dist/runtime/streams/actor-session-binding-registry.d.ts +11 -3
- package/dist/runtime/streams/actor-session-binding-registry.js +28 -0
- package/dist/runtime/streams/bound-actor-relay-sender.d.ts +2 -2
- package/dist/runtime/streams/bound-actor-relay-sender.js +3 -4
- package/dist/runtime/streams/bound-session-service.js +6 -7
- package/dist/runtime/streams/index.d.ts +3 -3
- package/dist/runtime/streams/index.js +22 -2
- package/dist/runtime/streams/managed-stream.js +2 -1
- package/dist/runtime/streams/session-calls.d.ts +1 -1
- package/dist/runtime/streams/session-calls.js +3 -9
- package/dist/runtime/streams/session-context.d.ts +2 -2
- package/dist/runtime/streams/session-context.js +2 -2
- package/dist/runtime/streams/stream-session-runtime.d.ts +1 -0
- package/dist/runtime/streams/stream-session-runtime.js +64 -33
- package/package.json +3 -3
- package/src/contracts/Actors/ZLinkActor.ts +6 -0
- package/src/contracts/Actors/ZLinkSessionBindingIdentity.ts +7 -0
- package/src/contracts/Actors/index.ts +1 -0
- package/src/contracts/Common/CoreTypes.ts +1 -0
- package/src/contracts/Common/HandlerMessageType.ts +50 -0
- package/src/contracts/Common/ZLinkEncodedPayload.ts +13 -25
- package/src/contracts/Common/ZLinkMessage.ts +11 -7
- package/src/contracts/Common/encoded-payload-storage.ts +4 -16
- package/src/contracts/Common/index.ts +1 -1
- package/src/contracts/Common/payload-slab.ts +29 -0
- package/src/contracts/Configuration/RegistrationBuilders.ts +29 -15
- package/src/contracts/Configuration/RegistrationTypes.ts +19 -0
- package/src/contracts/Handlers/Contexts.ts +1 -0
- package/src/contracts/Locations/Authority.ts +7 -1
- package/src/internal.ts +17 -0
- package/src/nest-integration.ts +1 -0
- package/src/runtime/actors/actor-client.ts +257 -163
- package/src/runtime/actors/actor-context.ts +26 -14
- package/src/runtime/actors/actor-execution-context.ts +2 -2
- package/src/runtime/actors/actor-handoff.ts +86 -51
- package/src/runtime/actors/actor-join-deferred-scope.ts +6 -6
- package/src/runtime/actors/actor-local-native-join.ts +38 -17
- package/src/runtime/actors/actor-mailbox.ts +1 -1
- package/src/runtime/actors/actor-remote-joiner.ts +8 -4
- package/src/runtime/actors/actor-routed-join-transport.ts +13 -5
- package/src/runtime/actors/actor-routed-json-request.ts +3 -0
- package/src/runtime/actors/actor-runtime-contracts.ts +4 -2
- package/src/runtime/actors/actor-runtime-state.ts +1 -1
- package/src/runtime/actors/spot-actor-dispatch.ts +70 -68
- package/src/runtime/admission.ts +42 -15
- package/src/runtime/application-jobs/application-ingress-record-owner.ts +4 -0
- package/src/runtime/backend/contracts/index.ts +77 -10
- package/src/runtime/backend/mesh-completion-table.ts +106 -15
- package/src/runtime/backend/mesh-dispatch-pump.ts +294 -146
- package/src/runtime/backend/node/node-backend-adapter-support.ts +42 -32
- package/src/runtime/backend/node/node-dealer-channel-client-transport.ts +91 -34
- package/src/runtime/backend/node/node-event-loop-poller.ts +14 -5
- package/src/runtime/backend/node/node-mesh-backend-adapter.ts +5 -1
- package/src/runtime/backend/node/node-raw-binding-port.ts +180 -69
- package/src/runtime/backend/node/node-raw-mesh-backend.ts +386 -157
- package/src/runtime/backend/node/node-socket-backend-adapter.ts +56 -11
- package/src/runtime/backend/raw-binding-port.ts +13 -5
- package/src/runtime/channels/channel-clients.ts +26 -11
- package/src/runtime/channels/channel-dispatch-pipeline.ts +77 -65
- package/src/runtime/channels/channel-dispatch-services.ts +7 -12
- package/src/runtime/channels/channel-dispatchers.ts +93 -39
- package/src/runtime/channels/channel-envelope.ts +680 -144
- package/src/runtime/channels/channel-multipart.ts +17 -13
- package/src/runtime/channels/channel-outbound-operations.ts +204 -178
- package/src/runtime/channels/channel-receive-loops.ts +160 -107
- package/src/runtime/channels/channel-runtime-lifecycle.ts +64 -59
- package/src/runtime/channels/channel-runtime-manager.ts +74 -27
- package/src/runtime/channels/channel-socket-registry.ts +20 -5
- package/src/runtime/channels/channel-transports.ts +414 -287
- package/src/runtime/channels/dispatch-error-reporter.ts +4 -9
- package/src/runtime/channels/local-spot-route-transport.ts +27 -29
- package/src/runtime/channels/router-socket-spot-route-transport.ts +63 -32
- package/src/runtime/channels/source-spot-router.ts +75 -38
- package/src/runtime/channels/spot-node-route-transport.ts +67 -37
- package/src/runtime/channels/spot-route-bridge-transport.ts +62 -30
- package/src/runtime/channels/spot-route-dispatch-strategy.ts +105 -34
- package/src/runtime/diagnostics/dispatch-error-details.ts +10 -2
- package/src/runtime/diagnostics/message-flow-bootstrap.ts +6 -0
- package/src/runtime/diagnostics/message-flow-delivery.ts +171 -0
- package/src/runtime/diagnostics/message-flow-record.ts +295 -0
- package/src/runtime/diagnostics/message-flow-worker.ts +146 -0
- package/src/runtime/diagnostics/message-flow.ts +49 -362
- package/src/runtime/diagnostics/runtime-metrics.ts +10 -4
- package/src/runtime/execution/index.ts +6 -0
- package/src/runtime/execution/serial-execution-queue.ts +94 -96
- package/src/runtime/foundation/durable-service-request.ts +212 -89
- package/src/runtime/foundation/operation-registry.ts +287 -38
- package/src/runtime/foundation/raw-service-mesh-runtime.ts +617 -292
- package/src/runtime/foundation/request-runtime.ts +227 -0
- package/src/runtime/foundation/service-discovery-registry.ts +7 -0
- package/src/runtime/foundation/service-liveness-registry.ts +1 -1
- package/src/runtime/foundation/service-mailbox.ts +7 -2
- package/src/runtime/foundation/service-relocation-object-owner.ts +21 -6
- package/src/runtime/foundation/service-runtime-contracts.ts +12 -2
- package/src/runtime/foundation/service-stateful-registry.ts +52 -19
- package/src/runtime/foundation/service-stateful-runtime.ts +365 -198
- package/src/runtime/foundation/service-stateful-wire-codec.ts +18 -0
- package/src/runtime/foundation/service-topology-registry.ts +21 -3
- package/src/runtime/foundation/service-wire-constants.generated.ts +10 -0
- package/src/runtime/foundation/service-wire-m6a-codec.ts +69 -17
- package/src/runtime/host/actor-packet-relay.ts +160 -156
- package/src/runtime/host/actor-placement-coordinator.ts +1 -1
- package/src/runtime/host/actor-runtime-options-factory.ts +7 -2
- package/src/runtime/host/actor-transfer-runtime.ts +3 -3
- package/src/runtime/host/application-job-queue.ts +56 -27
- package/src/runtime/host/bound-session-relay.ts +0 -1
- package/src/runtime/host/channel-runtime-options-factory.ts +3 -0
- package/src/runtime/host/entry-actor-runtime.ts +14 -6
- package/src/runtime/host/index.ts +388 -113
- package/src/runtime/host/location-runtime-owner.ts +3 -3
- package/src/runtime/host/service-relocation-host-runtime.ts +380 -252
- package/src/runtime/host/spot-address-transport.ts +110 -95
- package/src/runtime/host/spot-runtime-options-factory.ts +3 -0
- package/src/runtime/host/user-spot-creation-coordinator.ts +69 -22
- package/src/runtime/internal-observation.ts +2 -0
- package/src/runtime/locations/actor-location-claims.ts +42 -16
- package/src/runtime/locations/auto-connect-loop.ts +24 -16
- package/src/runtime/locations/auto-connect-planner.ts +2 -5
- package/src/runtime/locations/auto-connect-reconciler.ts +37 -24
- package/src/runtime/locations/in-memory-authority-store.ts +27 -7
- package/src/runtime/locations/in-memory-location-store.ts +1 -74
- package/src/runtime/locations/lifecycle.ts +4 -2
- package/src/runtime/locations/location-store-repository.ts +228 -308
- package/src/runtime/locations/resolvers.ts +20 -8
- package/src/runtime/locations/runtime.ts +16 -28
- package/src/runtime/messaging/creation-payload-codec.ts +12 -10
- package/src/runtime/messaging/framework-json-v1.ts +10 -1
- package/src/runtime/messaging/payload-codec.ts +50 -75
- package/src/runtime/messaging/request-deadline.ts +47 -39
- package/src/runtime/messaging/request-result.ts +88 -17
- package/src/runtime/protocol/service_wire_codec.generated.ts +18 -8
- package/src/runtime/protocol/service_wire_pilot_codec.generated.ts +1 -1
- package/src/runtime/spots/index.ts +57 -10
- package/src/runtime/spots/spot-activation-registry.ts +12 -8
- package/src/runtime/spots/spot-activation-state.ts +2 -0
- package/src/runtime/spots/spot-actor-admission-coordinator.ts +62 -37
- package/src/runtime/spots/spot-actor-ingress-admission.ts +157 -0
- package/src/runtime/spots/spot-actor-membership.ts +8 -5
- package/src/runtime/spots/spot-actor-packet-dispatch.ts +122 -206
- package/src/runtime/spots/spot-actor-packet-drain.ts +21 -6
- package/src/runtime/spots/spot-entry-activation.ts +25 -35
- package/src/runtime/spots/spot-handler-registry.ts +72 -15
- package/src/runtime/spots/spot-manager-public.ts +4 -2
- package/src/runtime/spots/spot-node-runtime-manager.ts +16 -7
- package/src/runtime/spots/spot-outbound.ts +26 -10
- package/src/runtime/spots/spot-route-packet-dispatch.ts +18 -8
- package/src/runtime/spots/spot-routed-spot-packet-dispatch.ts +14 -8
- package/src/runtime/spots/spot-runtime-ports.ts +5 -2
- package/src/runtime/spots/spot-serial-executor.ts +1 -1
- package/src/runtime/spots/spot-serial-turn-executor.ts +25 -40
- package/src/runtime/spots/spot-subscription-dispatch.ts +9 -2
- package/src/runtime/spots/spot-timer.ts +1 -1
- package/src/runtime/streams/actor-session-binding-registry.ts +46 -3
- package/src/runtime/streams/bound-actor-relay-sender.ts +16 -5
- package/src/runtime/streams/bound-session-service.ts +10 -7
- package/src/runtime/streams/index.ts +30 -4
- package/src/runtime/streams/managed-stream.ts +2 -1
- package/src/runtime/streams/session-calls.ts +9 -14
- package/src/runtime/streams/session-context.ts +6 -11
- package/src/runtime/streams/stream-session-runtime.ts +79 -40
- package/dist/runtime/spots/spot-lifecycle-metrics.d.ts +0 -8
- package/dist/runtime/spots/spot-lifecycle-metrics.js +0 -17
- package/src/runtime/spots/spot-lifecycle-metrics.ts +0 -16
|
@@ -5,6 +5,7 @@ exports.decodeQueuedHandoffPacket = decodeQueuedHandoffPacket;
|
|
|
5
5
|
exports.createServiceRelocationId = createServiceRelocationId;
|
|
6
6
|
exports.relocationFailedFailureCode = relocationFailedFailureCode;
|
|
7
7
|
exports.encodeHandoffQueuedMessages = encodeHandoffQueuedMessages;
|
|
8
|
+
const internal_observation_1 = require("../internal-observation");
|
|
8
9
|
const actor_reply_1 = require("../actors/actor-reply");
|
|
9
10
|
const protocol_1 = require("../streams/protocol");
|
|
10
11
|
const service_wire_m6a_codec_1 = require("../foundation/service-wire-m6a-codec");
|
|
@@ -24,6 +25,7 @@ const runtime_values_1 = require("../backend/runtime-values");
|
|
|
24
25
|
const diagnostics_1 = require("../diagnostics");
|
|
25
26
|
const runtime_metrics_1 = require("../diagnostics/runtime-metrics");
|
|
26
27
|
const message_flow_1 = require("../diagnostics/message-flow");
|
|
28
|
+
const flow_context_1 = require("../diagnostics/flow-context");
|
|
27
29
|
const dispatch_error_details_1 = require("../diagnostics/dispatch-error-details");
|
|
28
30
|
const state_lane_1 = require("../execution/state-lane");
|
|
29
31
|
const actor_join_recovery_codec_1 = require("../foundation/actor-join-recovery-codec");
|
|
@@ -71,6 +73,23 @@ const INITIAL_MEMBERSHIP_EPOCH = 1n;
|
|
|
71
73
|
/** Production host bridge from Retire inventory to remote RouteMesh owners. */
|
|
72
74
|
class ZLinkHostServiceRelocationRuntime {
|
|
73
75
|
options;
|
|
76
|
+
[internal_observation_1.inspectRuntime]() {
|
|
77
|
+
const sourceWindow = this.sourceCutoverWindows.values().next().value;
|
|
78
|
+
return Object.freeze({
|
|
79
|
+
targetStages: this.targetStages.size,
|
|
80
|
+
targetAssemblies: this.targetAssemblies.size,
|
|
81
|
+
pendingReplyRelays: this.pendingReplyRelays.size,
|
|
82
|
+
sourceActorJoinProfiles: this.sourceActorJoinProfiles.size,
|
|
83
|
+
sourceCutoverWindow: sourceWindow === undefined
|
|
84
|
+
? undefined
|
|
85
|
+
: Object.freeze({
|
|
86
|
+
get frameCount() {
|
|
87
|
+
return sourceWindow.frames?.length;
|
|
88
|
+
}
|
|
89
|
+
}),
|
|
90
|
+
terminalTargets: [...this.terminalTargets].length
|
|
91
|
+
});
|
|
92
|
+
}
|
|
74
93
|
targetStages = new Map();
|
|
75
94
|
terminalTargets = new bounded_replay_map_1.BoundedReplayMap(RELOCATION_TARGET_TOMBSTONE_LIMIT);
|
|
76
95
|
targetPrepareOperations = new Map();
|
|
@@ -1132,8 +1151,9 @@ class ZLinkHostServiceRelocationRuntime {
|
|
|
1132
1151
|
? failures[0]
|
|
1133
1152
|
: new AggregateError(failures, 'Spot source retirement failed.');
|
|
1134
1153
|
},
|
|
1135
|
-
abortSeal: async () => {
|
|
1154
|
+
abortSeal: async (onCleanupError) => {
|
|
1136
1155
|
const failures = [];
|
|
1156
|
+
const cleanupFailures = [];
|
|
1137
1157
|
if (spotCapture !== undefined) {
|
|
1138
1158
|
// Spot model §5.1: Continued completes while the source seal still holds jobs.
|
|
1139
1159
|
if (readinessBoundaryConsumed) {
|
|
@@ -1141,11 +1161,13 @@ class ZLinkHostServiceRelocationRuntime {
|
|
|
1141
1161
|
await activation.completeConsumedRelocationBoundary(contracts_1.ZLinkSpotRelocationReadyOutcome.Continued);
|
|
1142
1162
|
}
|
|
1143
1163
|
catch (error) {
|
|
1144
|
-
|
|
1164
|
+
cleanupFailures.push(error);
|
|
1145
1165
|
}
|
|
1146
1166
|
}
|
|
1147
1167
|
try {
|
|
1148
|
-
activation.abortRelocation(spotCapture)
|
|
1168
|
+
if (!activation.abortRelocation(spotCapture)) {
|
|
1169
|
+
throw new Error(`Spot '${String(activation.spotId)}' relocation seal became stale.`);
|
|
1170
|
+
}
|
|
1149
1171
|
}
|
|
1150
1172
|
catch (error) {
|
|
1151
1173
|
failures.push(error);
|
|
@@ -1160,7 +1182,7 @@ class ZLinkHostServiceRelocationRuntime {
|
|
|
1160
1182
|
}
|
|
1161
1183
|
}
|
|
1162
1184
|
catch (error) {
|
|
1163
|
-
|
|
1185
|
+
cleanupFailures.push(error);
|
|
1164
1186
|
}
|
|
1165
1187
|
}
|
|
1166
1188
|
for (const session of [...sessions].reverse()) {
|
|
@@ -1172,7 +1194,13 @@ class ZLinkHostServiceRelocationRuntime {
|
|
|
1172
1194
|
}
|
|
1173
1195
|
}
|
|
1174
1196
|
if (failures.length !== 0) {
|
|
1175
|
-
throw new AggregateError(failures, 'Spot relocation source rollback was incomplete.');
|
|
1197
|
+
throw new AggregateError([...failures, ...cleanupFailures], 'Spot relocation source rollback was incomplete.');
|
|
1198
|
+
}
|
|
1199
|
+
if (cleanupFailures.length !== 0) {
|
|
1200
|
+
const cleanup = new AggregateError(cleanupFailures, 'Spot relocation source rollback was incomplete.');
|
|
1201
|
+
if (onCleanupError === undefined)
|
|
1202
|
+
throw cleanup;
|
|
1203
|
+
onCleanupError(cleanup);
|
|
1176
1204
|
}
|
|
1177
1205
|
}
|
|
1178
1206
|
};
|
|
@@ -1185,7 +1213,7 @@ class ZLinkHostServiceRelocationRuntime {
|
|
|
1185
1213
|
}));
|
|
1186
1214
|
const relocationMetric = spotRegistration.relocation.kind === 'disabled'
|
|
1187
1215
|
? undefined
|
|
1188
|
-
: this.
|
|
1216
|
+
: this.startSourceRelocationMetric(meshName, kind, spotRegistration.relocation.kind);
|
|
1189
1217
|
try {
|
|
1190
1218
|
const waitForRelocationBoundary = activation.waitForRelocationBoundary;
|
|
1191
1219
|
readinessBoundaryConsumed =
|
|
@@ -1261,7 +1289,7 @@ class ZLinkHostServiceRelocationRuntime {
|
|
|
1261
1289
|
};
|
|
1262
1290
|
const relocationMetric = actorPolicy === 'disabled'
|
|
1263
1291
|
? undefined
|
|
1264
|
-
: this.
|
|
1292
|
+
: this.startSourceRelocationMetric(meshName, 'actor', actorPolicy, state.actorId);
|
|
1265
1293
|
try {
|
|
1266
1294
|
if ((0, diagnostics_1.isRelocationDebugEnabled)()) {
|
|
1267
1295
|
(0, diagnostics_1.relocationDebug)('standalone_actor.wait_budget', {
|
|
@@ -1340,14 +1368,22 @@ class ZLinkHostServiceRelocationRuntime {
|
|
|
1340
1368
|
}
|
|
1341
1369
|
await this.requireSpotManager().completeRelocationSource(activation);
|
|
1342
1370
|
},
|
|
1343
|
-
abortSeal: async () => {
|
|
1344
|
-
if (spotCapture !== undefined)
|
|
1345
|
-
activation.
|
|
1371
|
+
abortSeal: async (onCleanupError) => {
|
|
1372
|
+
if (spotCapture !== undefined && !activation.abortRelocation(spotCapture)) {
|
|
1373
|
+
throw new Error(`PerActor Spot '${String(activation.spotId)}' relocation seal became stale.`);
|
|
1374
|
+
}
|
|
1346
1375
|
if (spotMessageFollowSeal !== undefined) {
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1376
|
+
try {
|
|
1377
|
+
const node = this.requireMeshNode(meshName);
|
|
1378
|
+
const abort = node.abortSpotMessageFollowIngress;
|
|
1379
|
+
if (abort === undefined || !abort.call(node, spotMessageFollowSeal)) {
|
|
1380
|
+
throw new Error('Spot Message Follow abort fence became stale.');
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
catch (error) {
|
|
1384
|
+
if (onCleanupError === undefined)
|
|
1385
|
+
throw error;
|
|
1386
|
+
onCleanupError(error);
|
|
1351
1387
|
}
|
|
1352
1388
|
}
|
|
1353
1389
|
}
|
|
@@ -1355,7 +1391,7 @@ class ZLinkHostServiceRelocationRuntime {
|
|
|
1355
1391
|
const aggregateId = this.reserveRelocationId();
|
|
1356
1392
|
const relocationMetric = spotRegistration.relocation.kind === 'disabled'
|
|
1357
1393
|
? undefined
|
|
1358
|
-
: this.
|
|
1394
|
+
: this.startSourceRelocationMetric(meshName, 'user_spot', spotRegistration.relocation.kind);
|
|
1359
1395
|
try {
|
|
1360
1396
|
await this.waitForRelocationBudgetHeadroom(String(target.rid), signal);
|
|
1361
1397
|
const captured = await new service_relocation_object_owner_1.ServiceRelocationObjectCaptureOwner().captureUserSpotAggregate(aggregateId, 1n, spotUnit, [], [], signal);
|
|
@@ -1530,112 +1566,151 @@ class ZLinkHostServiceRelocationRuntime {
|
|
|
1530
1566
|
// configured limit unchanged (spec 15 §4.2).
|
|
1531
1567
|
const chunkLimitBytes = (0, relocation_direct_transfer_1.effectiveActorJoinChunkLimitBytes)(limits.relocationPayloadChunkLimitBytes, advertisedReceiveChunkLimitBytes);
|
|
1532
1568
|
const plan = (0, relocation_direct_transfer_1.planRelocationChunks)(encoded, chunkLimitBytes);
|
|
1533
|
-
// The Restore absolute deadline
|
|
1534
|
-
//
|
|
1535
|
-
//
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
let
|
|
1539
|
-
let
|
|
1569
|
+
// The unit's original Restore absolute deadline authorizes the source
|
|
1570
|
+
// Preserve fence (Location runtime §10). Caller cancellation cannot
|
|
1571
|
+
// advance that deadline. The target keeps no deadline of its own.
|
|
1572
|
+
const restoreDeadlineReached = () => performance.now() >= controlDeadlineAtMs;
|
|
1573
|
+
let settlement = 'source';
|
|
1574
|
+
let failure;
|
|
1575
|
+
let window;
|
|
1540
1576
|
try {
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1577
|
+
try {
|
|
1578
|
+
const prepare = {
|
|
1579
|
+
kind: 'prepare',
|
|
1580
|
+
relocation,
|
|
1581
|
+
targetAttemptGeneration,
|
|
1582
|
+
coordinator,
|
|
1583
|
+
target: targetFence,
|
|
1584
|
+
initiatorRole: 'source',
|
|
1585
|
+
object,
|
|
1586
|
+
sourceNodeRid: coordinator.nodeRid,
|
|
1587
|
+
sourceNodeGeneration: coordinator.nodeGeneration,
|
|
1588
|
+
payloadTotalLength: BigInt(plan.totalLength),
|
|
1589
|
+
payloadChunkCount: plan.chunkCount,
|
|
1590
|
+
payloadChecksumCrc32c: plan.checksumCrc32c,
|
|
1591
|
+
applicationVersion: target.applicationVersion,
|
|
1592
|
+
deadlineUnixMs: BigInt(Date.now() + Math.max(0, Math.ceil(controlDeadlineAtMs - performance.now())))
|
|
1593
|
+
};
|
|
1594
|
+
// Start the Restore request first (it also registers the temporary
|
|
1595
|
+
// queue and the assembly on the target), then stream the payload chunks
|
|
1596
|
+
// on the same ordered connection. The Ready reply arrives only after
|
|
1597
|
+
// the target assembled, verified, and restored the payload.
|
|
1598
|
+
const ready = await this.sendControl(meshName, target.rid, prepare, signal, controlDeadlineAtMs, async (attemptSignal) => {
|
|
1599
|
+
settlement = undefined;
|
|
1600
|
+
if ((0, diagnostics_1.isRelocationDebugEnabled)())
|
|
1601
|
+
(0, diagnostics_1.relocationDebug)('coordinator.state_transfer_begin', {
|
|
1602
|
+
aggregateId: captured.envelope.aggregateId
|
|
1603
|
+
});
|
|
1604
|
+
await this.sendRelocationStateChunks(meshName, target, prepare, encoded, plan, attemptSignal);
|
|
1605
|
+
if ((0, diagnostics_1.isRelocationDebugEnabled)())
|
|
1606
|
+
(0, diagnostics_1.relocationDebug)('coordinator.await_ready', {
|
|
1607
|
+
aggregateId: captured.envelope.aggregateId
|
|
1608
|
+
});
|
|
1609
|
+
});
|
|
1610
|
+
if (ready.kind === 'failed') {
|
|
1611
|
+
settlement = 'source';
|
|
1612
|
+
throw relocationFailureException(ready);
|
|
1613
|
+
}
|
|
1614
|
+
validateControlResponse(prepare, ready);
|
|
1615
|
+
if ((0, diagnostics_1.isRelocationDebugEnabled)()) {
|
|
1616
|
+
(0, diagnostics_1.relocationDebug)('coordinator.ready_received', {
|
|
1569
1617
|
aggregateId: captured.envelope.aggregateId
|
|
1570
1618
|
});
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1619
|
+
}
|
|
1620
|
+
actorJoinProfile?.relayReady();
|
|
1621
|
+
const boundaryBatch = [];
|
|
1622
|
+
for (const session of sessions) {
|
|
1623
|
+
const participant = captured.envelope.participants.find((value) => value.objectKind === 'actor' &&
|
|
1624
|
+
(0, authority_key_codec_1.decodeAuthorityKey)({ value: value.key }).globalId ===
|
|
1625
|
+
session.state.actorId);
|
|
1626
|
+
if (participant === undefined) {
|
|
1627
|
+
throw new Error(`Relocation Actor '${session.state.actorId}' is missing from its envelope.`);
|
|
1628
|
+
}
|
|
1629
|
+
for (const packet of session.prepared.takeRelocationRelay()) {
|
|
1630
|
+
const frozenRecord = canonicalRelayFrozenRecord(participant, packet, coordinator, targetFence);
|
|
1631
|
+
const data = {
|
|
1632
|
+
kind: 'data',
|
|
1633
|
+
relocation,
|
|
1634
|
+
targetAttemptGeneration,
|
|
1635
|
+
coordinator,
|
|
1636
|
+
senderRole: 'source',
|
|
1637
|
+
object: relocationObjectForParticipant(participant),
|
|
1638
|
+
frozenRecord
|
|
1639
|
+
};
|
|
1640
|
+
boundaryBatch.push({
|
|
1641
|
+
frame: (0, service_relocation_control_1.encodeServiceRelocationControlRequest)(data),
|
|
1642
|
+
canonicalBytes: frozenRecord.canonicalBytes
|
|
1643
|
+
});
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
const cutoverFrame = (0, service_relocation_control_1.encodeServiceRelocationControlRequest)({
|
|
1647
|
+
kind: 'cutover',
|
|
1648
|
+
relocation,
|
|
1649
|
+
targetAttemptGeneration,
|
|
1650
|
+
coordinator,
|
|
1651
|
+
senderRole: 'source',
|
|
1652
|
+
object,
|
|
1653
|
+
boundaryRecordCount: BigInt(boundaryBatch.length),
|
|
1654
|
+
boundaryChecksumCrc32c: (0, service_relocation_runtime_1.crc32c)(Buffer.concat(boundaryBatch.map((value) => value.canonicalBytes)))
|
|
1575
1655
|
});
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
const participant = captured.envelope.participants.find((value) => value.objectKind === 'actor' &&
|
|
1586
|
-
(0, authority_key_codec_1.decodeAuthorityKey)({ value: value.key }).globalId ===
|
|
1587
|
-
session.state.actorId);
|
|
1588
|
-
if (participant === undefined) {
|
|
1589
|
-
throw new Error(`Relocation Actor '${session.state.actorId}' is missing from its envelope.`);
|
|
1656
|
+
// The cutover submit result is not the authority result. The memory
|
|
1657
|
+
// copy of the boundary batch and cutover stays until the authority
|
|
1658
|
+
// settlement below (spec 28 §4.4).
|
|
1659
|
+
const submittedRouteGeneration = this.requireMeshNode(meshName).observePeerRoute?.(target.rid).generation;
|
|
1660
|
+
try {
|
|
1661
|
+
for (const record of boundaryBatch) {
|
|
1662
|
+
await this.submitControlFrame(meshName, target.rid, record.frame, 'relay');
|
|
1663
|
+
}
|
|
1664
|
+
await this.submitControlFrame(meshName, target.rid, cutoverFrame, 'cutover');
|
|
1590
1665
|
}
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
relocation,
|
|
1596
|
-
targetAttemptGeneration,
|
|
1597
|
-
coordinator,
|
|
1598
|
-
senderRole: 'source',
|
|
1599
|
-
object: relocationObjectForParticipant(participant),
|
|
1600
|
-
frozenRecord
|
|
1601
|
-
};
|
|
1602
|
-
boundaryBatch.push({
|
|
1603
|
-
frame: (0, service_relocation_control_1.encodeServiceRelocationControlRequest)(data),
|
|
1604
|
-
canonicalBytes: frozenRecord.canonicalBytes
|
|
1605
|
-
});
|
|
1666
|
+
catch (error) {
|
|
1667
|
+
if (!(0, durable_service_request_1.durableRequestCanReplay)(error))
|
|
1668
|
+
throw error;
|
|
1669
|
+
console.warn('[zlink.runtime.relocation.cutover_submit_failed]', relayAuthorityId, error);
|
|
1606
1670
|
}
|
|
1671
|
+
window = this.beginSourceCutoverWindow(meshName, target.rid, relayAuthorityId, [...boundaryBatch.map((value) => value.frame), cutoverFrame], submittedRouteGeneration, limits);
|
|
1672
|
+
}
|
|
1673
|
+
catch (error) {
|
|
1674
|
+
failure = { error };
|
|
1607
1675
|
}
|
|
1608
|
-
const cutoverFrame = (0, service_relocation_control_1.encodeServiceRelocationControlRequest)({
|
|
1609
|
-
kind: 'cutover',
|
|
1610
|
-
relocation,
|
|
1611
|
-
targetAttemptGeneration,
|
|
1612
|
-
coordinator,
|
|
1613
|
-
senderRole: 'source',
|
|
1614
|
-
object,
|
|
1615
|
-
boundaryRecordCount: BigInt(boundaryBatch.length),
|
|
1616
|
-
boundaryChecksumCrc32c: (0, service_relocation_runtime_1.crc32c)(Buffer.concat(boundaryBatch.map((value) => value.canonicalBytes)))
|
|
1617
|
-
});
|
|
1618
|
-
// The cutover submit result is not the authority result. The memory
|
|
1619
|
-
// copy of the boundary batch and cutover stays until the authority
|
|
1620
|
-
// settlement below (spec 28 §4.4).
|
|
1621
|
-
const submittedRouteGeneration = this.requireMeshNode(meshName).observePeerRoute?.(target.rid).generation;
|
|
1622
1676
|
try {
|
|
1623
|
-
|
|
1624
|
-
|
|
1677
|
+
try {
|
|
1678
|
+
if (settlement === undefined) {
|
|
1679
|
+
settlement = await this.settleSourceAuthority(captured.envelope, primary, targetFence, restoreDeadlineReached, window, relocationMetric);
|
|
1680
|
+
}
|
|
1681
|
+
else if (failure !== undefined) {
|
|
1682
|
+
// Restoration without authority settlement did not confirm Preserve.
|
|
1683
|
+
throw failure.error;
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
finally {
|
|
1687
|
+
if (settlement === 'source') {
|
|
1688
|
+
// Source restoration is authorized: captured queue, timers and held records
|
|
1689
|
+
// return in their accepted order, and source dispatch reopens.
|
|
1690
|
+
try {
|
|
1691
|
+
await captured.abortSource((error) => {
|
|
1692
|
+
failure ??= { error };
|
|
1693
|
+
});
|
|
1694
|
+
}
|
|
1695
|
+
catch (error) {
|
|
1696
|
+
throw failure === undefined ? error : failure.error;
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1625
1699
|
}
|
|
1626
|
-
|
|
1700
|
+
this.completeSourceRelocationMetric(relocationMetric, settlement);
|
|
1627
1701
|
}
|
|
1628
1702
|
catch (error) {
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
console.warn('[zlink.runtime.relocation.cutover_submit_failed]', relayAuthorityId, error);
|
|
1632
|
-
}
|
|
1633
|
-
const window = this.beginSourceCutoverWindow(meshName, target.rid, relayAuthorityId, [...boundaryBatch.map((value) => value.frame), cutoverFrame], submittedRouteGeneration, limits);
|
|
1634
|
-
try {
|
|
1635
|
-
settlement = await this.settleSourceAuthority(captured.envelope, primary, targetFence, restoreDeadlineReached, window, relocationMetric);
|
|
1703
|
+
failure = { error };
|
|
1704
|
+
throw error;
|
|
1636
1705
|
}
|
|
1637
1706
|
finally {
|
|
1638
|
-
|
|
1707
|
+
try {
|
|
1708
|
+
if (window !== undefined)
|
|
1709
|
+
this.closeSourceCutoverWindow(relayAuthorityId, window);
|
|
1710
|
+
}
|
|
1711
|
+
catch (error) {
|
|
1712
|
+
throw failure === undefined ? error : failure.error;
|
|
1713
|
+
}
|
|
1639
1714
|
}
|
|
1640
1715
|
if ((0, diagnostics_1.isRelocationDebugEnabled)()) {
|
|
1641
1716
|
(0, diagnostics_1.relocationDebug)('coordinator.authority_settled', {
|
|
@@ -1644,25 +1719,23 @@ class ZLinkHostServiceRelocationRuntime {
|
|
|
1644
1719
|
});
|
|
1645
1720
|
}
|
|
1646
1721
|
if (settlement === 'source') {
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
await captured.abortSource();
|
|
1650
|
-
this.completeSourceRelocationMetric(relocationMetric, settlement);
|
|
1722
|
+
if (failure !== undefined)
|
|
1723
|
+
throw failure.error;
|
|
1651
1724
|
throw new Error(`Relocation '${relayAuthorityId}' ended by the source Preserve fence; the source kept the authority.`);
|
|
1652
1725
|
}
|
|
1653
1726
|
if (settlement === 'lost') {
|
|
1654
|
-
this.completeSourceRelocationMetric(relocationMetric, settlement);
|
|
1655
1727
|
// Expired owner: dispatch and Store changes stop for good and every
|
|
1656
1728
|
// pending request without a terminal gets one Unavailable.
|
|
1657
1729
|
const unavailable = (0, framework_errors_internal_1.createInternalFrameworkException)(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.RouteNotConnected, `Relocation '${relayAuthorityId}' source authority ended (source owner lease expired, authority Missing, or owner changed).`, true);
|
|
1658
1730
|
await captured.discardSource(unavailable);
|
|
1659
1731
|
throw new service_relocation_coordinator_1.ServiceRelocationAuthorityError(unavailable.message, { cause: unavailable });
|
|
1660
1732
|
}
|
|
1661
|
-
this.completeSourceRelocationMetric(relocationMetric, settlement);
|
|
1662
1733
|
for (const session of sessions)
|
|
1663
1734
|
session.prepared.setReplayResults([]);
|
|
1664
1735
|
await captured.commitSource(settlement.followAuthorities);
|
|
1665
1736
|
await this.options.reconcileStatefulAuthorityRoutes?.(signal);
|
|
1737
|
+
if (failure !== undefined)
|
|
1738
|
+
throw failure.error;
|
|
1666
1739
|
}
|
|
1667
1740
|
catch (error) {
|
|
1668
1741
|
if (this.disposed &&
|
|
@@ -1680,11 +1753,6 @@ class ZLinkHostServiceRelocationRuntime {
|
|
|
1680
1753
|
}
|
|
1681
1754
|
finally {
|
|
1682
1755
|
this.completeSourceRelocationMetric(relocationMetric);
|
|
1683
|
-
if (!readyReceived) {
|
|
1684
|
-
// Only an explicit failure before the Ready reply becomes accepted
|
|
1685
|
-
// restores the source from the memory payload (spec 28 §9).
|
|
1686
|
-
await captured.abortSource().catch(() => undefined);
|
|
1687
|
-
}
|
|
1688
1756
|
}
|
|
1689
1757
|
}
|
|
1690
1758
|
completeSourceRelocationMetric(metric, settlement, sourceStopped = false) {
|
|
@@ -1698,6 +1766,41 @@ class ZLinkHostServiceRelocationRuntime {
|
|
|
1698
1766
|
? 'shutdown'
|
|
1699
1767
|
: 'failed');
|
|
1700
1768
|
}
|
|
1769
|
+
startSourceRelocationMetric(meshName, objectKind, policy, actorId) {
|
|
1770
|
+
const flow = objectKind === 'actor' ? this.options.messageFlow?.() : undefined;
|
|
1771
|
+
const flowContext = flow?.flowCreationEnabled() === true ? (0, flow_context_1.currentFlowContext)() : undefined;
|
|
1772
|
+
const traceTerminal = (outcome) => {
|
|
1773
|
+
if (flow === undefined || flowContext === undefined)
|
|
1774
|
+
return;
|
|
1775
|
+
const result = outcome === 'completed' ? 'succeeded' : outcome === 'shutdown' ? 'shutdown' : 'failed';
|
|
1776
|
+
(0, message_flow_1.flowIfEnabled)(flow, ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Completed, result, flowContext.flowId)?.trace({
|
|
1777
|
+
outcome: ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Completed,
|
|
1778
|
+
result,
|
|
1779
|
+
surface: ZLinkDispatchOptions_1.ZLinkDispatchErrorSurface.ActorRelocation,
|
|
1780
|
+
messageKind: ZLinkDispatchOptions_1.ZLinkDispatchMessageKind.Control,
|
|
1781
|
+
meshName,
|
|
1782
|
+
actorId,
|
|
1783
|
+
flowId: flowContext.flowId,
|
|
1784
|
+
flowOrigin: flowContext.flowOrigin,
|
|
1785
|
+
errorMessage: result === 'failed' ? `source_relocation_${outcome}` : undefined
|
|
1786
|
+
});
|
|
1787
|
+
};
|
|
1788
|
+
const metric = this.options.metrics?.startRelocation(meshName, objectKind, policy, traceTerminal);
|
|
1789
|
+
if (metric !== undefined)
|
|
1790
|
+
return metric;
|
|
1791
|
+
if (flow === undefined || flowContext === undefined)
|
|
1792
|
+
return undefined;
|
|
1793
|
+
let completed = false;
|
|
1794
|
+
return {
|
|
1795
|
+
recordBytes: () => { },
|
|
1796
|
+
complete: (outcome) => {
|
|
1797
|
+
if (completed)
|
|
1798
|
+
return;
|
|
1799
|
+
completed = true;
|
|
1800
|
+
traceTerminal(outcome);
|
|
1801
|
+
}
|
|
1802
|
+
};
|
|
1803
|
+
}
|
|
1701
1804
|
/** Streams the payload chunks of one stage under the effective in-flight budgets. */
|
|
1702
1805
|
async sendRelocationStateChunks(meshName, target, identity, encoded, plan, signal) {
|
|
1703
1806
|
for (let ordinal = 0; ordinal < plan.chunkCount; ordinal += 1) {
|
|
@@ -1825,7 +1928,7 @@ class ZLinkHostServiceRelocationRuntime {
|
|
|
1825
1928
|
}
|
|
1826
1929
|
}
|
|
1827
1930
|
/**
|
|
1828
|
-
* The one source authority settlement after
|
|
1931
|
+
* The one source authority settlement after request creation (Location runtime
|
|
1829
1932
|
* §6.1·§10, spec 28 §4.4). It reads the Store until the target commit or
|
|
1830
1933
|
* the Restore deadline. From the Restore deadline it runs the source
|
|
1831
1934
|
* Preserve fence: a CAS on the StoreVersion expected by target NewOwner
|
|
@@ -1844,7 +1947,8 @@ class ZLinkHostServiceRelocationRuntime {
|
|
|
1844
1947
|
this.completeSourceRelocationMetric(relocationMetric, undefined, true);
|
|
1845
1948
|
throw new ServiceRelocationRuntimeStoppedError();
|
|
1846
1949
|
}
|
|
1847
|
-
|
|
1950
|
+
if (window !== undefined)
|
|
1951
|
+
await this.resendSourceCutover(window);
|
|
1848
1952
|
const observed = await this.readSourceSettlement(envelope, primary, target).catch((error) => {
|
|
1849
1953
|
if (!(0, location_store_failure_1.isIndeterminateLocationStoreFailure)(error))
|
|
1850
1954
|
throw error;
|
|
@@ -1941,6 +2045,9 @@ class ZLinkHostServiceRelocationRuntime {
|
|
|
1941
2045
|
if (result.kind !== 'stored') {
|
|
1942
2046
|
throw new Error(`Participant '${participant.key}' recovery pointer release failed.`);
|
|
1943
2047
|
}
|
|
2048
|
+
if (participant.objectKind === 'actor') {
|
|
2049
|
+
this.options.observeActorAuthorityVersion?.((0, authority_key_codec_1.decodeAuthorityKey)(key).globalId, result.storeVersion.value);
|
|
2050
|
+
}
|
|
1944
2051
|
}
|
|
1945
2052
|
}
|
|
1946
2053
|
/** Restores the hidden object and its saved-work prefix before Ready. */
|
|
@@ -2236,15 +2343,6 @@ class ZLinkHostServiceRelocationRuntime {
|
|
|
2236
2343
|
hidden.onReplayResult = (packet, result) => this.relayTerminalReply(meshName, stage, coordinator, BigInt(index + 1), packet, result, signal);
|
|
2237
2344
|
}
|
|
2238
2345
|
await stage.owner.normalize(stage.staging, authority, signal);
|
|
2239
|
-
// The target may have visited this Actor before and still retain that
|
|
2240
|
-
// tenure in its private Actor-client resolver. The target-only CAS is
|
|
2241
|
-
// now authoritative, so expire the old projection before OnJoinedActor
|
|
2242
|
-
// can issue an Actor request and deadlock behind source leave.
|
|
2243
|
-
for (const hidden of stage.staging.hidden.values()) {
|
|
2244
|
-
if (hidden.actor !== undefined) {
|
|
2245
|
-
this.options.invalidateActorRoute?.(hidden.actor.context.actorId);
|
|
2246
|
-
}
|
|
2247
|
-
}
|
|
2248
2346
|
await this.finalizeActorJoinProfiles(meshName, stage, signal);
|
|
2249
2347
|
await this.publishSessionRoutes(stage.staging);
|
|
2250
2348
|
stage.phase = 'open';
|
|
@@ -2381,6 +2479,9 @@ class ZLinkHostServiceRelocationRuntime {
|
|
|
2381
2479
|
if (result.kind !== 'stored') {
|
|
2382
2480
|
throw new Error('Relocation target authority normalization CAS failed.');
|
|
2383
2481
|
}
|
|
2482
|
+
if (primary.allocation.objectKind === 'actor') {
|
|
2483
|
+
this.options.observeActorAuthorityVersion?.((0, authority_key_codec_1.decodeAuthorityKey)(stage.staging.primaryAuthorityKey).globalId, result.storeVersion.value);
|
|
2484
|
+
}
|
|
2384
2485
|
return { ...result, kind: 'snapshot' };
|
|
2385
2486
|
}
|
|
2386
2487
|
async handleReplyRelay(meshName, relay, sourceNodeRid, signal) {
|
|
@@ -2583,17 +2684,23 @@ class ZLinkHostServiceRelocationRuntime {
|
|
|
2583
2684
|
if (remainingMs <= 0) {
|
|
2584
2685
|
throw (0, framework_errors_internal_1.createInternalFrameworkException)(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.DeadlineExceeded, `Relocation control ACK '${key}' timed out.`, true);
|
|
2585
2686
|
}
|
|
2586
|
-
const
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
}
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2687
|
+
const pending = this.options.requests.begin(remainingMs, signal, undefined, deadlineAtMs);
|
|
2688
|
+
return this.options.requests.run(pending, (receiver) => {
|
|
2689
|
+
void this.requestInfrastructureControl(meshName, targetNodeRid, frames, remainingMs, signal, onSubmitted, pending).then((reply) => receiver.operationCompleted(pending.id, reply, undefined), (error) => receiver.operationFailed(pending.id, error, undefined));
|
|
2690
|
+
}, (raw) => {
|
|
2691
|
+
const replyFrames = raw;
|
|
2692
|
+
if (replyFrames.length !== 1) {
|
|
2693
|
+
throw new service_wire_m6a_codec_2.ServiceWireProtocolError(`Relocation control '${key}' reply must contain exactly one frame.`);
|
|
2694
|
+
}
|
|
2695
|
+
const response = (0, service_relocation_control_1.decodeServiceRelocationControlResponse)(Buffer.from(replyFrames[0]));
|
|
2696
|
+
if (response.kind === 'failed') {
|
|
2697
|
+
validateControlFailureResponse(request, response);
|
|
2698
|
+
}
|
|
2699
|
+
else {
|
|
2700
|
+
validateControlResponse(request, response);
|
|
2701
|
+
}
|
|
2702
|
+
return response;
|
|
2703
|
+
}, (error) => error);
|
|
2597
2704
|
}
|
|
2598
2705
|
async selectTarget(meshName, localRid, targetApplicationVersion, requirements = [], signal) {
|
|
2599
2706
|
const descriptors = await this.options.liveDescriptors(meshName, signal);
|
|
@@ -3163,13 +3270,18 @@ class ZLinkHostServiceRelocationRuntime {
|
|
|
3163
3270
|
}
|
|
3164
3271
|
return await send.call(node, targetNodeRid, record);
|
|
3165
3272
|
}
|
|
3166
|
-
async requestInfrastructureControl(meshName, targetNodeRid, frames, timeoutMs, signal, onSubmitted) {
|
|
3273
|
+
async requestInfrastructureControl(meshName, targetNodeRid, frames, timeoutMs, signal, onSubmitted, requestOperation) {
|
|
3167
3274
|
const node = this.requireMeshNode(meshName);
|
|
3168
3275
|
const request = node.requestInfrastructureControlFrames;
|
|
3169
3276
|
if (request === undefined) {
|
|
3170
3277
|
throw new Error('RouteMesh backend cannot submit bare infrastructure requests.');
|
|
3171
3278
|
}
|
|
3172
|
-
return await request.call(node, targetNodeRid, frames, {
|
|
3279
|
+
return await request.call(node, targetNodeRid, frames, {
|
|
3280
|
+
timeoutMs,
|
|
3281
|
+
signal,
|
|
3282
|
+
onSubmitted,
|
|
3283
|
+
requestOperation
|
|
3284
|
+
});
|
|
3173
3285
|
}
|
|
3174
3286
|
}
|
|
3175
3287
|
exports.ZLinkHostServiceRelocationRuntime = ZLinkHostServiceRelocationRuntime;
|
|
@@ -3327,6 +3439,7 @@ class LocalTargetPort {
|
|
|
3327
3439
|
value: hidden.authorityKey
|
|
3328
3440
|
});
|
|
3329
3441
|
const actorId = hidden.actor.context.actorId;
|
|
3442
|
+
this.options.observeActorAuthorityVersion?.(actorId, current.storeVersion.value);
|
|
3330
3443
|
const node = this.options.meshNode(this.meshName);
|
|
3331
3444
|
const restore = node?.restoreActorAuthority;
|
|
3332
3445
|
if (node === undefined || restore === undefined) {
|
|
@@ -3818,7 +3931,7 @@ function maintenanceReplyRelay(stage, coordinator, participantId, completion, pa
|
|
|
3818
3931
|
const value = completion.result.ok ? completion.result.response : undefined;
|
|
3819
3932
|
const direct = packet.messageFollowOrigin?.requestSource !== undefined;
|
|
3820
3933
|
const application = direct && completion.result.ok
|
|
3821
|
-
? (0, service_wire_m6a_codec_1.
|
|
3934
|
+
? (0, service_wire_m6a_codec_1.decodeApplicationPayload)((0, service_wire_m6a_codec_1.encodeMultipartApplicationPayload)((0, actor_reply_1.encodeActorReply)(Buffer.from(packet.header, 'base64'), protocol_1.ZLinkStreamMessageKind.Response, value, serializers, flowEnabled), service_wire_constants_generated_1.SERVICE_FRAMEWORK_MULTIPART_PACKET_NAME, service_wire_constants_generated_1.SERVICE_FRAMEWORK_MULTIPART_CONTENT_TYPE))
|
|
3822
3935
|
: undefined;
|
|
3823
3936
|
return {
|
|
3824
3937
|
relocation: relocationWireId(stage.staging.envelope.aggregateId),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RequestRuntime } from '../foundation/request-runtime';
|
|
1
2
|
import { type RoutingId } from '../../contracts';
|
|
2
3
|
import type { ZLinkBackendMeshNode } from '../backend/contracts';
|
|
3
4
|
import { type ZLinkMeshCompletionTable } from '../backend/mesh-completion-table';
|
|
@@ -7,6 +8,7 @@ import { type ZLinkSubmitResult } from '../messaging/submission-result';
|
|
|
7
8
|
import type { ZLinkSpotAddressCallOptions, ZLinkSpotAddressTransport, ZLinkSpotRoutedTransport } from '../spots/spot-outbound';
|
|
8
9
|
import type { ZLinkSpotRouteResolver } from '../spots/spot-routing-internal';
|
|
9
10
|
export interface ZLinkHostSpotAddressTransportOptions {
|
|
11
|
+
readonly requests?: RequestRuntime;
|
|
10
12
|
readonly resolver: () => ZLinkSpotRouteResolver | undefined;
|
|
11
13
|
readonly routed: ZLinkSpotRoutedTransport;
|
|
12
14
|
readonly meshNames: () => readonly string[];
|
|
@@ -21,6 +23,7 @@ export declare function hasObjectClientCapability(role: 'none' | 'client' | 'ser
|
|
|
21
23
|
/** Owns global Spot authority lookup and Missing Instance placement. */
|
|
22
24
|
export declare class ZLinkHostSpotAddressTransport implements ZLinkSpotAddressTransport {
|
|
23
25
|
private readonly options;
|
|
26
|
+
private readonly requests;
|
|
24
27
|
constructor(options: ZLinkHostSpotAddressTransportOptions);
|
|
25
28
|
sendToSpotAddress(spotId: RoutingId, message: unknown, call: Omit<ZLinkSpotAddressCallOptions, 'timeoutMs' | 'signal'>): Promise<ZLinkSubmitResult>;
|
|
26
29
|
private sendToSpotAddressScoped;
|