@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
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { RequestRuntime } from '../foundation/request-runtime';
|
|
2
|
+
import type { PendingOperation } from '../foundation/operation-registry';
|
|
3
|
+
import { inspectRuntime } from '../internal-observation';
|
|
1
4
|
import { type ActorRef, type RoutingId, ZLinkFrameworkException } from '../../contracts';
|
|
2
5
|
|
|
3
6
|
import type { Message } from '../../contracts/Common/Message';
|
|
@@ -20,7 +23,6 @@ import {
|
|
|
20
23
|
internalFrameworkErrorKind,
|
|
21
24
|
ZLinkFrameworkInternalErrorKind
|
|
22
25
|
} from '../framework-errors-internal';
|
|
23
|
-
import { waitRequestReply } from '../messaging/request-deadline';
|
|
24
26
|
import {
|
|
25
27
|
decodeRoutingId,
|
|
26
28
|
encodeRoutingIdStorageHex,
|
|
@@ -49,7 +51,6 @@ import {
|
|
|
49
51
|
ZLINK_REMOTE_ACTOR_PACKET_RELAY_PACKET
|
|
50
52
|
} from './actor-packet-relay-wire';
|
|
51
53
|
import type { ZLinkActorRoutedJoinTransport } from './actor-routed-join-transport';
|
|
52
|
-
import { requestRoutedJsonReply } from './actor-routed-json-request';
|
|
53
54
|
import type { ZLinkRemoteBoundSessionTarget } from './actor-runtime-state';
|
|
54
55
|
|
|
55
56
|
export const DEFAULT_MESSAGE_FOLLOW_DURATION_MS =
|
|
@@ -57,6 +58,7 @@ export const DEFAULT_MESSAGE_FOLLOW_DURATION_MS =
|
|
|
57
58
|
export const RELOCATED_REQUEST_OWNED_BY_REQUESTER = Symbol('relocated request owned by requester');
|
|
58
59
|
|
|
59
60
|
export interface ZLinkActorHandoffPacket {
|
|
61
|
+
requestOperation?: PendingOperation<unknown>;
|
|
60
62
|
readonly index: number;
|
|
61
63
|
readonly header: string;
|
|
62
64
|
readonly payload: string;
|
|
@@ -247,6 +249,7 @@ interface MessageFollowRoute {
|
|
|
247
249
|
}
|
|
248
250
|
|
|
249
251
|
export interface ZLinkActorHandoffCoordinatorOptions {
|
|
252
|
+
readonly requests?: RequestRuntime;
|
|
250
253
|
readonly routedTransport: ZLinkActorRoutedJoinTransport;
|
|
251
254
|
readonly messageFollowDurationMs?: number;
|
|
252
255
|
readonly requestTimeoutMs?: number;
|
|
@@ -303,6 +306,17 @@ function requireExactTargetOwnerFence(
|
|
|
303
306
|
|
|
304
307
|
/** Owns packet ordering from relocation start through Message Follow removal. */
|
|
305
308
|
export class ZLinkActorHandoffCoordinator {
|
|
309
|
+
private readonly requests: RequestRuntime;
|
|
310
|
+
[inspectRuntime]() {
|
|
311
|
+
return Object.freeze({
|
|
312
|
+
replyRouteCount: this.replyRoutes.size,
|
|
313
|
+
hasMessageFollowRoute: (actorId: string, actorRef: ActorRef) =>
|
|
314
|
+
this.hasMessageFollowRouteForStaleRef(actorId, actorRef),
|
|
315
|
+
tenureAuthorityOwnerGeneration: (actorId: string, actorRef: ActorRef) =>
|
|
316
|
+
this.tenureAuthorityOwnerGeneration(actorId, actorRef)
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
|
|
306
320
|
private readonly active = new Map<string, ActiveHandoff>();
|
|
307
321
|
// Each route is stored once: Actor -> native fence -> location owner id.
|
|
308
322
|
// Native ingress has the complete fence except the location owner's text id.
|
|
@@ -324,6 +338,7 @@ export class ZLinkActorHandoffCoordinator {
|
|
|
324
338
|
private readonly replyRoutes = new Map<string, ReplyRoute>();
|
|
325
339
|
|
|
326
340
|
constructor(private readonly options: ZLinkActorHandoffCoordinatorOptions) {
|
|
341
|
+
this.requests = options.requests ?? new RequestRuntime();
|
|
327
342
|
this.messageFollowDurationMs =
|
|
328
343
|
options.messageFollowDurationMs ?? DEFAULT_MESSAGE_FOLLOW_DURATION_MS;
|
|
329
344
|
}
|
|
@@ -855,7 +870,8 @@ export class ZLinkActorHandoffCoordinator {
|
|
|
855
870
|
deadlineUnixMs?: number,
|
|
856
871
|
messageFollowOrigin?: ZLinkMessageFollowOrigin,
|
|
857
872
|
provisionalReplay?: ZLinkActorHandoffDispatch,
|
|
858
|
-
onAdmitted?: () => void
|
|
873
|
+
onAdmitted?: () => void,
|
|
874
|
+
requestOperation?: PendingOperation<unknown>
|
|
859
875
|
): Promise<unknown> | undefined {
|
|
860
876
|
let incomingContext = actorMessageFollowContext(fallbackActorRef);
|
|
861
877
|
const originalDeadlineUnixMs =
|
|
@@ -930,7 +946,8 @@ export class ZLinkActorHandoffCoordinator {
|
|
|
930
946
|
remoteBoundSessionTarget,
|
|
931
947
|
fallbackActorRef,
|
|
932
948
|
context,
|
|
933
|
-
messageFollowOrigin
|
|
949
|
+
messageFollowOrigin,
|
|
950
|
+
requestOperation
|
|
934
951
|
);
|
|
935
952
|
handoff.pendingBytes += packetBytes(packet);
|
|
936
953
|
this.options.onMarker?.('handoff_backlog', actorId, packet.index);
|
|
@@ -1042,7 +1059,8 @@ export class ZLinkActorHandoffCoordinator {
|
|
|
1042
1059
|
remoteBoundSessionTarget,
|
|
1043
1060
|
fallbackActorRef,
|
|
1044
1061
|
incomingContext,
|
|
1045
|
-
messageFollowOrigin
|
|
1062
|
+
messageFollowOrigin,
|
|
1063
|
+
requestOperation
|
|
1046
1064
|
);
|
|
1047
1065
|
return this.enqueueMessageFollow(followRoute, actorId, packet, onAdmitted);
|
|
1048
1066
|
}
|
|
@@ -1099,7 +1117,8 @@ export class ZLinkActorHandoffCoordinator {
|
|
|
1099
1117
|
remoteBoundSessionTarget,
|
|
1100
1118
|
fallbackActorRef,
|
|
1101
1119
|
context,
|
|
1102
|
-
messageFollowOrigin
|
|
1120
|
+
messageFollowOrigin,
|
|
1121
|
+
requestOperation
|
|
1103
1122
|
);
|
|
1104
1123
|
return this.enqueueMessageFollow(followRoute, actorId, packet, onAdmitted);
|
|
1105
1124
|
}
|
|
@@ -1677,14 +1696,22 @@ export class ZLinkActorHandoffCoordinator {
|
|
|
1677
1696
|
replyRouteId: context.replyRouteId,
|
|
1678
1697
|
result
|
|
1679
1698
|
});
|
|
1699
|
+
packet.requestOperation?.setFailureDispatcher(reject);
|
|
1680
1700
|
onAdmitted?.();
|
|
1681
1701
|
entry.tail = entry.tail.then(async () => {
|
|
1682
1702
|
try {
|
|
1683
|
-
|
|
1703
|
+
if (packet.requestOperation !== undefined && !packet.requestOperation.isPending()) {
|
|
1704
|
+
resolve(await packet.requestOperation.promise);
|
|
1705
|
+
} else {
|
|
1706
|
+
await this.relayMessageFollow(actorId, entry, packet, resolve, reject);
|
|
1707
|
+
}
|
|
1708
|
+
await result;
|
|
1684
1709
|
} catch (error) {
|
|
1685
1710
|
this.options.onMarker?.('message_follow_rejected', actorId);
|
|
1686
1711
|
reject(error);
|
|
1687
1712
|
} finally {
|
|
1713
|
+
packet.requestOperation?.clearFailureDispatcher(reject);
|
|
1714
|
+
delete packet.requestOperation;
|
|
1688
1715
|
entry.queuedMessages--;
|
|
1689
1716
|
entry.queuedBytes -= bytes;
|
|
1690
1717
|
}
|
|
@@ -1695,8 +1722,10 @@ export class ZLinkActorHandoffCoordinator {
|
|
|
1695
1722
|
private async relayMessageFollow(
|
|
1696
1723
|
actorId: string,
|
|
1697
1724
|
entry: MessageFollowRoute,
|
|
1698
|
-
packet: ZLinkActorHandoffPacket
|
|
1699
|
-
|
|
1725
|
+
packet: ZLinkActorHandoffPacket,
|
|
1726
|
+
resolve: (value: unknown) => void,
|
|
1727
|
+
reject: (reason: unknown) => void
|
|
1728
|
+
): Promise<void> {
|
|
1700
1729
|
const { target, targetActorRef } = entry;
|
|
1701
1730
|
const context = packet.messageFollowContext;
|
|
1702
1731
|
let advanced: ZLinkActorMessageFollowContext;
|
|
@@ -1723,53 +1752,52 @@ export class ZLinkActorHandoffCoordinator {
|
|
|
1723
1752
|
packetName: ZLINK_REMOTE_ACTOR_PACKET_RELAY_PACKET
|
|
1724
1753
|
});
|
|
1725
1754
|
await this.messageFollowRelayed(actorId, entry, packet, advanced);
|
|
1726
|
-
|
|
1755
|
+
resolve(undefined);
|
|
1756
|
+
return;
|
|
1727
1757
|
}
|
|
1728
1758
|
const timeoutMs = this.options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
|
|
1729
|
-
const
|
|
1730
|
-
if (
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
);
|
|
1739
|
-
if (reply.ok === false) {
|
|
1740
|
-
throw actorRelayError(actorId, reply.errorKind, reply.error);
|
|
1741
|
-
}
|
|
1742
|
-
await this.messageFollowRelayed(actorId, entry, packet, advanced);
|
|
1743
|
-
return reply.response;
|
|
1759
|
+
const requestOperation = packet.requestOperation ?? this.requests.begin(timeoutMs);
|
|
1760
|
+
if (packet.requestOperation === undefined) {
|
|
1761
|
+
// The existing business result delivers failures from this entry alias.
|
|
1762
|
+
void requestOperation.promise.catch(() => {});
|
|
1763
|
+
requestOperation.setFailureDispatcher(reject);
|
|
1764
|
+
}
|
|
1765
|
+
if (!requestOperation.isPending()) {
|
|
1766
|
+
resolve(await requestOperation.promise);
|
|
1767
|
+
return;
|
|
1744
1768
|
}
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
this.options.routedTransport,
|
|
1769
|
+
try {
|
|
1770
|
+
this.options.routedTransport.requestToSpot<Record<string, unknown>>(
|
|
1748
1771
|
target,
|
|
1749
1772
|
payload,
|
|
1750
|
-
{ timeoutMs },
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1773
|
+
{ packetName: ZLINK_REMOTE_ACTOR_PACKET_RELAY_PACKET, timeoutMs, requestOperation },
|
|
1774
|
+
{
|
|
1775
|
+
operationCompleted: (_id, value) => {
|
|
1776
|
+
requestOperation.clearFailureDispatcher(reject);
|
|
1777
|
+
if (!requestOperation.isPending()) return;
|
|
1778
|
+
void (async () => {
|
|
1779
|
+
const reply = value as Record<string, unknown>;
|
|
1780
|
+
if (reply.ok === false) throw actorRelayError(actorId, reply.errorKind, reply.error);
|
|
1781
|
+
await this.messageFollowRelayed(actorId, entry, packet, advanced);
|
|
1782
|
+
if (packet.requestOperation === undefined) requestOperation.complete(reply.response);
|
|
1783
|
+
resolve(reply.response);
|
|
1784
|
+
})().catch((error) => {
|
|
1785
|
+
if (packet.requestOperation === undefined) requestOperation.fail(error);
|
|
1786
|
+
reject(error);
|
|
1787
|
+
});
|
|
1788
|
+
},
|
|
1789
|
+
operationFailed: (_id, error) => {
|
|
1790
|
+
requestOperation.clearFailureDispatcher(reject);
|
|
1791
|
+
if (packet.requestOperation === undefined) requestOperation.fail(error);
|
|
1792
|
+
reject(error);
|
|
1764
1793
|
}
|
|
1765
|
-
return reply.response;
|
|
1766
1794
|
}
|
|
1767
|
-
)
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1795
|
+
);
|
|
1796
|
+
} catch (error) {
|
|
1797
|
+
requestOperation.clearFailureDispatcher(reject);
|
|
1798
|
+
if (packet.requestOperation === undefined) requestOperation.fail(error);
|
|
1799
|
+
throw error;
|
|
1800
|
+
}
|
|
1773
1801
|
}
|
|
1774
1802
|
|
|
1775
1803
|
private async messageFollowRelayed(
|
|
@@ -1920,12 +1948,13 @@ function encodePacket(
|
|
|
1920
1948
|
remoteBoundSessionTarget?: ZLinkRemoteBoundSessionTarget,
|
|
1921
1949
|
fallbackActorRef?: ActorRef,
|
|
1922
1950
|
messageFollowContext?: ZLinkActorMessageFollowContext,
|
|
1923
|
-
messageFollowOrigin?: ZLinkMessageFollowOrigin
|
|
1951
|
+
messageFollowOrigin?: ZLinkMessageFollowOrigin,
|
|
1952
|
+
requestOperation?: PendingOperation<unknown>
|
|
1924
1953
|
): ZLinkActorHandoffPacket {
|
|
1925
1954
|
if (messageFollowContext === undefined) {
|
|
1926
1955
|
throw new Error('Actor handoff packet requires a Message Follow context.');
|
|
1927
1956
|
}
|
|
1928
|
-
|
|
1957
|
+
const packet: ZLinkActorHandoffPacket = {
|
|
1929
1958
|
index,
|
|
1930
1959
|
header: Buffer.from(parts[0].data()).toString('base64'),
|
|
1931
1960
|
payload: Buffer.from(parts[1].data()).toString('base64'),
|
|
@@ -1956,6 +1985,12 @@ function encodePacket(
|
|
|
1956
1985
|
nodeRid: String(fallbackActorRef.nodeRid)
|
|
1957
1986
|
}
|
|
1958
1987
|
};
|
|
1988
|
+
if (requestOperation !== undefined)
|
|
1989
|
+
Object.defineProperty(packet, 'requestOperation', {
|
|
1990
|
+
value: requestOperation,
|
|
1991
|
+
configurable: true
|
|
1992
|
+
});
|
|
1993
|
+
return packet;
|
|
1959
1994
|
}
|
|
1960
1995
|
|
|
1961
1996
|
function optionalBigInt(value: string | undefined): bigint | undefined {
|
|
@@ -31,8 +31,8 @@ class ActorJoinRegistrationScope {
|
|
|
31
31
|
this.open = false;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
prepareSealedJoins(): Promise<void> {
|
|
35
|
+
return this.prepareSealedJoinsCore();
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
private async prepareSealedJoinsCore(): Promise<void> {
|
|
@@ -40,8 +40,8 @@ class ActorJoinRegistrationScope {
|
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
this.prepared = true;
|
|
43
|
-
for (
|
|
44
|
-
await
|
|
43
|
+
for (let index = 0; index < this.intents.length; index++) {
|
|
44
|
+
await this.intents[index]!.prepare?.();
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -62,8 +62,8 @@ class ActorJoinRegistrationScope {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
private async execute(): Promise<void> {
|
|
65
|
-
for (
|
|
66
|
-
await
|
|
65
|
+
for (let index = 0; index < this.intents.length; index++) {
|
|
66
|
+
await this.intents[index]!.execute();
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
} from '../framework-errors-internal';
|
|
28
28
|
import type { ZLinkLocationLifecycle } from '../locations';
|
|
29
29
|
import { frameworkPayloadContentType } from '../messaging/payload-codec';
|
|
30
|
+
import { remainingActorRequestTimeout } from './actor-request-deadline';
|
|
30
31
|
import { routingIdsEqual, toBackendRoutingId } from '../routing-id';
|
|
31
32
|
import type { ZLinkSpotRouteTarget } from '../spots/spot-routing-internal';
|
|
32
33
|
import type { ZLinkActorJoinRelocation } from './actor-join-relocation';
|
|
@@ -81,7 +82,8 @@ export class ZLinkLocalNativeActorJoin {
|
|
|
81
82
|
request: Message,
|
|
82
83
|
timeoutMs: number | undefined,
|
|
83
84
|
signal: AbortSignal | undefined,
|
|
84
|
-
completionOperationId?: ZLinkActorJoinOperationId
|
|
85
|
+
completionOperationId?: ZLinkActorJoinOperationId,
|
|
86
|
+
deadlineAtMs?: number
|
|
85
87
|
): Promise<ZLinkActorJoinRuntimeResult<Message>> {
|
|
86
88
|
if (signal?.aborted === true) throw createAbortError();
|
|
87
89
|
const target = requireUserSpotRoute(spotRouteTarget, spotId);
|
|
@@ -100,7 +102,8 @@ export class ZLinkLocalNativeActorJoin {
|
|
|
100
102
|
timeoutMs,
|
|
101
103
|
signal,
|
|
102
104
|
completionOperationId,
|
|
103
|
-
false
|
|
105
|
+
false,
|
|
106
|
+
deadlineAtMs
|
|
104
107
|
);
|
|
105
108
|
}
|
|
106
109
|
return await this.joinLocal(
|
|
@@ -125,7 +128,8 @@ export class ZLinkLocalNativeActorJoin {
|
|
|
125
128
|
request: Message,
|
|
126
129
|
timeoutMs: number | undefined,
|
|
127
130
|
signal: AbortSignal | undefined,
|
|
128
|
-
completionOperationId?: ZLinkActorJoinOperationId
|
|
131
|
+
completionOperationId?: ZLinkActorJoinOperationId,
|
|
132
|
+
deadlineAtMs?: number
|
|
129
133
|
): Promise<ZLinkActorJoinRuntimeResult<Message>> {
|
|
130
134
|
if (signal?.aborted === true) throw createAbortError();
|
|
131
135
|
const targetNodeRid = spotRouteTarget?.targetNodeRid ?? nodeRid;
|
|
@@ -147,7 +151,8 @@ export class ZLinkLocalNativeActorJoin {
|
|
|
147
151
|
timeoutMs,
|
|
148
152
|
signal,
|
|
149
153
|
completionOperationId,
|
|
150
|
-
true
|
|
154
|
+
true,
|
|
155
|
+
deadlineAtMs
|
|
151
156
|
);
|
|
152
157
|
}
|
|
153
158
|
const target = {
|
|
@@ -210,7 +215,8 @@ export class ZLinkLocalNativeActorJoin {
|
|
|
210
215
|
storeSpotId,
|
|
211
216
|
spotGeneration,
|
|
212
217
|
target.spotKind === ZLinkSpotKind.Entry ? ZLinkSpotKind.Entry : ZLinkSpotKind.User,
|
|
213
|
-
node.status().lifecycleGeneration
|
|
218
|
+
node.status().lifecycleGeneration,
|
|
219
|
+
signal
|
|
214
220
|
);
|
|
215
221
|
const committedActor = node.restoreActorAuthority!(
|
|
216
222
|
actor.context.actorId,
|
|
@@ -268,12 +274,18 @@ export class ZLinkLocalNativeActorJoin {
|
|
|
268
274
|
submit: () => { readonly high: bigint; readonly low: bigint },
|
|
269
275
|
completions: ZLinkMeshCompletionTable,
|
|
270
276
|
timeoutMs: number | undefined,
|
|
271
|
-
signal: AbortSignal | undefined
|
|
277
|
+
signal: AbortSignal | undefined,
|
|
278
|
+
deadlineAtMs?: number
|
|
272
279
|
): Promise<ZLinkMeshCompletion> {
|
|
273
280
|
// The operation ID identifies one Core request. Once it is submitted, a
|
|
274
281
|
// NotConnected completion is terminal for that request; resubmitting it
|
|
275
282
|
// could execute the target lifecycle twice after a delayed reply.
|
|
276
|
-
return submitJoinWhenConnected(
|
|
283
|
+
return submitJoinWhenConnected(
|
|
284
|
+
() => completions.submit(submit, signal),
|
|
285
|
+
timeoutMs,
|
|
286
|
+
signal,
|
|
287
|
+
deadlineAtMs
|
|
288
|
+
);
|
|
277
289
|
}
|
|
278
290
|
|
|
279
291
|
private async relocateRemoteActorJoin(
|
|
@@ -286,9 +298,10 @@ export class ZLinkLocalNativeActorJoin {
|
|
|
286
298
|
timeoutMs: number | undefined,
|
|
287
299
|
signal: AbortSignal | undefined,
|
|
288
300
|
completionOperationId: ZLinkActorJoinOperationId | undefined,
|
|
289
|
-
entrySpot: boolean
|
|
301
|
+
entrySpot: boolean,
|
|
302
|
+
deadlineAtMs?: number
|
|
290
303
|
): Promise<ZLinkActorJoinRuntimeResult<Message>> {
|
|
291
|
-
|
|
304
|
+
deadlineAtMs ??= timeoutMs === undefined ? undefined : performance.now() + timeoutMs;
|
|
292
305
|
const actorType = state.actorType;
|
|
293
306
|
if (actorType === undefined) {
|
|
294
307
|
throw createInternalFrameworkException(
|
|
@@ -324,6 +337,10 @@ export class ZLinkLocalNativeActorJoin {
|
|
|
324
337
|
let admissionOperationId: ZLinkActorJoinOperationId | undefined;
|
|
325
338
|
const admission = await this.waitForJoinCompletion(
|
|
326
339
|
() => {
|
|
340
|
+
const remainingTimeoutMs = remainingActorRequestTimeout(
|
|
341
|
+
actor.context.actorId,
|
|
342
|
+
deadlineAtMs
|
|
343
|
+
);
|
|
327
344
|
const legacyAdmission =
|
|
328
345
|
canonicalAdmission === undefined
|
|
329
346
|
? legacyRemoteActorJoinPayload(actor, state, actorRef, target, request, relocationId)
|
|
@@ -335,7 +352,7 @@ export class ZLinkLocalNativeActorJoin {
|
|
|
335
352
|
actorRef,
|
|
336
353
|
toBackendRoutingId(target.targetNodeRid),
|
|
337
354
|
legacyAdmission!,
|
|
338
|
-
|
|
355
|
+
remainingTimeoutMs
|
|
339
356
|
)
|
|
340
357
|
: node.joinActorSpot(
|
|
341
358
|
actorRef,
|
|
@@ -343,7 +360,7 @@ export class ZLinkLocalNativeActorJoin {
|
|
|
343
360
|
toBackendRoutingId(target.spotId),
|
|
344
361
|
target.targetSpotGeneration!,
|
|
345
362
|
legacyAdmission!,
|
|
346
|
-
|
|
363
|
+
remainingTimeoutMs
|
|
347
364
|
)
|
|
348
365
|
: entrySpot
|
|
349
366
|
? node.joinActorEntrySpotCanonical!(
|
|
@@ -352,7 +369,7 @@ export class ZLinkLocalNativeActorJoin {
|
|
|
352
369
|
canonicalAdmission.request,
|
|
353
370
|
canonicalAdmission.actorFence,
|
|
354
371
|
canonicalAdmission.local,
|
|
355
|
-
|
|
372
|
+
remainingTimeoutMs
|
|
356
373
|
)
|
|
357
374
|
: node.joinActorSpotCanonical!(
|
|
358
375
|
actorRef,
|
|
@@ -362,14 +379,15 @@ export class ZLinkLocalNativeActorJoin {
|
|
|
362
379
|
canonicalAdmission.request,
|
|
363
380
|
canonicalAdmission.actorFence,
|
|
364
381
|
canonicalAdmission.local,
|
|
365
|
-
|
|
382
|
+
remainingTimeoutMs
|
|
366
383
|
);
|
|
367
384
|
admissionOperationId = operationId;
|
|
368
385
|
return operationId;
|
|
369
386
|
},
|
|
370
387
|
completions,
|
|
371
388
|
timeoutMs,
|
|
372
|
-
signal
|
|
389
|
+
signal,
|
|
390
|
+
deadlineAtMs
|
|
373
391
|
);
|
|
374
392
|
const control = admission.kindData;
|
|
375
393
|
if (control?.kind !== 'actorJoinCompletion' || control.actor === null) {
|
|
@@ -613,11 +631,14 @@ function runtimeActorMeshName(
|
|
|
613
631
|
async function submitJoinWhenConnected<T>(
|
|
614
632
|
submit: () => T,
|
|
615
633
|
timeoutMs: number | undefined,
|
|
616
|
-
signal: AbortSignal | undefined
|
|
634
|
+
signal: AbortSignal | undefined,
|
|
635
|
+
deadlineAtMs?: number
|
|
617
636
|
): Promise<T> {
|
|
618
|
-
const deadline =
|
|
637
|
+
const deadline = Math.min(
|
|
638
|
+
deadlineAtMs ?? Infinity,
|
|
619
639
|
performance.now() +
|
|
620
|
-
|
|
640
|
+
Math.min(timeoutMs ?? LOCAL_JOIN_RESOLUTION_TIMEOUT_MS, LOCAL_JOIN_RESOLUTION_TIMEOUT_MS)
|
|
641
|
+
);
|
|
621
642
|
for (;;) {
|
|
622
643
|
throwIfAborted(signal);
|
|
623
644
|
try {
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import type { ApplicationJobPermitPort } from '../application-jobs/contracts';
|
|
15
15
|
|
|
16
16
|
export class ZLinkActorSerialExecutor {
|
|
17
|
-
|
|
17
|
+
readonly scheduler: ZLinkSerialExecutionQueue;
|
|
18
18
|
|
|
19
19
|
constructor(
|
|
20
20
|
private readonly actorId: string,
|
|
@@ -83,7 +83,8 @@ export class ZLinkActorNativeJoinCoordinator implements ZLinkActorJoinCoordinato
|
|
|
83
83
|
request: Message,
|
|
84
84
|
timeoutMs: number | undefined,
|
|
85
85
|
signal: AbortSignal | undefined,
|
|
86
|
-
completionOperationId?: import('../../contracts').ZLinkActorJoinOperationId
|
|
86
|
+
completionOperationId?: import('../../contracts').ZLinkActorJoinOperationId,
|
|
87
|
+
deadlineAtMs?: number
|
|
87
88
|
): Promise<ZLinkActorJoinRuntimeResult<Message>> {
|
|
88
89
|
throwIfAborted(signal);
|
|
89
90
|
const node = this.node();
|
|
@@ -105,7 +106,8 @@ export class ZLinkActorNativeJoinCoordinator implements ZLinkActorJoinCoordinato
|
|
|
105
106
|
request,
|
|
106
107
|
timeoutMs ?? this.options.actorTransferTimeoutMs,
|
|
107
108
|
signal,
|
|
108
|
-
completionOperationId
|
|
109
|
+
completionOperationId,
|
|
110
|
+
deadlineAtMs
|
|
109
111
|
);
|
|
110
112
|
return this.withDeferredJoinFinalizer(actor, state, target, result, completionOperationId);
|
|
111
113
|
}
|
|
@@ -117,7 +119,8 @@ export class ZLinkActorNativeJoinCoordinator implements ZLinkActorJoinCoordinato
|
|
|
117
119
|
request: Message,
|
|
118
120
|
timeoutMs: number | undefined,
|
|
119
121
|
signal: AbortSignal | undefined,
|
|
120
|
-
completionOperationId?: import('../../contracts').ZLinkActorJoinOperationId
|
|
122
|
+
completionOperationId?: import('../../contracts').ZLinkActorJoinOperationId,
|
|
123
|
+
deadlineAtMs?: number
|
|
121
124
|
): Promise<ZLinkActorJoinRuntimeResult<Message>> {
|
|
122
125
|
throwIfAborted(signal);
|
|
123
126
|
const node = this.node();
|
|
@@ -152,7 +155,8 @@ export class ZLinkActorNativeJoinCoordinator implements ZLinkActorJoinCoordinato
|
|
|
152
155
|
request,
|
|
153
156
|
timeoutMs ?? this.options.actorTransferTimeoutMs,
|
|
154
157
|
signal,
|
|
155
|
-
completionOperationId
|
|
158
|
+
completionOperationId,
|
|
159
|
+
deadlineAtMs
|
|
156
160
|
);
|
|
157
161
|
return this.withDeferredJoinFinalizer(actor, state, target, result, completionOperationId);
|
|
158
162
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { PendingOperation, OperationObserver } from '../foundation/operation-registry';
|
|
2
|
+
import type { ZLinkRequestResult } from '../messaging/request-result';
|
|
1
3
|
import type { Message } from '../../contracts/Common/Message';
|
|
2
4
|
import type { ZLinkBackendSpot } from '../backend/contracts';
|
|
3
5
|
import type { ZLinkSubmitResult } from '../messaging/submission-result';
|
|
@@ -13,7 +15,7 @@ export interface ZLinkActorRoutedJoinTransport {
|
|
|
13
15
|
request: unknown,
|
|
14
16
|
timeoutMs: number | undefined,
|
|
15
17
|
signal?: AbortSignal
|
|
16
|
-
):
|
|
18
|
+
): ZLinkRequestResult<TReply>;
|
|
17
19
|
submit?(
|
|
18
20
|
routerChannelId: string,
|
|
19
21
|
targetNodeRid: string,
|
|
@@ -36,6 +38,7 @@ export interface ZLinkActorRoutedJoinTransport {
|
|
|
36
38
|
request: Message,
|
|
37
39
|
options: {
|
|
38
40
|
readonly timeoutMs?: number;
|
|
41
|
+
readonly requestOperation?: PendingOperation<unknown>;
|
|
39
42
|
readonly signal?: AbortSignal;
|
|
40
43
|
readonly onAdmitted?: () => void;
|
|
41
44
|
}
|
|
@@ -46,10 +49,12 @@ export interface ZLinkActorRoutedJoinTransport {
|
|
|
46
49
|
options: {
|
|
47
50
|
readonly packetName?: string;
|
|
48
51
|
readonly timeoutMs?: number;
|
|
52
|
+
readonly requestOperation?: PendingOperation<unknown>;
|
|
49
53
|
readonly signal?: AbortSignal;
|
|
50
54
|
readonly onAdmitted?: () => void;
|
|
51
|
-
}
|
|
52
|
-
|
|
55
|
+
},
|
|
56
|
+
destination?: OperationObserver<unknown, unknown>
|
|
57
|
+
): ZLinkRequestResult<TReply>;
|
|
53
58
|
requestFromSpotToSpot?<TReply = unknown>(
|
|
54
59
|
sourceSpot: ZLinkBackendSpot,
|
|
55
60
|
spotRouteTarget: ZLinkSpotRouteTarget,
|
|
@@ -57,16 +62,19 @@ export interface ZLinkActorRoutedJoinTransport {
|
|
|
57
62
|
options: {
|
|
58
63
|
readonly packetName?: string;
|
|
59
64
|
readonly timeoutMs?: number;
|
|
65
|
+
readonly requestOperation?: PendingOperation<unknown>;
|
|
60
66
|
readonly signal?: AbortSignal;
|
|
61
67
|
readonly onAdmitted?: () => void;
|
|
62
|
-
}
|
|
63
|
-
|
|
68
|
+
},
|
|
69
|
+
destination?: OperationObserver<unknown, unknown>
|
|
70
|
+
): ZLinkRequestResult<TReply>;
|
|
64
71
|
requestRawFromSpotToSpot?(
|
|
65
72
|
sourceSpot: ZLinkBackendSpot,
|
|
66
73
|
spotRouteTarget: ZLinkSpotRouteTarget,
|
|
67
74
|
request: Message,
|
|
68
75
|
options: {
|
|
69
76
|
readonly timeoutMs?: number;
|
|
77
|
+
readonly requestOperation?: PendingOperation<unknown>;
|
|
70
78
|
readonly signal?: AbortSignal;
|
|
71
79
|
readonly onAdmitted?: () => void;
|
|
72
80
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PendingOperation } from '../foundation/operation-registry';
|
|
1
2
|
import { ZLinkBufferMessage as RuntimeMessage } from '../backend/runtime-message';
|
|
2
3
|
import type { Message } from '../../contracts/Common/Message';
|
|
3
4
|
import type { ZLinkSpotRouteTarget } from '../spots/spot-routing-internal';
|
|
@@ -9,6 +10,7 @@ export async function tryRequestRoutedJson(
|
|
|
9
10
|
payload: unknown,
|
|
10
11
|
options: {
|
|
11
12
|
readonly timeoutMs?: number;
|
|
13
|
+
readonly requestOperation?: PendingOperation<unknown>;
|
|
12
14
|
readonly signal?: AbortSignal;
|
|
13
15
|
readonly onAdmitted?: () => void;
|
|
14
16
|
}
|
|
@@ -30,6 +32,7 @@ export async function requestRoutedJsonReply<T>(
|
|
|
30
32
|
payload: unknown,
|
|
31
33
|
options: {
|
|
32
34
|
readonly timeoutMs?: number;
|
|
35
|
+
readonly requestOperation?: PendingOperation<unknown>;
|
|
33
36
|
readonly signal?: AbortSignal;
|
|
34
37
|
readonly onAdmitted?: () => void;
|
|
35
38
|
},
|
|
@@ -109,7 +109,8 @@ export interface ZLinkActorJoinCoordinator {
|
|
|
109
109
|
request: Message,
|
|
110
110
|
timeoutMs: number | undefined,
|
|
111
111
|
signal: AbortSignal | undefined,
|
|
112
|
-
completionOperationId?: import('../../contracts').ZLinkActorJoinOperationId
|
|
112
|
+
completionOperationId?: import('../../contracts').ZLinkActorJoinOperationId,
|
|
113
|
+
deadlineAtMs?: number
|
|
113
114
|
): Promise<ZLinkActorJoinRuntimeResult<Message>>;
|
|
114
115
|
joinEntrySpot(
|
|
115
116
|
actor: ZLinkActor,
|
|
@@ -118,6 +119,7 @@ export interface ZLinkActorJoinCoordinator {
|
|
|
118
119
|
request: Message,
|
|
119
120
|
timeoutMs: number | undefined,
|
|
120
121
|
signal: AbortSignal | undefined,
|
|
121
|
-
completionOperationId?: import('../../contracts').ZLinkActorJoinOperationId
|
|
122
|
+
completionOperationId?: import('../../contracts').ZLinkActorJoinOperationId,
|
|
123
|
+
deadlineAtMs?: number
|
|
122
124
|
): Promise<ZLinkActorJoinRuntimeResult<Message>>;
|
|
123
125
|
}
|
|
@@ -174,7 +174,7 @@ export class ZLinkActorRuntimeState {
|
|
|
174
174
|
private spotMembershipEpochValue = 0n;
|
|
175
175
|
private nativeActorRefValue: ZLinkBackendActorRef | undefined;
|
|
176
176
|
private entryNodeRidValue: RoutingId | undefined;
|
|
177
|
-
|
|
177
|
+
boundSessionValue: ZLinkRemoteBoundSessionTarget | undefined;
|
|
178
178
|
private remoteActorPacketTargetValue: ZLinkRemoteActorPacketTarget | undefined;
|
|
179
179
|
private createRequestPayloadValue: Buffer | undefined;
|
|
180
180
|
private ownsLocationValue = false;
|