@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
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DefaultZLinkInstanceSpotHandlerRegistry = exports.DefaultZLinkSpotHandlerRegistry = void 0;
|
|
4
4
|
exports.applyEntrySpotHandlerRegistrations = applyEntrySpotHandlerRegistrations;
|
|
5
5
|
exports.applySpotHandlerRegistrations = applySpotHandlerRegistrations;
|
|
6
|
+
const HandlerMessageType_1 = require("../../contracts/Common/HandlerMessageType");
|
|
6
7
|
const handler_instance_scope_1 = require("../handlers/handler-instance-scope");
|
|
7
8
|
const framework_errors_internal_1 = require("../framework-errors-internal");
|
|
8
9
|
const actors_1 = require("../actors");
|
|
@@ -21,16 +22,19 @@ class DefaultZLinkSpotHandlerRegistry {
|
|
|
21
22
|
if (metadata === undefined || resolvedPacketName === undefined) {
|
|
22
23
|
throw (0, framework_errors_internal_1.createInternalFrameworkException)(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.InvalidOperation, `Actor packet handler '${handlerType.name}' must declare a packet name.`);
|
|
23
24
|
}
|
|
24
|
-
return this.addActorPacketRegistration(metadata.kind === 'spotActorSend' ? actors_1.ZLinkActorPacketKind.Send : actors_1.ZLinkActorPacketKind.Request, handlerType, Object, resolvedPacketName);
|
|
25
|
+
return this.addActorPacketRegistration(metadata.kind === 'spotActorSend' ? actors_1.ZLinkActorPacketKind.Send : actors_1.ZLinkActorPacketKind.Request, handlerType, Object, resolvedPacketName, (0, HandlerMessageType_1.resolveHandlerMessageType)(handlerType));
|
|
25
26
|
}
|
|
26
27
|
addActorPacket(handlerType, actorType) {
|
|
27
28
|
const metadata = (0, Attributes_1.readZLinkDecoratorMetadata)(handlerType).find((entry) => entry.kind === 'spotActorSend' || entry.kind === 'spotActorRequest');
|
|
28
29
|
if (metadata?.packetName === undefined) {
|
|
29
30
|
throw (0, framework_errors_internal_1.createInternalFrameworkException)(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.InvalidOperation, `Actor packet handler '${handlerType.name}' must declare a packet name.`);
|
|
30
31
|
}
|
|
31
|
-
return this.addActorPacketRegistration(metadata.kind === 'spotActorSend' ? actors_1.ZLinkActorPacketKind.Send : actors_1.ZLinkActorPacketKind.Request, handlerType, actorType, metadata.packetName);
|
|
32
|
+
return this.addActorPacketRegistration(metadata.kind === 'spotActorSend' ? actors_1.ZLinkActorPacketKind.Send : actors_1.ZLinkActorPacketKind.Request, handlerType, actorType, metadata.packetName, (0, HandlerMessageType_1.resolveHandlerMessageType)(handlerType));
|
|
32
33
|
}
|
|
33
34
|
addPacket(handlerType, packetName) {
|
|
35
|
+
return this.addPacketRegistration(handlerType, packetName, (0, HandlerMessageType_1.resolveHandlerMessageType)(handlerType));
|
|
36
|
+
}
|
|
37
|
+
addPacketRegistration(handlerType, packetName, messageType) {
|
|
34
38
|
const declared = (0, Attributes_1.readZLinkDecoratorMetadata)(handlerType).find((entry) => entry.kind === 'packet')?.packetName;
|
|
35
39
|
(0, handler_instance_scope_1.prepareHandlerInstance)(this.providerResolver, handlerType);
|
|
36
40
|
const resolvedPacketName = packetName ?? declared ?? handlerType.name;
|
|
@@ -39,6 +43,7 @@ class DefaultZLinkSpotHandlerRegistry {
|
|
|
39
43
|
this.entries.push({
|
|
40
44
|
kind: 'packet',
|
|
41
45
|
handlerType,
|
|
46
|
+
...(messageType === undefined ? {} : { messageType: messageType }),
|
|
42
47
|
packetName: resolvedPacketName
|
|
43
48
|
});
|
|
44
49
|
return this;
|
|
@@ -46,11 +51,12 @@ class DefaultZLinkSpotHandlerRegistry {
|
|
|
46
51
|
packet(packetName, handlerType) {
|
|
47
52
|
return this.addPacket(handlerType, packetName);
|
|
48
53
|
}
|
|
49
|
-
addActorPacketRegistration(kind, handlerType, actorType, packetName) {
|
|
54
|
+
addActorPacketRegistration(kind, handlerType, actorType, packetName, messageType) {
|
|
50
55
|
(0, handler_instance_scope_1.prepareHandlerInstance)(this.providerResolver, handlerType);
|
|
51
56
|
this.entries.push({
|
|
52
57
|
kind: kind === actors_1.ZLinkActorPacketKind.Send ? 'actorSend' : 'actorRequest',
|
|
53
58
|
handlerType,
|
|
59
|
+
...(messageType === undefined ? {} : { messageType: messageType }),
|
|
54
60
|
actorType,
|
|
55
61
|
packetName
|
|
56
62
|
});
|
|
@@ -58,17 +64,21 @@ class DefaultZLinkSpotHandlerRegistry {
|
|
|
58
64
|
kind,
|
|
59
65
|
packetName,
|
|
60
66
|
actorType,
|
|
61
|
-
handlerType
|
|
67
|
+
handlerType,
|
|
68
|
+
messageType: messageType
|
|
62
69
|
});
|
|
63
70
|
return this;
|
|
64
71
|
}
|
|
65
72
|
actorSend(packetName, handlerType, actorType = Object) {
|
|
66
|
-
return this.addActorPacketRegistration(actors_1.ZLinkActorPacketKind.Send, handlerType, actorType, packetName);
|
|
73
|
+
return this.addActorPacketRegistration(actors_1.ZLinkActorPacketKind.Send, handlerType, actorType, packetName, (0, HandlerMessageType_1.resolveHandlerMessageType)(handlerType));
|
|
67
74
|
}
|
|
68
75
|
actorRequest(packetName, handlerType, actorType = Object) {
|
|
69
|
-
return this.addActorPacketRegistration(actors_1.ZLinkActorPacketKind.Request, handlerType, actorType, packetName);
|
|
76
|
+
return this.addActorPacketRegistration(actors_1.ZLinkActorPacketKind.Request, handlerType, actorType, packetName, (0, HandlerMessageType_1.resolveHandlerMessageType)(handlerType));
|
|
70
77
|
}
|
|
71
78
|
addSubscribe(handlerType, channelName, topic) {
|
|
79
|
+
return this.addSubscriptionRegistration(handlerType, channelName, topic, (0, HandlerMessageType_1.resolveHandlerMessageType)(handlerType));
|
|
80
|
+
}
|
|
81
|
+
addSubscriptionRegistration(handlerType, channelName, topic, messageType) {
|
|
72
82
|
if (channelName.trim().length === 0) {
|
|
73
83
|
throw (0, framework_errors_internal_1.createInternalFrameworkException)(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.InvalidOperation, 'SPOT subscribe channel name must not be empty.');
|
|
74
84
|
}
|
|
@@ -82,7 +92,13 @@ class DefaultZLinkSpotHandlerRegistry {
|
|
|
82
92
|
throw (0, framework_errors_internal_1.createInternalFrameworkException)(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.InvalidOperation, `SPOT subscription '${channelName}/${topic}' is already registered.`);
|
|
83
93
|
}
|
|
84
94
|
(0, handler_instance_scope_1.prepareHandlerInstance)(this.providerResolver, handlerType);
|
|
85
|
-
this.entries.push({
|
|
95
|
+
this.entries.push({
|
|
96
|
+
kind: 'subscribe',
|
|
97
|
+
handlerType,
|
|
98
|
+
...(messageType === undefined ? {} : { messageType: messageType }),
|
|
99
|
+
channelName,
|
|
100
|
+
topic
|
|
101
|
+
});
|
|
86
102
|
return this;
|
|
87
103
|
}
|
|
88
104
|
subscribe(channelName, topic, handlerType) {
|
|
@@ -123,44 +139,44 @@ exports.DefaultZLinkInstanceSpotHandlerRegistry = DefaultZLinkInstanceSpotHandle
|
|
|
123
139
|
function applyEntrySpotHandlerRegistrations(registry, entrySpotType, registrations) {
|
|
124
140
|
for (const handler of registrations.actorSendHandlers ?? []) {
|
|
125
141
|
if (handler.entrySpotType === entrySpotType) {
|
|
126
|
-
registry.addActorPacketRegistration(actors_1.ZLinkActorPacketKind.Send, handler.handlerType, handler.actorType, handler.packetName);
|
|
142
|
+
registry.addActorPacketRegistration(actors_1.ZLinkActorPacketKind.Send, handler.handlerType, handler.actorType, handler.packetName, handler.messageType);
|
|
127
143
|
}
|
|
128
144
|
}
|
|
129
145
|
for (const handler of registrations.actorRequestHandlers ?? []) {
|
|
130
146
|
if (handler.entrySpotType === entrySpotType) {
|
|
131
|
-
registry.addActorPacketRegistration(actors_1.ZLinkActorPacketKind.Request, handler.handlerType, handler.actorType, handler.packetName);
|
|
147
|
+
registry.addActorPacketRegistration(actors_1.ZLinkActorPacketKind.Request, handler.handlerType, handler.actorType, handler.packetName, handler.messageType);
|
|
132
148
|
}
|
|
133
149
|
}
|
|
134
150
|
for (const handler of registrations.packetHandlers ?? []) {
|
|
135
151
|
if (handler.entrySpotType === entrySpotType) {
|
|
136
|
-
registry.
|
|
152
|
+
registry.addPacketRegistration(handler.handlerType, handler.packetName, handler.messageType);
|
|
137
153
|
}
|
|
138
154
|
}
|
|
139
155
|
for (const handler of registrations.subscriptionHandlers ?? []) {
|
|
140
156
|
if (handler.entrySpotType === entrySpotType) {
|
|
141
|
-
registry.
|
|
157
|
+
registry.addSubscriptionRegistration(handler.handlerType, handler.channelName, handler.topic, handler.messageType);
|
|
142
158
|
}
|
|
143
159
|
}
|
|
144
160
|
}
|
|
145
161
|
function applySpotHandlerRegistrations(registry, spotType, registrations) {
|
|
146
162
|
for (const handler of registrations.actorSendHandlers ?? []) {
|
|
147
163
|
if (isSpotImplementation(handler.spotType, spotType)) {
|
|
148
|
-
registry.addActorPacketRegistration(actors_1.ZLinkActorPacketKind.Send, handler.handlerType, handler.actorType, handler.packetName);
|
|
164
|
+
registry.addActorPacketRegistration(actors_1.ZLinkActorPacketKind.Send, handler.handlerType, handler.actorType, handler.packetName, handler.messageType);
|
|
149
165
|
}
|
|
150
166
|
}
|
|
151
167
|
for (const handler of registrations.actorRequestHandlers ?? []) {
|
|
152
168
|
if (isSpotImplementation(handler.spotType, spotType)) {
|
|
153
|
-
registry.addActorPacketRegistration(actors_1.ZLinkActorPacketKind.Request, handler.handlerType, handler.actorType, handler.packetName);
|
|
169
|
+
registry.addActorPacketRegistration(actors_1.ZLinkActorPacketKind.Request, handler.handlerType, handler.actorType, handler.packetName, handler.messageType);
|
|
154
170
|
}
|
|
155
171
|
}
|
|
156
172
|
for (const handler of registrations.packetHandlers ?? []) {
|
|
157
173
|
if (isSpotImplementation(handler.spotType, spotType)) {
|
|
158
|
-
registry.
|
|
174
|
+
registry.addPacketRegistration(handler.handlerType, handler.packetName, handler.messageType);
|
|
159
175
|
}
|
|
160
176
|
}
|
|
161
177
|
for (const handler of registrations.subscriptionHandlers ?? []) {
|
|
162
178
|
if (isSpotImplementation(handler.spotType, spotType)) {
|
|
163
|
-
registry.
|
|
179
|
+
registry.addSubscriptionRegistration(handler.handlerType, handler.channelName, handler.topic, handler.messageType);
|
|
164
180
|
}
|
|
165
181
|
}
|
|
166
182
|
}
|
|
@@ -47,12 +47,13 @@ class ZLinkPublicSpotManager {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
async close(spot, signal) {
|
|
50
|
+
const deadline = new Date(Date.now() + this.options.defaultTimeoutMs);
|
|
50
51
|
const resolved = await this.options.coordinator.resolveCloseTarget(spot, signal);
|
|
51
52
|
if (resolved === undefined)
|
|
52
53
|
return false;
|
|
53
54
|
const current = resolved.spot;
|
|
54
55
|
if (this.options.isLocalNode(current.meshName, current.nodeRid)) {
|
|
55
|
-
const closed = await this.options.coordinator.close(spot, (local, beginAuthority) => this.options.local.closeUserWithAuthority(local.meshName, local.spotId, beginAuthority, signal), signal);
|
|
56
|
+
const closed = await this.options.coordinator.close(spot, (local, beginAuthority) => this.options.local.closeUserWithAuthority(local.meshName, local.spotId, beginAuthority, signal, deadline), signal);
|
|
56
57
|
if (closed)
|
|
57
58
|
this.options.resolver()?.invalidate?.(spot.spotId);
|
|
58
59
|
return closed;
|
|
@@ -73,7 +74,7 @@ class ZLinkPublicSpotManager {
|
|
|
73
74
|
authorityOwnerGeneration: snapshot.authorityOwnerGeneration,
|
|
74
75
|
expectedStoreVersion: snapshot.storeVersion.value
|
|
75
76
|
},
|
|
76
|
-
deadlineUnixMs: BigInt(
|
|
77
|
+
deadlineUnixMs: BigInt(deadline.getTime())
|
|
77
78
|
}, timeoutMs);
|
|
78
79
|
if (result.terminalResult !== 0 || result.tail?.kind !== 'userSpotClose') {
|
|
79
80
|
const message = `Remote User Spot close failed. terminalResult=${result.terminalResult}, failureCode=${result.failureCode}.`;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RequestRuntime } from '../foundation/request-runtime';
|
|
1
2
|
import type { ZLinkMeshDispatchAdmission } from '../admission';
|
|
2
3
|
import type { ApplicationJobOrigin } from '../application-jobs/contracts';
|
|
3
4
|
import { type ActorRef, type RoutingId, type ZLinkActor, type ZLinkChannelClient, type ZLinkFanoutClient, type ZLinkMeshNodeDescriptor, type ZLinkMessage, type ZLinkMessageSerializer, type ZLinkSpotPublisherClient, ZLinkFrameworkRuntimeState } from '../../contracts';
|
|
@@ -19,10 +20,14 @@ import { ApplicationJobQueue } from '../host/application-job-queue';
|
|
|
19
20
|
import { ZLinkLocationRuntime, type ZLinkLocationEventSink, type ZLinkLocationRuntimeStores } from '../locations';
|
|
20
21
|
import { type ZLinkSubmitResult } from '../messaging/submission-result';
|
|
21
22
|
import type { ZLinkDetachedTaskRunner } from './spot-actor-join-dispatch';
|
|
23
|
+
import { ZLinkEntrySpotActivation } from './spot-entry-activation';
|
|
24
|
+
import { type ZLinkSpotNodeLocationAutoConnectContext } from './spot-node-autoconnect';
|
|
22
25
|
import type { ZLinkSpotRoutedTransport } from './spot-outbound';
|
|
23
26
|
import type { ZLinkSpotRouteResolver } from './spot-routing-internal';
|
|
24
27
|
import type { ZLinkEntryActorRuntime, ZLinkSpotActorHandoffRuntime, ZLinkSpotActorTransferRuntime, ZLinkSpotBoundSessionRuntime } from './spot-runtime-ports';
|
|
25
28
|
export interface ZLinkSpotNodeRuntimeManagerOptions {
|
|
29
|
+
readonly requests?: RequestRuntime;
|
|
30
|
+
readonly admission?: import('../admission').ZLinkRuntimeAdmissionGate;
|
|
26
31
|
readonly errorSink: import('../diagnostics/dispatch-error-port').ZLinkDispatchErrorSink;
|
|
27
32
|
readonly listenerRecords?: ZLinkListenerRecords;
|
|
28
33
|
readonly registration: ZLinkFrameworkRegistration;
|
|
@@ -54,11 +59,11 @@ export interface ZLinkSpotNodeRuntimeManagerOptions {
|
|
|
54
59
|
readonly activationConcurrency?: (meshName: string) => ZLinkActivationConcurrency;
|
|
55
60
|
}
|
|
56
61
|
export declare class ZLinkSpotNodeRuntimeManager {
|
|
57
|
-
|
|
58
|
-
|
|
62
|
+
readonly options: ZLinkSpotNodeRuntimeManagerOptions;
|
|
63
|
+
readonly meshNodes: Map<string, ZLinkBackendMeshNode>;
|
|
59
64
|
private readonly meshPumps;
|
|
60
65
|
private readonly meshCompletions;
|
|
61
|
-
|
|
66
|
+
readonly entryActivations: Map<string, ZLinkEntrySpotActivation>;
|
|
62
67
|
private readonly entryActivationStarts;
|
|
63
68
|
private readonly publishers;
|
|
64
69
|
private readonly disposal;
|
|
@@ -70,8 +75,8 @@ export declare class ZLinkSpotNodeRuntimeManager {
|
|
|
70
75
|
private readonly runtimeChannelWeights;
|
|
71
76
|
private readonly entrySpotIds;
|
|
72
77
|
private runtimeWeightPublication;
|
|
73
|
-
|
|
74
|
-
|
|
78
|
+
statePublication: Promise<void>;
|
|
79
|
+
locationAutoConnect?: ZLinkSpotNodeLocationAutoConnectContext;
|
|
75
80
|
private readonly applicationJobQueue;
|
|
76
81
|
constructor(options: ZLinkSpotNodeRuntimeManagerOptions);
|
|
77
82
|
createTopicMessage(): import("../backend/runtime-values").ZLinkBackendTopicMessage;
|
|
@@ -125,7 +130,7 @@ export declare class ZLinkSpotNodeRuntimeManager {
|
|
|
125
130
|
private dispatchFrameworkRecord;
|
|
126
131
|
dispatchEntrySpotRecord(meshName: string, owner: ReadyRecord, record: ReceiveRecord, admit?: ZLinkMeshDispatchAdmission): Promise<boolean>;
|
|
127
132
|
private ensureEntryActivation;
|
|
128
|
-
|
|
133
|
+
initializeEntrySpot(spotNodeName: string, node: ZLinkBackendMeshNode, spotNode: ZLinkSpotNodeOptions): Promise<void>;
|
|
129
134
|
private primaryEntryActivation;
|
|
130
135
|
dispatchEntryActorPacket(origin: ApplicationJobOrigin, actorId: string, parts: readonly Message[], returnResponse?: boolean, remoteBoundSessionTarget?: ZLinkRemoteBoundSessionTarget, fallbackActorRef?: ActorRef, requestTerminal?: (response: unknown) => Promise<void> | void, messageFollowOrigin?: ZLinkMessageFollowOrigin): Promise<unknown>;
|
|
131
136
|
dispatchEntryActorJoin(meshName: string, actor: ZLinkActor, handoffBacklog?: readonly ZLinkActorHandoffPacket[]): Promise<void>;
|
|
@@ -148,12 +148,16 @@ class ZLinkSpotNodeRuntimeManager {
|
|
|
148
148
|
const node = meshAdapter.createMeshNode(this.options.context, {
|
|
149
149
|
meshName: spotNodeName,
|
|
150
150
|
routingId,
|
|
151
|
+
sendHighWaterMark: spotNode.router?.sendHighWaterMark,
|
|
152
|
+
receiveHighWaterMark: spotNode.router?.receiveHighWaterMark,
|
|
151
153
|
receiveTimeoutMs: spotNode.router?.receiveTimeoutMs,
|
|
152
154
|
applicationJobQueue: this.applicationJobQueue,
|
|
153
155
|
infrastructureTaskRunner: this.options.detachedTaskRunner,
|
|
154
156
|
applicationJobReceiveFlowFailureSink: this.options.applicationJobReceiveFlowFailureSink,
|
|
155
157
|
peerAdmissionSealed: () => this.options.peerAdmissionSealed?.(spotNodeName) ?? false
|
|
156
158
|
});
|
|
159
|
+
if (this.options.requests !== undefined)
|
|
160
|
+
node.setRequestRuntime?.(this.options.requests);
|
|
157
161
|
if (this.options.dispatchErrors !== undefined) {
|
|
158
162
|
node.setDispatchErrorReporter?.(this.options.dispatchErrors, spotNodeName);
|
|
159
163
|
}
|
|
@@ -685,7 +689,7 @@ class ZLinkSpotNodeRuntimeManager {
|
|
|
685
689
|
}
|
|
686
690
|
const envelope = (0, channel_envelope_1.decodeChannelEnvelope)(record.parts, undefined, this.options.dispatchErrors?.flow.flowCreationEnabled() ?? true);
|
|
687
691
|
const codecs = { serializers: this.options.registration.messageSerializers };
|
|
688
|
-
const decodePayload = () => (0, channel_envelope_1.decodeChannelPayload)(envelope, codecs);
|
|
692
|
+
const decodePayload = (messageType) => (0, channel_envelope_1.decodeChannelPayload)(envelope, codecs, messageType);
|
|
689
693
|
const context = {
|
|
690
694
|
channelName: envelope.header.channelName,
|
|
691
695
|
contentType: envelope.header.contentType
|
|
@@ -738,6 +742,7 @@ class ZLinkSpotNodeRuntimeManager {
|
|
|
738
742
|
return;
|
|
739
743
|
}
|
|
740
744
|
const activation = new spot_entry_activation_1.ZLinkEntrySpotActivation({
|
|
745
|
+
admission: this.options.admission,
|
|
741
746
|
entrySpotType: spotNode.entrySpotType,
|
|
742
747
|
nativeSpot: node.entrySpot(),
|
|
743
748
|
nativeNode: node,
|
|
@@ -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 RoutingId, type ZLinkChannelClient, type ZLinkChannelRequestCall, type ZLinkPublishCall, type ZLinkSendCall, type ZLinkSpotOutbound, type ZLinkSpotPublisherClient, type ZLinkSpotRequestCall, type ZLinkSpotSendCall } from '../../contracts';
|
|
2
4
|
import type { ZLinkBackendSpot } from '../backend/contracts';
|
|
3
5
|
import { type ZLinkSubmitResult } from '../messaging/submission-result';
|
|
@@ -41,6 +43,7 @@ export interface ZLinkSpotAddressCallOptions {
|
|
|
41
43
|
readonly instanceSpotType?: string;
|
|
42
44
|
readonly initialMeshName?: string;
|
|
43
45
|
readonly timeoutMs?: number;
|
|
46
|
+
readonly requestOperation?: PendingOperation<unknown>;
|
|
44
47
|
readonly signal?: AbortSignal;
|
|
45
48
|
readonly sourceSpot?: ZLinkBackendSpot;
|
|
46
49
|
}
|
|
@@ -55,8 +58,8 @@ export interface ZLinkSpotAddressTransport {
|
|
|
55
58
|
export interface ZLinkSpotRoutedTransport {
|
|
56
59
|
sendToSpot(spotRouteTarget: ZLinkSpotRouteTarget, message: unknown, options: ZLinkSpotRoutedSendOptions): Promise<ZLinkSubmitResult>;
|
|
57
60
|
sendFromSpotToSpot?(sourceSpot: ZLinkBackendSpot, spotRouteTarget: ZLinkSpotRouteTarget, message: unknown, options: ZLinkSpotRoutedSendOptions): Promise<ZLinkSubmitResult>;
|
|
58
|
-
requestToSpot<TReply = unknown>(spotRouteTarget: ZLinkSpotRouteTarget, request: unknown, options: ZLinkSpotRoutedRequestOptions):
|
|
59
|
-
requestFromSpotToSpot?<TReply = unknown>(sourceSpot: ZLinkBackendSpot, spotRouteTarget: ZLinkSpotRouteTarget, request: unknown, options: ZLinkSpotRoutedRequestOptions):
|
|
61
|
+
requestToSpot<TReply = unknown>(spotRouteTarget: ZLinkSpotRouteTarget, request: unknown, options: ZLinkSpotRoutedRequestOptions, destination?: OperationObserver<unknown, unknown>): ZLinkRequestResult<TReply>;
|
|
62
|
+
requestFromSpotToSpot?<TReply = unknown>(sourceSpot: ZLinkBackendSpot, spotRouteTarget: ZLinkSpotRouteTarget, request: unknown, options: ZLinkSpotRoutedRequestOptions, destination?: OperationObserver<unknown, unknown>): ZLinkRequestResult<TReply>;
|
|
60
63
|
}
|
|
61
64
|
export interface ZLinkSpotRoutedSendOptions {
|
|
62
65
|
readonly instanceSpot?: boolean;
|
|
@@ -64,14 +67,17 @@ export interface ZLinkSpotRoutedSendOptions {
|
|
|
64
67
|
readonly metadata?: ReadonlyMap<string, string>;
|
|
65
68
|
}
|
|
66
69
|
export interface ZLinkSpotRoutedRequestOptions extends ZLinkSpotRoutedSendOptions {
|
|
70
|
+
readonly deadlineMs?: number;
|
|
67
71
|
readonly onAdmitted?: () => void;
|
|
68
72
|
readonly timeoutMs?: number;
|
|
73
|
+
readonly requestOperation?: PendingOperation<unknown>;
|
|
69
74
|
readonly signal?: AbortSignal;
|
|
70
75
|
}
|
|
71
76
|
export interface ZLinkSpotHandleCallOptions {
|
|
72
77
|
readonly onAdmitted?: () => void;
|
|
73
78
|
readonly metadata?: ReadonlyMap<string, string>;
|
|
74
79
|
readonly timeoutMs?: number;
|
|
80
|
+
readonly requestOperation?: PendingOperation<unknown>;
|
|
75
81
|
readonly signal?: AbortSignal;
|
|
76
82
|
readonly spotRouterChannelIdForMesh?: (meshName: string) => string;
|
|
77
83
|
readonly sourceSpot?: ZLinkBackendSpot;
|
|
@@ -155,7 +155,7 @@ function createAddressedSpotRequestCall(serial, transport, spotId, request, sour
|
|
|
155
155
|
submit(signal) {
|
|
156
156
|
markSubmitted(options);
|
|
157
157
|
rejectSameSpotAsyncRequest(serial, spotId, 'async');
|
|
158
|
-
return (0, request_result_1.createZLinkRequest)((onAdmitted) => begin(signal, onAdmitted), (pending) => (serial.isCurrentTurn ? pending : (0, workers_1.deliverOnSerial)(serial, pending)));
|
|
158
|
+
return (0, request_result_1.createZLinkRequest)((onAdmitted) => (0, request_result_1.prepareZLinkRequestReply)(begin(signal, onAdmitted), request_result_1.identityRequestReply), (pending) => (serial.isCurrentTurn ? pending : (0, workers_1.deliverOnSerial)(serial, pending)));
|
|
159
159
|
},
|
|
160
160
|
yield(signal) {
|
|
161
161
|
const turn = (0, execution_1.requireZLinkYieldTurn)();
|
|
@@ -272,7 +272,7 @@ function wrapRequestCall(serial, inner) {
|
|
|
272
272
|
return this;
|
|
273
273
|
},
|
|
274
274
|
submit(signal) {
|
|
275
|
-
return (0, request_result_1.createZLinkRequest)((onAdmitted) => begin(signal, onAdmitted), (pending) => (serial.isCurrentTurn ? pending : (0, workers_1.deliverOnSerial)(serial, pending)));
|
|
275
|
+
return (0, request_result_1.createZLinkRequest)((onAdmitted) => (0, request_result_1.prepareZLinkRequestReply)(begin(signal, onAdmitted), request_result_1.identityRequestReply), (pending) => (serial.isCurrentTurn ? pending : (0, workers_1.deliverOnSerial)(serial, pending)));
|
|
276
276
|
},
|
|
277
277
|
yield(signal) {
|
|
278
278
|
const turn = (0, execution_1.requireZLinkYieldTurn)();
|
|
@@ -360,7 +360,7 @@ function wrapRoutedSpotRequestCall(serial, transport, spot, request, spotRouterC
|
|
|
360
360
|
},
|
|
361
361
|
submit(signal) {
|
|
362
362
|
rejectSameSpotAsyncRequest(serial, spot.spotId, 'async');
|
|
363
|
-
return (0, request_result_1.createZLinkRequest)((onAdmitted) => begin(signal, onAdmitted), (pending) => (serial.isCurrentTurn ? pending : (0, workers_1.deliverOnSerial)(serial, pending)));
|
|
363
|
+
return (0, request_result_1.createZLinkRequest)((onAdmitted) => (0, request_result_1.prepareZLinkRequestReply)(begin(signal, onAdmitted), request_result_1.identityRequestReply), (pending) => (serial.isCurrentTurn ? pending : (0, workers_1.deliverOnSerial)(serial, pending)));
|
|
364
364
|
},
|
|
365
365
|
yield(signal) {
|
|
366
366
|
const turn = (0, execution_1.requireZLinkYieldTurn)();
|
|
@@ -397,7 +397,7 @@ async function sendToSpotHandle(transport, spot, message, options = {}) {
|
|
|
397
397
|
}
|
|
398
398
|
async function requestToSpotHandle(transport, spot, request, options = {}) {
|
|
399
399
|
const packetName = (0, packet_name_1.resolveFrameworkPacketName)(request, undefined, 'SPOT');
|
|
400
|
-
const requestResolved =
|
|
400
|
+
const requestResolved = (resolved) => {
|
|
401
401
|
const target = spotRefToSpotRouteTarget(resolved, options.spotRouterChannelIdForMesh);
|
|
402
402
|
const transportOptions = {
|
|
403
403
|
packetName,
|
|
@@ -411,7 +411,7 @@ async function requestToSpotHandle(transport, spot, request, options = {}) {
|
|
|
411
411
|
}
|
|
412
412
|
return transport.requestToSpot(target, request, transportOptions);
|
|
413
413
|
};
|
|
414
|
-
return requestResolved(await requireSpotRef(spot, options.signal));
|
|
414
|
+
return (0, request_result_1.mapZLinkRequestReply)(requestResolved(await requireSpotRef(spot, options.signal)));
|
|
415
415
|
}
|
|
416
416
|
async function requireSpotRef(handle, signal) {
|
|
417
417
|
const resolved = await (0, spot_handle_1.resolveSpotHandle)(handle, signal);
|
|
@@ -12,6 +12,7 @@ const flow_context_1 = require("../diagnostics/flow-context");
|
|
|
12
12
|
const serial_work_size_1 = require("../execution/serial-work-size");
|
|
13
13
|
const framework_errors_internal_1 = require("../framework-errors-internal");
|
|
14
14
|
const handler_instance_scope_1 = require("../handlers/handler-instance-scope");
|
|
15
|
+
const HandlerMessageType_1 = require("../../contracts/Common/HandlerMessageType");
|
|
15
16
|
const spot_remote_codec_1 = require("./spot-remote-codec");
|
|
16
17
|
const spot_route_replies_1 = require("./spot-route-replies");
|
|
17
18
|
/** D5: reply metadata attached only to framework-self-generated errors. */
|
|
@@ -24,9 +25,10 @@ class ZLinkSpotRoutePacketDispatch {
|
|
|
24
25
|
this.options = options;
|
|
25
26
|
}
|
|
26
27
|
async dispatch(received) {
|
|
28
|
+
const receivedAt = new Date();
|
|
27
29
|
const directEnvelope = decodeSpotDirectEnvelope(received.parts);
|
|
28
30
|
if (directEnvelope !== undefined) {
|
|
29
|
-
await this.dispatchSpotDirectEnvelope(received, directEnvelope);
|
|
31
|
+
await this.dispatchSpotDirectEnvelope(received, directEnvelope, receivedAt);
|
|
30
32
|
return true;
|
|
31
33
|
}
|
|
32
34
|
let envelope;
|
|
@@ -77,7 +79,8 @@ class ZLinkSpotRoutePacketDispatch {
|
|
|
77
79
|
contentType: envelope.header.contentType,
|
|
78
80
|
packetName: envelope.packetName,
|
|
79
81
|
metadata: (0, contracts_1.zlinkMessageMetadata)(envelope.header.metadata),
|
|
80
|
-
correlationId: envelope.header.correlationId ?? undefined
|
|
82
|
+
correlationId: envelope.header.correlationId ?? undefined,
|
|
83
|
+
receivedAt
|
|
81
84
|
};
|
|
82
85
|
try {
|
|
83
86
|
let response;
|
|
@@ -88,7 +91,7 @@ class ZLinkSpotRoutePacketDispatch {
|
|
|
88
91
|
// Keep the wire payload raw until this Spot has acquired its
|
|
89
92
|
// execution authority. A rejected or superseded work item must not
|
|
90
93
|
// pay the deserialization cost.
|
|
91
|
-
const payload = (0, channel_envelope_1.decodeChannelPayload)(envelope, this.channelCodecs());
|
|
94
|
+
const payload = (0, channel_envelope_1.decodeChannelPayload)(envelope, this.channelCodecs(), (0, HandlerMessageType_1.resolveMessageTypeForDecode)(registrations[0]?.messageType));
|
|
92
95
|
for (const registration of registrations) {
|
|
93
96
|
const handler = await (0, handler_instance_scope_1.resolveLifecycleHandler)(spot, registration.handlerType, this.options.providerResolver);
|
|
94
97
|
(0, application_job_queue_scope_1.releaseApplicationJobPermitBeforeHandler)();
|
|
@@ -132,7 +135,7 @@ class ZLinkSpotRoutePacketDispatch {
|
|
|
132
135
|
return true;
|
|
133
136
|
}
|
|
134
137
|
}
|
|
135
|
-
async dispatchSpotDirectEnvelope(received, envelope) {
|
|
138
|
+
async dispatchSpotDirectEnvelope(received, envelope, receivedAt) {
|
|
136
139
|
const replyable = envelope.kind === 1 /* ZLinkChannelMessageKind.Request */ && (0, spot_route_replies_1.hasReplyToken)(received.replyToken);
|
|
137
140
|
const messageKind = replyable
|
|
138
141
|
? ZLinkDispatchOptions_1.ZLinkDispatchMessageKind.Request
|
|
@@ -161,13 +164,15 @@ class ZLinkSpotRoutePacketDispatch {
|
|
|
161
164
|
const spot = this.options.getTarget();
|
|
162
165
|
for (const registration of registrations) {
|
|
163
166
|
const handler = await (0, handler_instance_scope_1.resolveLifecycleHandler)(spot, registration.handlerType, this.options.providerResolver);
|
|
164
|
-
|
|
165
|
-
response = await handler.handle(spot, envelope.payload, {
|
|
167
|
+
const handlerContext = {
|
|
166
168
|
channelName: envelope.channelName,
|
|
167
169
|
packetName: envelope.packetName,
|
|
168
170
|
metadata: (0, contracts_1.zlinkMessageMetadata)(envelope.metadata),
|
|
169
|
-
correlationId: undefined
|
|
170
|
-
|
|
171
|
+
correlationId: undefined,
|
|
172
|
+
receivedAt
|
|
173
|
+
};
|
|
174
|
+
(0, application_job_queue_scope_1.releaseApplicationJobPermitBeforeHandler)();
|
|
175
|
+
response = await handler.handle(spot, envelope.payload, handlerContext);
|
|
171
176
|
}
|
|
172
177
|
}, (0, serial_work_size_1.zlinkSerialWorkOptions)(received.parts[0]?.size() ?? 0, (0, serial_work_size_1.zlinkMetadataByteLength)(envelope.metadata)));
|
|
173
178
|
if (replyable) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RoutingId, ZLinkSpot } from '../../contracts';
|
|
1
|
+
import type { RoutingId, Type, ZLinkSpot } from '../../contracts';
|
|
2
2
|
import type { ZLinkProviderResolver } from '../../contracts/Common/ZLinkProviderResolver';
|
|
3
3
|
import type { ZLinkApplicationWorkClaim } from '../admission';
|
|
4
4
|
import type { ZLinkDispatchErrorReporter } from '../channels';
|
|
@@ -38,9 +38,9 @@ export declare class ZLinkRoutedSpotPacketDispatch {
|
|
|
38
38
|
private readonly options;
|
|
39
39
|
constructor(options: ZLinkRoutedSpotPacketDispatchOptions);
|
|
40
40
|
send(spotId: RoutingId, packetName: string | undefined, message: unknown, context: ZLinkRoutedSpotPacketContext): Promise<void>;
|
|
41
|
-
sendEncoded(spotId: RoutingId, packetName: string | undefined, decodePayload: () => unknown, context: ZLinkRoutedSpotPacketContext): Promise<void>;
|
|
41
|
+
sendEncoded(spotId: RoutingId, packetName: string | undefined, decodePayload: (messageType?: Type) => unknown, context: ZLinkRoutedSpotPacketContext): Promise<void>;
|
|
42
42
|
request<TReply>(spotId: RoutingId, packetName: string | undefined, request: unknown, context: ZLinkRoutedSpotPacketContext): Promise<TReply>;
|
|
43
|
-
requestEncoded<TReply>(spotId: RoutingId, packetName: string | undefined, decodePayload: () => unknown, context: ZLinkRoutedSpotPacketContext): Promise<TReply>;
|
|
43
|
+
requestEncoded<TReply>(spotId: RoutingId, packetName: string | undefined, decodePayload: (messageType?: Type) => unknown, context: ZLinkRoutedSpotPacketContext): Promise<TReply>;
|
|
44
44
|
private dispatch;
|
|
45
45
|
private reportFailure;
|
|
46
46
|
private reportMissing;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ZLinkRoutedSpotPacketDispatch = void 0;
|
|
4
4
|
const dispatch_error_details_1 = require("../diagnostics/dispatch-error-details");
|
|
5
5
|
const contracts_1 = require("../../contracts");
|
|
6
|
+
const HandlerMessageType_1 = require("../../contracts/Common/HandlerMessageType");
|
|
6
7
|
const ZLinkDispatchOptions_1 = require("../../contracts/Dispatch/ZLinkDispatchOptions");
|
|
7
8
|
const configuration_1 = require("../configuration");
|
|
8
9
|
const framework_errors_internal_1 = require("../framework-errors-internal");
|
|
@@ -26,6 +27,7 @@ class ZLinkRoutedSpotPacketDispatch {
|
|
|
26
27
|
return (await this.dispatch(spotId, packetName, decodePayload, context, true));
|
|
27
28
|
}
|
|
28
29
|
async dispatch(spotId, packetName, decodePayload, context, returnResponse) {
|
|
30
|
+
const receivedAt = new Date();
|
|
29
31
|
const activation = this.options.resolveActivation(spotId);
|
|
30
32
|
if (activation === undefined) {
|
|
31
33
|
this.reportMissing(spotId, packetName, context, returnResponse);
|
|
@@ -87,19 +89,21 @@ class ZLinkRoutedSpotPacketDispatch {
|
|
|
87
89
|
(packetName ?? ''));
|
|
88
90
|
// Decode only after the Spot has acquired both application admission
|
|
89
91
|
// and its execution authority.
|
|
90
|
-
const payload = decodePayload();
|
|
92
|
+
const payload = decodePayload((0, HandlerMessageType_1.resolveMessageTypeForDecode)(currentRegistrations[0]?.messageType));
|
|
91
93
|
for (const registration of currentRegistrations) {
|
|
92
94
|
const handler = await (0, handler_instance_scope_1.resolveLifecycleHandler)(current.spot, registration.handlerType, this.options.providerResolver);
|
|
93
95
|
resolveFirstHandlerTurn?.();
|
|
94
96
|
resolveFirstHandlerTurn = undefined;
|
|
95
97
|
context.activationRecord?.onHandlerTurnStarted?.();
|
|
96
|
-
|
|
97
|
-
response = await handler.handle(current.spot, payload, {
|
|
98
|
+
const handlerContext = {
|
|
98
99
|
channelName: context.channelName,
|
|
99
100
|
contentType: context.contentType,
|
|
100
101
|
packetName: packetName,
|
|
101
|
-
metadata: (0, contracts_1.zlinkMessageMetadata)({})
|
|
102
|
-
|
|
102
|
+
metadata: (0, contracts_1.zlinkMessageMetadata)({}),
|
|
103
|
+
receivedAt
|
|
104
|
+
};
|
|
105
|
+
(0, application_job_queue_scope_1.releaseApplicationJobPermitBeforeHandler)();
|
|
106
|
+
response = await handler.handle(current.spot, payload, handlerContext);
|
|
103
107
|
}
|
|
104
108
|
}
|
|
105
109
|
catch (error) {
|
|
@@ -12,10 +12,10 @@ export interface ZLinkEntryActorRuntime {
|
|
|
12
12
|
resolveActor(actorId: string): ZLinkActor | undefined;
|
|
13
13
|
commitActorTransaction(actor: ZLinkActor, onJoined: () => Promise<void>): Promise<void>;
|
|
14
14
|
destroyActor(node: ZLinkBackendSpotNode, entryNodeRid: RoutingId, actor: ZLinkActor, signal?: AbortSignal): Promise<void>;
|
|
15
|
-
routePacket(actorId: string, parts: readonly Message[], returnResponse?: boolean, remoteBoundSessionTarget?: ZLinkRemoteBoundSessionTarget, fallbackActorRef?: ActorRef):
|
|
15
|
+
routePacket(actorId: string, parts: readonly Message[], returnResponse?: boolean, remoteBoundSessionTarget?: ZLinkRemoteBoundSessionTarget, fallbackActorRef?: ActorRef, origin?: ApplicationJobOrigin, requestTerminal?: import('./spot-actor-packet-dispatch').ZLinkActorRequestTerminal, messageFollowOrigin?: ZLinkMessageFollowOrigin): {
|
|
16
16
|
readonly handled: boolean;
|
|
17
17
|
readonly response?: unknown;
|
|
18
|
-
}
|
|
18
|
+
};
|
|
19
19
|
}
|
|
20
20
|
export interface ZLinkSpotActorTransferRuntime {
|
|
21
21
|
prepareDeferredJoinAccepted(actorId: string, operationId: ZLinkActorJoinOperationId, actorRef: ActorRef, rawReply: Uint8Array, replyContentType?: string): ZLinkDeferredJoinCompletion;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ZLinkUserSpotExecutionMode } from '../../contracts';
|
|
2
|
+
import { ZLinkActorSerialExecutor } from '../actors';
|
|
2
3
|
import type { ZLinkActorHandoffDispatch, ZLinkActorHandoffPrefixAdmission, ZLinkActorHandoffPrefixRecord } from '../actors/actor-handoff';
|
|
3
4
|
import type { ZLinkExecutionBarrier } from '../execution';
|
|
4
5
|
import type { ZLinkSerialSchedulerOptions, ZLinkSerialWorkOptions } from '../execution/serial-execution-queue';
|
|
@@ -18,7 +19,7 @@ export declare class ZLinkSpotSerialExecutor {
|
|
|
18
19
|
private readonly actorOptions?;
|
|
19
20
|
private readonly actorSerials;
|
|
20
21
|
private readonly timerSerials;
|
|
21
|
-
|
|
22
|
+
readonly actorExecutors: Map<string, ZLinkActorSerialExecutor>;
|
|
22
23
|
private executionBarrier;
|
|
23
24
|
private closing;
|
|
24
25
|
private closePromise;
|
|
@@ -100,7 +100,7 @@ class ZLinkSpotSerialTurnExecutor {
|
|
|
100
100
|
* Queues a one-way turn in serial order. Handler completion is reported
|
|
101
101
|
* through `onError` and never blocks the sender turn.
|
|
102
102
|
*/
|
|
103
|
-
async postOneWay(operation, onError, workOptions
|
|
103
|
+
async postOneWay(operation, onError, workOptions, admission, replay) {
|
|
104
104
|
this.lastActivityAtMs = performance.now();
|
|
105
105
|
let barrierClaim;
|
|
106
106
|
try {
|
|
@@ -112,17 +112,13 @@ class ZLinkSpotSerialTurnExecutor {
|
|
|
112
112
|
if (barrierClaim !== undefined && replay !== undefined) {
|
|
113
113
|
Object.assign(barrierClaim, { replay: (0, application_job_queue_scope_1.bindApplicationJobPermit)(replay) });
|
|
114
114
|
}
|
|
115
|
-
if (admission
|
|
115
|
+
if (admission?.signal?.aborted === true) {
|
|
116
116
|
throw new DOMException('The operation was aborted.', 'AbortError');
|
|
117
117
|
}
|
|
118
|
-
const options = {
|
|
119
|
-
...workOptions,
|
|
120
|
-
lane: workOptions.lane ?? 'application'
|
|
121
|
-
};
|
|
122
118
|
const boundOperation = (0, application_job_queue_scope_1.bindApplicationJobPermit)(operation);
|
|
123
119
|
const submitted = (0, application_job_queue_scope_1.hasApplicationJobPermit)()
|
|
124
|
-
? this.scheduler.submitPreAdmitted(boundOperation,
|
|
125
|
-
: this.scheduler.submit(boundOperation,
|
|
120
|
+
? this.scheduler.submitPreAdmitted(boundOperation, workOptions, barrierClaim)
|
|
121
|
+
: this.scheduler.submit(boundOperation, workOptions, barrierClaim);
|
|
126
122
|
void submitted.catch((error) => {
|
|
127
123
|
barrierClaim?.release();
|
|
128
124
|
onError(error);
|
|
@@ -187,7 +183,7 @@ class ZLinkSpotSerialTurnExecutor {
|
|
|
187
183
|
visitPendingApplication(visitor) {
|
|
188
184
|
this.scheduler.visitPendingApplication(visitor);
|
|
189
185
|
}
|
|
190
|
-
async enqueueApplicationTurn(operation, workOptions
|
|
186
|
+
async enqueueApplicationTurn(operation, workOptions, replay, retainWhilePreparing = false) {
|
|
191
187
|
this.lastActivityAtMs = performance.now();
|
|
192
188
|
let barrierClaim;
|
|
193
189
|
try {
|
|
@@ -217,7 +213,7 @@ class ZLinkSpotSerialTurnExecutor {
|
|
|
217
213
|
throw error;
|
|
218
214
|
}
|
|
219
215
|
}
|
|
220
|
-
async enqueueFrameworkTurn(operation, workOptions
|
|
216
|
+
async enqueueFrameworkTurn(operation, workOptions) {
|
|
221
217
|
this.lastActivityAtMs = performance.now();
|
|
222
218
|
// Application admission crosses the async barrier boundary before it
|
|
223
219
|
// reaches the scheduler. Give an already-authorized framework turn that
|
|
@@ -231,28 +227,30 @@ class ZLinkSpotSerialTurnExecutor {
|
|
|
231
227
|
return await this.scheduler.submitContinuation(operation);
|
|
232
228
|
}
|
|
233
229
|
submitQueuedTurn(operation, workOptions, barrierClaim) {
|
|
234
|
-
const options = {
|
|
235
|
-
...workOptions,
|
|
236
|
-
lane: workOptions.lane ?? 'application'
|
|
237
|
-
};
|
|
238
230
|
const boundOperation = (0, application_job_queue_scope_1.bindApplicationJobPermit)(operation);
|
|
239
231
|
return (0, application_job_queue_scope_1.hasApplicationJobPermit)()
|
|
240
|
-
? this.scheduler.submitPreAdmitted(boundOperation,
|
|
241
|
-
: this.scheduler.submit(boundOperation,
|
|
232
|
+
? this.scheduler.submitPreAdmitted(boundOperation, workOptions, barrierClaim)
|
|
233
|
+
: this.scheduler.submit(boundOperation, workOptions, barrierClaim);
|
|
242
234
|
}
|
|
243
235
|
runQueuedRecord(record) {
|
|
244
236
|
if (record.context instanceof Promise) {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
237
|
+
// Branch-local captures keep the synchronous path free of a V8 function context.
|
|
238
|
+
const executor = this;
|
|
239
|
+
const work = record;
|
|
240
|
+
const pending = record.context;
|
|
241
|
+
return pending.then((claim) => {
|
|
242
|
+
Object.assign(work, { context: claim });
|
|
243
|
+
return executor.runQueuedRecord(work);
|
|
248
244
|
});
|
|
249
245
|
}
|
|
250
246
|
const context = record.context;
|
|
251
247
|
if (context?.replay !== undefined && record.operation === context.replay) {
|
|
252
248
|
context.release();
|
|
253
|
-
|
|
249
|
+
const executor = this;
|
|
250
|
+
const work = record;
|
|
251
|
+
return Promise.resolve(executor.executionBarrier?.enter()).then((claim) => executor.runTurn(work.operation, work.resolve, work.reject, claim, work.release));
|
|
254
252
|
}
|
|
255
|
-
return this.runTurn(record.operation,
|
|
253
|
+
return this.runTurn(record.operation, record.resolve, record.reject, record.context, record.release);
|
|
256
254
|
}
|
|
257
255
|
yieldPromise(pending) {
|
|
258
256
|
const turn = this.currentTurn;
|
|
@@ -286,11 +284,7 @@ class ZLinkSpotSerialTurnExecutor {
|
|
|
286
284
|
turn.releaseBoundExecutionClaim();
|
|
287
285
|
release?.();
|
|
288
286
|
});
|
|
289
|
-
owner.then(resolve, reject);
|
|
290
|
-
return Promise.race([
|
|
291
|
-
owner.then(() => undefined, () => undefined),
|
|
292
|
-
turn.suspended
|
|
293
|
-
]);
|
|
287
|
+
return Promise.race([owner.then(resolve, reject), turn.suspended]);
|
|
294
288
|
}
|
|
295
289
|
postResume(turn, resume, reject) {
|
|
296
290
|
if (!turn.resumeExecutionClaim()) {
|