@zlink-systems/framework 0.30.0 → 0.30.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +150 -68
- package/dist/.tsbuildinfo +1 -1
- package/dist/contracts/Actors/ZLinkActorClient.d.ts +2 -1
- package/dist/contracts/Channels/Calls.d.ts +2 -1
- package/dist/contracts/Common/ZLinkEncodedPayload.d.ts +6 -0
- package/dist/contracts/Common/ZLinkEncodedPayload.js +18 -3
- package/dist/contracts/Common/ZLinkMessageMetadata.js +11 -5
- package/dist/contracts/Common/encoded-payload-storage.d.ts +1 -1
- package/dist/contracts/Common/encoded-payload-storage.js +5 -2
- package/dist/contracts/Configuration/Builders.d.ts +1 -1
- package/dist/contracts/Configuration/RegistrationBuilderPolicy.d.ts +2 -1
- package/dist/contracts/Configuration/RegistrationBuilderPolicy.js +5 -1
- package/dist/contracts/Configuration/RegistrationBuilders.js +2 -2
- package/dist/contracts/Configuration/RegistrationTypes.d.ts +1 -0
- package/dist/contracts/Dispatch/ZLinkDispatchOptions.d.ts +2 -2
- package/dist/contracts/Handlers/Attributes.d.ts +5 -13
- package/dist/contracts/Handlers/Attributes.js +7 -11
- package/dist/contracts/Handlers/JsonContract.d.ts +2 -46
- package/dist/contracts/Handlers/JsonContract.js +4 -153
- package/dist/contracts/Locations/Rows.d.ts +2 -0
- package/dist/contracts/Spots/Contracts.d.ts +6 -1
- package/dist/contracts/Spots/ZLinkSpot.d.ts +3 -3
- package/dist/nest-integration.d.ts +1 -1
- package/dist/nest-integration.js +2 -1
- package/dist/runtime/abort.d.ts +5 -0
- package/dist/runtime/abort.js +10 -0
- package/dist/runtime/actors/actor-authority-publication.js +3 -2
- package/dist/runtime/actors/actor-client.d.ts +1 -2
- package/dist/runtime/actors/actor-client.js +52 -57
- package/dist/runtime/actors/actor-context.d.ts +2 -0
- package/dist/runtime/actors/actor-context.js +46 -9
- package/dist/runtime/actors/actor-handoff.d.ts +8 -4
- package/dist/runtime/actors/actor-handoff.js +219 -92
- package/dist/runtime/actors/actor-join-relocation.d.ts +3 -0
- package/dist/runtime/actors/actor-local-native-join.js +13 -12
- package/dist/runtime/actors/actor-mailbox.js +27 -1
- package/dist/runtime/actors/actor-remote-joiner.js +3 -1
- package/dist/runtime/actors/actor-remote-wire.js +15 -0
- package/dist/runtime/actors/actor-reply.d.ts +4 -0
- package/dist/runtime/actors/actor-reply.js +29 -0
- package/dist/runtime/actors/actor-routed-join-transport.d.ts +6 -2
- package/dist/runtime/actors/actor-routed-json-request.d.ts +2 -0
- package/dist/runtime/actors/actor-runtime-contracts.d.ts +2 -0
- package/dist/runtime/actors/actor-runtime-state.js +2 -20
- package/dist/runtime/actors/actor-source-transfer.d.ts +1 -17
- package/dist/runtime/actors/index.d.ts +8 -3
- package/dist/runtime/actors/index.js +55 -27
- package/dist/runtime/actors/session-disconnected-wire.d.ts +8 -0
- package/dist/runtime/actors/session-disconnected-wire.js +48 -0
- package/dist/runtime/actors/spot-actor-dispatch.js +2 -2
- package/dist/runtime/admission.d.ts +9 -1
- package/dist/runtime/admission.js +56 -23
- package/dist/runtime/application-jobs/application-ingress-record-owner.d.ts +6 -8
- package/dist/runtime/application-jobs/application-ingress-record-owner.js +39 -22
- package/dist/runtime/application-jobs/application-job-queue-scope.d.ts +15 -1
- package/dist/runtime/application-jobs/application-job-queue-scope.js +61 -20
- package/dist/runtime/application-jobs/contracts.d.ts +12 -1
- package/dist/runtime/backend/contracts/index.d.ts +37 -12
- package/dist/runtime/backend/mesh-actor-session-node-adapter.js +2 -2
- package/dist/runtime/backend/mesh-completion-table.d.ts +9 -1
- package/dist/runtime/backend/mesh-completion-table.js +154 -49
- package/dist/runtime/backend/mesh-dispatch-pump.d.ts +28 -1
- package/dist/runtime/backend/mesh-dispatch-pump.js +208 -101
- package/dist/runtime/backend/node/node-backend-adapter-support.d.ts +2 -2
- package/dist/runtime/backend/node/node-backend-adapter-support.js +16 -9
- package/dist/runtime/backend/node/node-dealer-channel-client-transport.d.ts +1 -1
- package/dist/runtime/backend/node/node-dealer-channel-client-transport.js +5 -2
- package/dist/runtime/backend/node/node-raw-binding-port.js +124 -72
- package/dist/runtime/backend/node/node-raw-mesh-backend.d.ts +46 -13
- package/dist/runtime/backend/node/node-raw-mesh-backend.js +181 -164
- package/dist/runtime/backend/node/node-socket-backend-adapter.d.ts +1 -1
- package/dist/runtime/backend/node/node-socket-backend-adapter.js +11 -11
- package/dist/runtime/backend/raw-binding-port.d.ts +2 -2
- package/dist/runtime/backend/runtime-message.d.ts +1 -0
- package/dist/runtime/backend/runtime-message.js +5 -0
- package/dist/runtime/backend/runtime-values.d.ts +1 -0
- package/dist/runtime/backend/runtime-values.js +2 -1
- package/dist/runtime/channels/channel-clients.d.ts +2 -0
- package/dist/runtime/channels/channel-clients.js +75 -23
- package/dist/runtime/channels/channel-dispatch-pipeline.d.ts +25 -5
- package/dist/runtime/channels/channel-dispatch-pipeline.js +111 -56
- package/dist/runtime/channels/channel-dispatch-services.d.ts +1 -0
- package/dist/runtime/channels/channel-dispatch-services.js +45 -0
- package/dist/runtime/channels/channel-dispatchers.d.ts +4 -3
- package/dist/runtime/channels/channel-dispatchers.js +62 -54
- package/dist/runtime/channels/channel-envelope-inspection.d.ts +1 -2
- package/dist/runtime/channels/channel-envelope-inspection.js +1 -16
- package/dist/runtime/channels/channel-envelope.d.ts +2 -0
- package/dist/runtime/channels/channel-envelope.js +146 -28
- package/dist/runtime/channels/channel-outbound-operations.d.ts +2 -2
- package/dist/runtime/channels/channel-outbound-operations.js +8 -8
- package/dist/runtime/channels/channel-runtime-lifecycle.d.ts +4 -3
- package/dist/runtime/channels/channel-runtime-lifecycle.js +19 -24
- package/dist/runtime/channels/channel-runtime-manager.d.ts +9 -8
- package/dist/runtime/channels/channel-runtime-manager.js +16 -16
- package/dist/runtime/channels/channel-transports.d.ts +18 -16
- package/dist/runtime/channels/channel-transports.js +77 -58
- package/dist/runtime/channels/client-server-location-runtime.js +5 -4
- package/dist/runtime/channels/dispatch-error-reporter.d.ts +2 -1
- package/dist/runtime/channels/dispatch-error-reporter.js +2 -1
- package/dist/runtime/channels/fanout-location-runtime.d.ts +1 -1
- package/dist/runtime/channels/fanout-location-runtime.js +3 -3
- package/dist/runtime/channels/local-spot-route-transport.d.ts +1 -1
- package/dist/runtime/channels/local-spot-route-transport.js +2 -1
- package/dist/runtime/channels/router-socket-spot-route-transport.d.ts +2 -2
- package/dist/runtime/channels/router-socket-spot-route-transport.js +4 -4
- package/dist/runtime/channels/source-spot-router.d.ts +2 -2
- package/dist/runtime/channels/source-spot-router.js +4 -4
- package/dist/runtime/channels/spot-node-route-transport.d.ts +2 -2
- package/dist/runtime/channels/spot-node-route-transport.js +4 -4
- package/dist/runtime/channels/spot-route-bridge-transport.d.ts +2 -2
- package/dist/runtime/channels/spot-route-bridge-transport.js +4 -4
- package/dist/runtime/channels/spot-route-dispatch-strategy.d.ts +5 -4
- package/dist/runtime/channels/spot-route-dispatch-strategy.js +18 -18
- package/dist/runtime/diagnostics/flow-context.js +19 -7
- package/dist/runtime/diagnostics/index.js +4 -9
- package/dist/runtime/diagnostics/message-flow.d.ts +8 -0
- package/dist/runtime/diagnostics/message-flow.js +35 -5
- package/dist/runtime/diagnostics/runtime-metrics.d.ts +2 -2
- package/dist/runtime/diagnostics/runtime-metrics.js +10 -8
- package/dist/runtime/execution/index.d.ts +4 -2
- package/dist/runtime/execution/index.js +33 -10
- package/dist/runtime/execution/serial-execution-queue.d.ts +5 -0
- package/dist/runtime/execution/serial-execution-queue.js +22 -2
- package/dist/runtime/execution/state-lane.d.ts +2 -0
- package/dist/runtime/execution/state-lane.js +5 -0
- package/dist/runtime/foundation/actor-join-recovery-codec.js +2 -2
- package/dist/runtime/foundation/durable-service-request.d.ts +14 -0
- package/dist/runtime/foundation/durable-service-request.js +98 -0
- package/dist/runtime/foundation/operation-identity.d.ts +1 -0
- package/dist/runtime/foundation/operation-identity.js +5 -1
- package/dist/runtime/foundation/operation-registry.d.ts +25 -1
- package/dist/runtime/foundation/operation-registry.js +86 -18
- package/dist/runtime/foundation/raw-service-mesh-runtime.d.ts +61 -8
- package/dist/runtime/foundation/raw-service-mesh-runtime.js +486 -266
- package/dist/runtime/foundation/service-liveness-registry.d.ts +12 -1
- package/dist/runtime/foundation/service-liveness-registry.js +38 -0
- package/dist/runtime/foundation/service-mailbox.d.ts +7 -0
- package/dist/runtime/foundation/service-maintenance-runtime.js +1 -6
- package/dist/runtime/foundation/service-relocation-object-owner.d.ts +3 -3
- package/dist/runtime/foundation/service-relocation-object-owner.js +48 -34
- package/dist/runtime/foundation/service-relocation-runtime.d.ts +2 -0
- package/dist/runtime/foundation/service-relocation-runtime.js +20 -4
- package/dist/runtime/foundation/service-runtime-contracts.d.ts +10 -1
- package/dist/runtime/foundation/service-session-binding-ingress-port.d.ts +2 -1
- package/dist/runtime/foundation/service-stateful-registry.d.ts +5 -4
- package/dist/runtime/foundation/service-stateful-registry.js +24 -26
- package/dist/runtime/foundation/service-stateful-runtime.d.ts +75 -9
- package/dist/runtime/foundation/service-stateful-runtime.js +486 -218
- package/dist/runtime/foundation/service-stateful-wire-codec.d.ts +14 -6
- package/dist/runtime/foundation/service-stateful-wire-codec.js +48 -27
- package/dist/runtime/foundation/service-topology-registry.d.ts +12 -2
- package/dist/runtime/foundation/service-topology-registry.js +61 -27
- package/dist/runtime/foundation/service-wire-binary-primitives.d.ts +6 -1
- package/dist/runtime/foundation/service-wire-binary-primitives.js +27 -11
- package/dist/runtime/foundation/service-wire-constants.generated.d.ts +1 -0
- package/dist/runtime/foundation/service-wire-constants.generated.js +1 -0
- package/dist/runtime/foundation/service-wire-m6a-codec.d.ts +13 -3
- package/dist/runtime/foundation/service-wire-m6a-codec.js +189 -78
- package/dist/runtime/handlers/handler-instance-scope.d.ts +8 -0
- package/dist/runtime/handlers/handler-instance-scope.js +54 -11
- package/dist/runtime/host/actor-packet-relay.d.ts +6 -4
- package/dist/runtime/host/actor-packet-relay.js +59 -72
- package/dist/runtime/host/actor-placement-coordinator.js +25 -8
- package/dist/runtime/host/actor-runtime-options-factory.js +2 -2
- package/dist/runtime/host/actor-transfer-runtime.d.ts +7 -31
- package/dist/runtime/host/actor-transfer-runtime.js +85 -331
- package/dist/runtime/host/application-job-queue.d.ts +40 -7
- package/dist/runtime/host/application-job-queue.js +137 -42
- package/dist/runtime/host/entry-actor-runtime.d.ts +1 -0
- package/dist/runtime/host/entry-actor-runtime.js +3 -0
- package/dist/runtime/host/index.d.ts +12 -2
- package/dist/runtime/host/index.js +300 -202
- package/dist/runtime/host/location-runtime-owner.js +2 -6
- package/dist/runtime/host/mesh-router-resolver.d.ts +4 -0
- package/dist/runtime/host/mesh-router-resolver.js +14 -6
- package/dist/runtime/host/remote-bound-session-relay.d.ts +2 -4
- package/dist/runtime/host/remote-bound-session-relay.js +73 -208
- package/dist/runtime/host/route-mesh-runtime.d.ts +2 -2
- package/dist/runtime/host/route-mesh-runtime.js +6 -4
- package/dist/runtime/host/runtime-shutdown.d.ts +1 -0
- package/dist/runtime/host/runtime-shutdown.js +3 -2
- package/dist/runtime/host/service-relocation-control.d.ts +1 -0
- package/dist/runtime/host/service-relocation-control.js +10 -4
- package/dist/runtime/host/service-relocation-host-runtime.d.ts +22 -14
- package/dist/runtime/host/service-relocation-host-runtime.js +754 -599
- package/dist/runtime/host/spot-address-transport.js +3 -2
- package/dist/runtime/host/spot-runtime-options-factory.js +16 -7
- package/dist/runtime/host/user-spot-creation-coordinator.js +33 -84
- package/dist/runtime/locations/actor-location-claims.d.ts +2 -2
- package/dist/runtime/locations/actor-location-claims.js +34 -19
- package/dist/runtime/locations/auto-connect-loop.d.ts +2 -0
- package/dist/runtime/locations/auto-connect-loop.js +22 -14
- package/dist/runtime/locations/auto-connect-reconciler.js +0 -6
- package/dist/runtime/locations/auto-connect-types.d.ts +0 -1
- package/dist/runtime/locations/descriptor-publication.d.ts +4 -0
- package/dist/runtime/locations/descriptor-publication.js +11 -0
- package/dist/runtime/locations/domain-store-contract.d.ts +1 -0
- package/dist/runtime/locations/in-memory-authority-store.d.ts +7 -1
- package/dist/runtime/locations/in-memory-authority-store.js +56 -19
- package/dist/runtime/locations/in-memory-location-store.js +1 -10
- package/dist/runtime/locations/index.d.ts +1 -0
- package/dist/runtime/locations/index.js +1 -0
- package/dist/runtime/locations/lease-tracker.js +1 -6
- package/dist/runtime/locations/lifecycle.d.ts +1 -2
- package/dist/runtime/locations/lifecycle.js +2 -5
- package/dist/runtime/locations/location-store-repository.d.ts +51 -1
- package/dist/runtime/locations/location-store-repository.js +363 -139
- package/dist/runtime/locations/relocation-blob.d.ts +18 -1
- package/dist/runtime/locations/relocation-blob.js +52 -1
- package/dist/runtime/locations/request-source-resolver.d.ts +37 -0
- package/dist/runtime/locations/request-source-resolver.js +80 -0
- package/dist/runtime/locations/resolvers.js +1 -1
- package/dist/runtime/locations/runtime.d.ts +7 -3
- package/dist/runtime/locations/runtime.js +61 -53
- package/dist/runtime/messaging/framework-json-v1.d.ts +4 -6
- package/dist/runtime/messaging/framework-json-v1.js +38 -294
- package/dist/runtime/messaging/packet-name.d.ts +1 -1
- package/dist/runtime/messaging/packet-name.js +8 -24
- package/dist/runtime/messaging/payload-codec.d.ts +7 -1
- package/dist/runtime/messaging/payload-codec.js +7 -6
- package/dist/runtime/messaging/request-result.d.ts +2 -0
- package/dist/runtime/messaging/request-result.js +57 -0
- package/dist/runtime/messaging/submission-result.d.ts +1 -0
- package/dist/runtime/messaging/submission-result.js +5 -2
- package/dist/runtime/protocol/service_wire_codec.generated.d.ts +34 -1
- package/dist/runtime/protocol/service_wire_codec.generated.js +229 -0
- package/dist/runtime/protocol/service_wire_pilot_codec.generated.d.ts +16 -1
- package/dist/runtime/protocol/service_wire_pilot_codec.generated.js +37 -8
- package/dist/runtime/spots/formal-remote-actor-admission-registry.d.ts +7 -2
- package/dist/runtime/spots/formal-remote-actor-admission-registry.js +36 -21
- package/dist/runtime/spots/index.d.ts +21 -11
- package/dist/runtime/spots/index.js +243 -178
- package/dist/runtime/spots/spot-activation-registry.d.ts +4 -2
- package/dist/runtime/spots/spot-activation-registry.js +21 -11
- package/dist/runtime/spots/spot-activation-state.d.ts +1 -1
- package/dist/runtime/spots/spot-activation-state.js +7 -7
- package/dist/runtime/spots/spot-activation.d.ts +7 -3
- package/dist/runtime/spots/spot-activation.js +140 -52
- package/dist/runtime/spots/spot-actor-admission-coordinator.d.ts +1 -0
- package/dist/runtime/spots/spot-actor-admission-coordinator.js +13 -22
- package/dist/runtime/spots/spot-actor-membership.d.ts +0 -1
- package/dist/runtime/spots/spot-actor-membership.js +0 -8
- package/dist/runtime/spots/spot-actor-packet-dispatch.js +33 -8
- package/dist/runtime/spots/spot-actor-packet-drain.js +5 -33
- package/dist/runtime/spots/spot-entry-activation.d.ts +2 -0
- package/dist/runtime/spots/spot-entry-activation.js +20 -11
- package/dist/runtime/spots/spot-handler-registry.d.ts +7 -4
- package/dist/runtime/spots/spot-handler-registry.js +24 -10
- package/dist/runtime/spots/spot-manager-internal-contracts.d.ts +2 -2
- package/dist/runtime/spots/spot-manager-public.js +2 -2
- package/dist/runtime/spots/spot-node-autoconnect.d.ts +2 -1
- package/dist/runtime/spots/spot-node-autoconnect.js +22 -42
- package/dist/runtime/spots/spot-node-runtime-manager.d.ts +19 -2
- package/dist/runtime/spots/spot-node-runtime-manager.js +115 -50
- package/dist/runtime/spots/spot-outbound.d.ts +3 -0
- package/dist/runtime/spots/spot-outbound.js +27 -18
- package/dist/runtime/spots/spot-remote-codec.js +5 -1
- package/dist/runtime/spots/spot-routed-spot-packet-dispatch.d.ts +1 -0
- package/dist/runtime/spots/spot-routed-spot-packet-dispatch.js +1 -1
- package/dist/runtime/spots/spot-runtime-ports.d.ts +1 -1
- package/dist/runtime/spots/spot-serial-executor.d.ts +10 -0
- package/dist/runtime/spots/spot-serial-executor.js +61 -8
- package/dist/runtime/spots/spot-serial-turn-executor.js +19 -2
- package/dist/runtime/spots/spot-subscription-dispatch.js +1 -4
- package/dist/runtime/spots/spot-timer.d.ts +57 -5
- package/dist/runtime/spots/spot-timer.js +288 -103
- package/dist/runtime/streams/actor-session-binding-registry.d.ts +42 -11
- package/dist/runtime/streams/actor-session-binding-registry.js +165 -48
- package/dist/runtime/streams/actor-session-binding-runtime-owner.d.ts +8 -4
- package/dist/runtime/streams/bound-actor-relay-sender.d.ts +2 -1
- package/dist/runtime/streams/bound-actor-relay-sender.js +15 -8
- package/dist/runtime/streams/bound-session-service.d.ts +1 -1
- package/dist/runtime/streams/bound-session-service.js +6 -11
- package/dist/runtime/streams/index.d.ts +3 -2
- package/dist/runtime/streams/index.js +6 -4
- package/dist/runtime/streams/managed-stream.js +3 -2
- package/dist/runtime/streams/native-fallback-bound-session.js +8 -73
- package/dist/runtime/streams/session-actor-coordinator.d.ts +2 -8
- package/dist/runtime/streams/session-actor-coordinator.js +15 -32
- package/dist/runtime/streams/stream-binding-runtime-ports.d.ts +3 -10
- package/dist/runtime/streams/stream-session-runtime.d.ts +1 -1
- package/dist/runtime/streams/stream-session-runtime.js +14 -31
- package/dist/runtime/workers/index.js +1 -1
- package/package.json +3 -3
- package/src/contracts/Actors/ZLinkActorClient.ts +2 -1
- package/src/contracts/Channels/Calls.ts +2 -1
- package/src/contracts/Common/ZLinkEncodedPayload.ts +24 -4
- package/src/contracts/Common/ZLinkMessageMetadata.ts +13 -8
- package/src/contracts/Common/encoded-payload-storage.ts +6 -3
- package/src/contracts/Configuration/Builders.ts +4 -1
- package/src/contracts/Configuration/RegistrationBuilderPolicy.ts +7 -2
- package/src/contracts/Configuration/RegistrationBuilders.ts +6 -2
- package/src/contracts/Configuration/RegistrationTypes.ts +1 -0
- package/src/contracts/Dispatch/ZLinkDispatchOptions.ts +2 -1
- package/src/contracts/Handlers/Attributes.ts +14 -21
- package/src/contracts/Handlers/JsonContract.ts +8 -216
- package/src/contracts/Locations/Rows.ts +2 -0
- package/src/contracts/Spots/Contracts.ts +10 -1
- package/src/contracts/Spots/ZLinkSpot.ts +3 -3
- package/src/nest-integration.ts +1 -0
- package/src/runtime/abort.ts +12 -0
- package/src/runtime/actors/actor-authority-publication.ts +3 -2
- package/src/runtime/actors/actor-client.ts +100 -85
- package/src/runtime/actors/actor-context.ts +49 -9
- package/src/runtime/actors/actor-handoff.ts +291 -110
- package/src/runtime/actors/actor-join-relocation.ts +3 -0
- package/src/runtime/actors/actor-local-native-join.ts +21 -26
- package/src/runtime/actors/actor-mailbox.ts +40 -2
- package/src/runtime/actors/actor-remote-joiner.ts +6 -1
- package/src/runtime/actors/actor-remote-wire.ts +17 -0
- package/src/runtime/actors/actor-reply.ts +42 -0
- package/src/runtime/actors/actor-routed-join-transport.ts +14 -4
- package/src/runtime/actors/actor-routed-json-request.ts +10 -2
- package/src/runtime/actors/actor-runtime-contracts.ts +2 -0
- package/src/runtime/actors/actor-runtime-state.ts +2 -20
- package/src/runtime/actors/actor-source-transfer.ts +1 -34
- package/src/runtime/actors/index.ts +60 -32
- package/src/runtime/actors/session-disconnected-wire.ts +66 -0
- package/src/runtime/actors/spot-actor-dispatch.ts +4 -2
- package/src/runtime/admission.ts +69 -21
- package/src/runtime/application-jobs/application-ingress-record-owner.ts +41 -25
- package/src/runtime/application-jobs/application-job-queue-scope.ts +83 -22
- package/src/runtime/application-jobs/contracts.ts +16 -1
- package/src/runtime/backend/contracts/index.ts +92 -18
- package/src/runtime/backend/mesh-actor-session-node-adapter.ts +5 -3
- package/src/runtime/backend/mesh-completion-table.ts +160 -57
- package/src/runtime/backend/mesh-dispatch-pump.ts +237 -108
- package/src/runtime/backend/node/node-backend-adapter-support.ts +17 -8
- package/src/runtime/backend/node/node-dealer-channel-client-transport.ts +12 -2
- package/src/runtime/backend/node/node-raw-binding-port.ts +148 -85
- package/src/runtime/backend/node/node-raw-mesh-backend.ts +315 -201
- package/src/runtime/backend/node/node-socket-backend-adapter.ts +26 -11
- package/src/runtime/backend/raw-binding-port.ts +7 -2
- package/src/runtime/backend/runtime-message.ts +6 -0
- package/src/runtime/backend/runtime-values.ts +1 -0
- package/src/runtime/channels/channel-clients.ts +132 -58
- package/src/runtime/channels/channel-dispatch-pipeline.ts +198 -114
- package/src/runtime/channels/channel-dispatch-services.ts +69 -1
- package/src/runtime/channels/channel-dispatchers.ts +136 -90
- package/src/runtime/channels/channel-envelope-inspection.ts +2 -16
- package/src/runtime/channels/channel-envelope.ts +225 -31
- package/src/runtime/channels/channel-outbound-operations.ts +22 -8
- package/src/runtime/channels/channel-runtime-lifecycle.ts +13 -13
- package/src/runtime/channels/channel-runtime-manager.ts +41 -17
- package/src/runtime/channels/channel-transports.ts +171 -112
- package/src/runtime/channels/client-server-location-runtime.ts +11 -10
- package/src/runtime/channels/dispatch-error-reporter.ts +4 -2
- package/src/runtime/channels/fanout-location-runtime.ts +17 -9
- package/src/runtime/channels/local-spot-route-transport.ts +3 -1
- package/src/runtime/channels/router-socket-spot-route-transport.ts +13 -4
- package/src/runtime/channels/source-spot-router.ts +8 -4
- package/src/runtime/channels/spot-node-route-transport.ts +8 -4
- package/src/runtime/channels/spot-route-bridge-transport.ts +6 -4
- package/src/runtime/channels/spot-route-dispatch-strategy.ts +47 -18
- package/src/runtime/diagnostics/flow-context.ts +20 -7
- package/src/runtime/diagnostics/index.ts +1 -7
- package/src/runtime/diagnostics/message-flow.ts +47 -9
- package/src/runtime/diagnostics/runtime-metrics.ts +12 -10
- package/src/runtime/execution/index.ts +40 -14
- package/src/runtime/execution/serial-execution-queue.ts +33 -4
- package/src/runtime/execution/state-lane.ts +7 -0
- package/src/runtime/foundation/actor-join-recovery-codec.ts +2 -2
- package/src/runtime/foundation/durable-service-request.ts +137 -0
- package/src/runtime/foundation/operation-identity.ts +5 -1
- package/src/runtime/foundation/operation-registry.ts +98 -20
- package/src/runtime/foundation/raw-service-mesh-runtime.ts +704 -336
- package/src/runtime/foundation/service-liveness-registry.ts +39 -0
- package/src/runtime/foundation/service-mailbox.ts +8 -0
- package/src/runtime/foundation/service-maintenance-runtime.ts +1 -8
- package/src/runtime/foundation/service-relocation-object-owner.ts +55 -36
- package/src/runtime/foundation/service-relocation-runtime.ts +25 -4
- package/src/runtime/foundation/service-runtime-contracts.ts +19 -2
- package/src/runtime/foundation/service-session-binding-ingress-port.ts +2 -1
- package/src/runtime/foundation/service-stateful-registry.ts +38 -35
- package/src/runtime/foundation/service-stateful-runtime.ts +732 -275
- package/src/runtime/foundation/service-stateful-wire-codec.ts +49 -16
- package/src/runtime/foundation/service-topology-registry.ts +91 -36
- package/src/runtime/foundation/service-wire-binary-primitives.ts +35 -12
- package/src/runtime/foundation/service-wire-constants.generated.ts +1 -0
- package/src/runtime/foundation/service-wire-m6a-codec.ts +231 -76
- package/src/runtime/handlers/handler-instance-scope.ts +67 -16
- package/src/runtime/host/actor-packet-relay.ts +113 -94
- package/src/runtime/host/actor-placement-coordinator.ts +31 -8
- package/src/runtime/host/actor-runtime-options-factory.ts +13 -2
- package/src/runtime/host/actor-transfer-runtime.ts +104 -430
- package/src/runtime/host/application-job-queue.ts +160 -41
- package/src/runtime/host/entry-actor-runtime.ts +4 -0
- package/src/runtime/host/index.ts +473 -271
- package/src/runtime/host/location-runtime-owner.ts +2 -6
- package/src/runtime/host/mesh-router-resolver.ts +13 -5
- package/src/runtime/host/remote-bound-session-relay.ts +88 -271
- package/src/runtime/host/route-mesh-runtime.ts +12 -6
- package/src/runtime/host/runtime-shutdown.ts +15 -4
- package/src/runtime/host/service-relocation-control.ts +11 -5
- package/src/runtime/host/service-relocation-host-runtime.ts +1092 -759
- package/src/runtime/host/spot-address-transport.ts +4 -2
- package/src/runtime/host/spot-runtime-options-factory.ts +20 -7
- package/src/runtime/host/user-spot-creation-coordinator.ts +41 -100
- package/src/runtime/locations/actor-location-claims.ts +52 -30
- package/src/runtime/locations/auto-connect-loop.ts +22 -14
- package/src/runtime/locations/auto-connect-reconciler.ts +0 -6
- package/src/runtime/locations/auto-connect-types.ts +0 -1
- package/src/runtime/locations/descriptor-publication.ts +7 -0
- package/src/runtime/locations/domain-store-contract.ts +5 -0
- package/src/runtime/locations/in-memory-authority-store.ts +85 -23
- package/src/runtime/locations/in-memory-location-store.ts +1 -12
- package/src/runtime/locations/index.ts +1 -0
- package/src/runtime/locations/lease-tracker.ts +2 -9
- package/src/runtime/locations/lifecycle.ts +8 -26
- package/src/runtime/locations/location-store-repository.ts +628 -152
- package/src/runtime/locations/relocation-blob.ts +75 -1
- package/src/runtime/locations/request-source-resolver.ts +138 -0
- package/src/runtime/locations/resolvers.ts +2 -2
- package/src/runtime/locations/runtime.ts +98 -64
- package/src/runtime/messaging/framework-json-v1.ts +5 -325
- package/src/runtime/messaging/packet-name.ts +5 -25
- package/src/runtime/messaging/payload-codec.ts +8 -11
- package/src/runtime/messaging/request-result.ts +62 -0
- package/src/runtime/messaging/submission-result.ts +5 -1
- package/src/runtime/protocol/service_wire_codec.generated.ts +218 -5
- package/src/runtime/protocol/service_wire_pilot_codec.generated.ts +16 -13
- package/src/runtime/spots/formal-remote-actor-admission-registry.ts +46 -25
- package/src/runtime/spots/index.ts +389 -283
- package/src/runtime/spots/spot-activation-registry.ts +25 -13
- package/src/runtime/spots/spot-activation-state.ts +12 -19
- package/src/runtime/spots/spot-activation.ts +198 -96
- package/src/runtime/spots/spot-actor-admission-coordinator.ts +25 -55
- package/src/runtime/spots/spot-actor-membership.ts +0 -15
- package/src/runtime/spots/spot-actor-packet-dispatch.ts +56 -11
- package/src/runtime/spots/spot-actor-packet-drain.ts +9 -52
- package/src/runtime/spots/spot-entry-activation.ts +33 -21
- package/src/runtime/spots/spot-handler-registry.ts +56 -12
- package/src/runtime/spots/spot-manager-internal-contracts.ts +2 -2
- package/src/runtime/spots/spot-manager-public.ts +2 -2
- package/src/runtime/spots/spot-node-autoconnect.ts +28 -47
- package/src/runtime/spots/spot-node-runtime-manager.ts +197 -67
- package/src/runtime/spots/spot-outbound.ts +39 -19
- package/src/runtime/spots/spot-remote-codec.ts +9 -2
- package/src/runtime/spots/spot-routed-spot-packet-dispatch.ts +2 -1
- package/src/runtime/spots/spot-runtime-ports.ts +1 -1
- package/src/runtime/spots/spot-serial-executor.ts +97 -25
- package/src/runtime/spots/spot-serial-turn-executor.ts +22 -3
- package/src/runtime/spots/spot-subscription-dispatch.ts +1 -4
- package/src/runtime/spots/spot-timer.ts +418 -158
- package/src/runtime/streams/actor-session-binding-registry.ts +236 -64
- package/src/runtime/streams/actor-session-binding-runtime-owner.ts +16 -8
- package/src/runtime/streams/bound-actor-relay-sender.ts +23 -9
- package/src/runtime/streams/bound-session-service.ts +7 -10
- package/src/runtime/streams/index.ts +12 -6
- package/src/runtime/streams/managed-stream.ts +4 -2
- package/src/runtime/streams/native-fallback-bound-session.ts +14 -103
- package/src/runtime/streams/session-actor-coordinator.ts +39 -88
- package/src/runtime/streams/stream-binding-runtime-ports.ts +3 -9
- package/src/runtime/streams/stream-session-runtime.ts +13 -34
- package/src/runtime/workers/index.ts +1 -1
|
@@ -126,11 +126,11 @@ class ZLinkChannelRuntimeManager {
|
|
|
126
126
|
prepareMeshDispatch(taskRunner) {
|
|
127
127
|
this.lifecycle.prepareMeshDispatch(taskRunner);
|
|
128
128
|
}
|
|
129
|
-
dispatchMeshChannel(meshName, record, signal) {
|
|
130
|
-
return this.lifecycle.dispatchMeshChannel(meshName, record, signal);
|
|
129
|
+
dispatchMeshChannel(meshName, record, signal, admit) {
|
|
130
|
+
return this.lifecycle.dispatchMeshChannel(meshName, record, signal, admit);
|
|
131
131
|
}
|
|
132
|
-
dispatchMeshRoute(meshName, record, signal) {
|
|
133
|
-
return this.lifecycle.dispatchMeshRoute(meshName, record, signal);
|
|
132
|
+
dispatchMeshRoute(meshName, record, signal, admit) {
|
|
133
|
+
return this.lifecycle.dispatchMeshRoute(meshName, record, signal, admit);
|
|
134
134
|
}
|
|
135
135
|
dispatchLocalMeshRoute(meshName, sourceNodeRid, parts, signal) {
|
|
136
136
|
return this.lifecycle.dispatchLocalMeshRoute(meshName, sourceNodeRid, parts, signal);
|
|
@@ -141,8 +141,8 @@ class ZLinkChannelRuntimeManager {
|
|
|
141
141
|
send(channelName, packetName, message, metadata) {
|
|
142
142
|
return this.outbound.send(channelName, packetName, message, metadata);
|
|
143
143
|
}
|
|
144
|
-
async request(channelName, packetName, request, timeoutMs, signal, metadata) {
|
|
145
|
-
return this.outbound.request(channelName, packetName, request, timeoutMs, signal, metadata);
|
|
144
|
+
async request(channelName, packetName, request, timeoutMs, signal, metadata, onAdmitted) {
|
|
145
|
+
return this.outbound.request(channelName, packetName, request, timeoutMs, signal, metadata, onAdmitted);
|
|
146
146
|
}
|
|
147
147
|
tryPublish(channelName, topic, packetName, event, metadata) {
|
|
148
148
|
return this.outbound.tryPublish(channelName, topic, packetName, event, metadata);
|
|
@@ -153,26 +153,26 @@ class ZLinkChannelRuntimeManager {
|
|
|
153
153
|
routeSubmit(routerChannelId, targetNodeRid, packetName, message, metadata) {
|
|
154
154
|
return this.outbound.routeSubmit(routerChannelId, targetNodeRid, packetName, message, metadata);
|
|
155
155
|
}
|
|
156
|
-
async routeRequest(routerChannelId, targetNodeRid, packetName, request, timeoutMs, signal, metadata) {
|
|
157
|
-
return this.outbound.routeRequest(routerChannelId, targetNodeRid, packetName, request, timeoutMs, signal, metadata);
|
|
156
|
+
async routeRequest(routerChannelId, targetNodeRid, packetName, request, timeoutMs, signal, metadata, onAdmitted) {
|
|
157
|
+
return this.outbound.routeRequest(routerChannelId, targetNodeRid, packetName, request, timeoutMs, signal, metadata, onAdmitted);
|
|
158
158
|
}
|
|
159
159
|
async routeSendToSpot(spotRouteTarget, packetName, message, metadata) {
|
|
160
160
|
return this.spotRoutes.routeSendToSpot(spotRouteTarget, packetName, message, metadata);
|
|
161
161
|
}
|
|
162
|
-
async routeRequestToSpot(spotRouteTarget, packetName, request, timeoutMs, signal, metadata) {
|
|
163
|
-
return this.spotRoutes.routeRequestToSpot(spotRouteTarget, packetName, request, timeoutMs, signal, metadata);
|
|
162
|
+
async routeRequestToSpot(spotRouteTarget, packetName, request, timeoutMs, signal, metadata, onAdmitted) {
|
|
163
|
+
return this.spotRoutes.routeRequestToSpot(spotRouteTarget, packetName, request, timeoutMs, signal, metadata, onAdmitted);
|
|
164
164
|
}
|
|
165
|
-
async routeRequestFromSpotToSpot(sourceSpot, spotRouteTarget, packetName, request, timeoutMs, signal) {
|
|
166
|
-
return this.spotRoutes.routeRequestFromSpotToSpot(sourceSpot, spotRouteTarget, packetName, request, timeoutMs, signal);
|
|
165
|
+
async routeRequestFromSpotToSpot(sourceSpot, spotRouteTarget, packetName, request, timeoutMs, signal, onAdmitted) {
|
|
166
|
+
return this.spotRoutes.routeRequestFromSpotToSpot(sourceSpot, spotRouteTarget, packetName, request, timeoutMs, signal, onAdmitted);
|
|
167
167
|
}
|
|
168
168
|
async routeSendFromSpotToSpot(sourceSpot, spotRouteTarget, packetName, message, metadata) {
|
|
169
169
|
return this.spotRoutes.routeSendFromSpotToSpot(sourceSpot, spotRouteTarget, packetName, message, metadata);
|
|
170
170
|
}
|
|
171
|
-
async routeRequestRawFromSpotToSpot(sourceSpot, spotRouteTarget, request, timeoutMs, signal) {
|
|
172
|
-
return this.spotRoutes.routeRequestRawFromSpotToSpot(sourceSpot, spotRouteTarget, request, timeoutMs, signal);
|
|
171
|
+
async routeRequestRawFromSpotToSpot(sourceSpot, spotRouteTarget, request, timeoutMs, signal, onAdmitted) {
|
|
172
|
+
return this.spotRoutes.routeRequestRawFromSpotToSpot(sourceSpot, spotRouteTarget, request, timeoutMs, signal, onAdmitted);
|
|
173
173
|
}
|
|
174
|
-
async routeRequestRawToSpot(spotRouteTarget, request, timeoutMs, signal) {
|
|
175
|
-
return this.spotRoutes.routeRequestRawToSpot(spotRouteTarget, request, timeoutMs, signal);
|
|
174
|
+
async routeRequestRawToSpot(spotRouteTarget, request, timeoutMs, signal, onAdmitted) {
|
|
175
|
+
return this.spotRoutes.routeRequestRawToSpot(spotRouteTarget, request, timeoutMs, signal, onAdmitted);
|
|
176
176
|
}
|
|
177
177
|
canRouteChannel(routerChannelId) {
|
|
178
178
|
return this.spotRoutes.canRouteChannel(routerChannelId);
|
|
@@ -11,7 +11,7 @@ import type { ZLinkSpotRoutedSendOptions, ZLinkSpotRoutedRequestOptions } from '
|
|
|
11
11
|
import { type ZLinkChannelEnvelopeCodecRegistry } from './channel-envelope';
|
|
12
12
|
export interface ZLinkChannelClientTransport {
|
|
13
13
|
send(channelName: string, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): void | ZLinkSubmitResult | Promise<void | ZLinkSubmitResult>;
|
|
14
|
-
request<TReply>(channelName: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string
|
|
14
|
+
request<TReply>(channelName: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string>, onAdmitted?: () => void): Promise<TReply>;
|
|
15
15
|
tryPublish?(channelName: string, topic: string, packetName: string | undefined, event: unknown, metadata?: ReadonlyMap<string, string>): ZLinkSubmitResult;
|
|
16
16
|
publish(channelName: string, topic: string, packetName: string | undefined, event: unknown, signal?: AbortSignal, metadata?: ReadonlyMap<string, string>): ZLinkSubmitResult | Promise<ZLinkSubmitResult>;
|
|
17
17
|
}
|
|
@@ -22,9 +22,9 @@ export interface ZLinkSpotPublisherClientTransport {
|
|
|
22
22
|
}
|
|
23
23
|
export interface ZLinkRouteClientTransport {
|
|
24
24
|
submit(routerChannelId: string, targetNodeRid: string, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): void | ZLinkSubmitResult | Promise<void | ZLinkSubmitResult>;
|
|
25
|
-
request<TReply>(routerChannelId: string, targetNodeRid: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string
|
|
25
|
+
request<TReply>(routerChannelId: string, targetNodeRid: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string>, onAdmitted?: () => void): Promise<TReply>;
|
|
26
26
|
submitToChannel(meshName: string, channelName: string, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): void | ZLinkSubmitResult | Promise<void | ZLinkSubmitResult>;
|
|
27
|
-
requestToChannel<TReply>(meshName: string, channelName: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string
|
|
27
|
+
requestToChannel<TReply>(meshName: string, channelName: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string>, onAdmitted?: () => void): Promise<TReply>;
|
|
28
28
|
sendToSpot?(spotRouteTarget: ZLinkSpotRouteTarget, message: unknown, options: {
|
|
29
29
|
readonly packetName?: string;
|
|
30
30
|
readonly metadata?: ReadonlyMap<string, string>;
|
|
@@ -33,24 +33,25 @@ export interface ZLinkRouteClientTransport {
|
|
|
33
33
|
readonly packetName?: string;
|
|
34
34
|
readonly timeoutMs?: number;
|
|
35
35
|
readonly signal?: AbortSignal;
|
|
36
|
+
readonly onAdmitted?: () => void;
|
|
36
37
|
readonly metadata?: ReadonlyMap<string, string>;
|
|
37
38
|
}): Promise<TReply>;
|
|
38
39
|
}
|
|
39
40
|
interface ZLinkChannelTransportRuntime {
|
|
40
41
|
send(channelName: string, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): Promise<ZLinkSubmitResult>;
|
|
41
|
-
request<TReply>(channelName: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string
|
|
42
|
+
request<TReply>(channelName: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string>, onAdmitted?: () => void): Promise<TReply>;
|
|
42
43
|
tryPublish(channelName: string, topic: string, packetName: string | undefined, event: unknown, metadata?: ReadonlyMap<string, string>): ZLinkSubmitResult;
|
|
43
44
|
publish(channelName: string, topic: string, packetName: string | undefined, event: unknown, signal?: AbortSignal, metadata?: ReadonlyMap<string, string>): Promise<ZLinkSubmitResult>;
|
|
44
45
|
canRouteChannel(routerChannelId: string): boolean;
|
|
45
46
|
canRoutePacketChannel(routerChannelId: string): boolean;
|
|
46
47
|
routeSubmit(routerChannelId: string, targetNodeRid: string, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): Promise<ZLinkSubmitResult>;
|
|
47
|
-
routeRequest<TReply>(routerChannelId: string, targetNodeRid: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string
|
|
48
|
+
routeRequest<TReply>(routerChannelId: string, targetNodeRid: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string>, onAdmitted?: () => void): Promise<TReply>;
|
|
48
49
|
routeSendToSpot(spotRouteTarget: ZLinkSpotRouteTarget, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): Promise<void>;
|
|
49
50
|
routeSendFromSpotToSpot(sourceSpot: ZLinkBackendSpot, spotRouteTarget: ZLinkSpotRouteTarget, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): Promise<void>;
|
|
50
|
-
routeRequestToSpot<TReply>(spotRouteTarget: ZLinkSpotRouteTarget, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string
|
|
51
|
-
routeRequestFromSpotToSpot<TReply>(sourceSpot: ZLinkBackendSpot, spotRouteTarget: ZLinkSpotRouteTarget, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal): Promise<TReply>;
|
|
52
|
-
routeRequestRawFromSpotToSpot(sourceSpot: ZLinkBackendSpot, spotRouteTarget: ZLinkSpotRouteTarget, request: Message, timeoutMs: number | undefined, signal?: AbortSignal): Promise<readonly Message[]>;
|
|
53
|
-
routeRequestRawToSpot(spotRouteTarget: ZLinkSpotRouteTarget, request: Message, timeoutMs: number | undefined, signal?: AbortSignal): Promise<readonly Message[]>;
|
|
51
|
+
routeRequestToSpot<TReply>(spotRouteTarget: ZLinkSpotRouteTarget, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string>, onAdmitted?: () => void): Promise<TReply>;
|
|
52
|
+
routeRequestFromSpotToSpot<TReply>(sourceSpot: ZLinkBackendSpot, spotRouteTarget: ZLinkSpotRouteTarget, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, onAdmitted?: () => void): Promise<TReply>;
|
|
53
|
+
routeRequestRawFromSpotToSpot(sourceSpot: ZLinkBackendSpot, spotRouteTarget: ZLinkSpotRouteTarget, request: Message, timeoutMs: number | undefined, signal?: AbortSignal, onAdmitted?: () => void): Promise<readonly Message[]>;
|
|
54
|
+
routeRequestRawToSpot(spotRouteTarget: ZLinkSpotRouteTarget, request: Message, timeoutMs: number | undefined, signal?: AbortSignal, onAdmitted?: () => void): Promise<readonly Message[]>;
|
|
54
55
|
}
|
|
55
56
|
export declare class ZLinkRuntimeRouteTransport implements ZLinkRouteClientTransport {
|
|
56
57
|
private readonly manager;
|
|
@@ -63,22 +64,21 @@ export declare class ZLinkRuntimeRouteTransport implements ZLinkRouteClientTrans
|
|
|
63
64
|
private readonly flowCreationEnabled;
|
|
64
65
|
private readonly outboundFlow;
|
|
65
66
|
constructor(manager: () => ZLinkChannelTransportRuntime | undefined, routeChannelPredicate?: ((routerChannelId: string) => boolean) | undefined, meshRuntime?: (() => {
|
|
66
|
-
readonly meshNode
|
|
67
|
+
readonly meshNode?: (meshName: string) => ZLinkBackendMeshNode | undefined;
|
|
67
68
|
readonly meshCompletionTable: (meshName: string) => ZLinkMeshCompletionTable | undefined;
|
|
68
69
|
} | undefined) | undefined, codecs?: ZLinkChannelEnvelopeCodecRegistry | undefined, manualNodeTarget?: ((meshName: string, targetNodeRid: string) => boolean | undefined) | undefined, localNodeSubmit?: ((meshName: string, sourceNodeRid: string, parts: readonly MessageLike[]) => ZLinkSubmitResult) | undefined, metrics?: ZLinkRuntimeMetrics | undefined, flowCreationEnabled?: () => boolean, outboundFlow?: () => ZLinkMessageFlowTracer | undefined);
|
|
69
70
|
canRouteChannel(routerChannelId: string): boolean;
|
|
70
71
|
canRoutePacketChannel(routerChannelId: string): boolean;
|
|
71
|
-
submit(meshName: string, targetNodeRid: string, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): Promise<ZLinkSubmitResult>;
|
|
72
|
-
submitInfrastructure(meshName: string, targetNodeRid: string, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): Promise<ZLinkSubmitResult>;
|
|
72
|
+
submit(meshName: string, targetNodeRid: string, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): ZLinkSubmitResult | Promise<ZLinkSubmitResult>;
|
|
73
|
+
submitInfrastructure(meshName: string, targetNodeRid: string, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): ZLinkSubmitResult | Promise<ZLinkSubmitResult>;
|
|
73
74
|
private submitNode;
|
|
74
|
-
request<TReply>(meshName: string, targetNodeRid: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string
|
|
75
|
+
request<TReply>(meshName: string, targetNodeRid: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string>, onAdmitted?: () => void): Promise<TReply>;
|
|
75
76
|
private requestScoped;
|
|
76
77
|
private traceNodeRequest;
|
|
77
78
|
submitToChannel(meshName: string, channelName: string, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): Promise<ZLinkSubmitResult>;
|
|
78
79
|
private submitToChannelScoped;
|
|
79
|
-
requestToChannel<TReply>(meshName: string, channelName: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string
|
|
80
|
+
requestToChannel<TReply>(meshName: string, channelName: string, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, metadata?: ReadonlyMap<string, string>, onAdmitted?: () => void): Promise<TReply>;
|
|
80
81
|
private requestToChannelScoped;
|
|
81
|
-
private submitRequestOperation;
|
|
82
82
|
sendToSpot(spotRouteTarget: ZLinkSpotRouteTarget, message: unknown, options: ZLinkSpotRoutedSendOptions): Promise<ZLinkSubmitResult>;
|
|
83
83
|
private sendToSpotScoped;
|
|
84
84
|
sendFromSpotToSpot(sourceSpot: ZLinkBackendSpot, spotRouteTarget: ZLinkSpotRouteTarget, message: unknown, options: {
|
|
@@ -91,19 +91,21 @@ export declare class ZLinkRuntimeRouteTransport implements ZLinkRouteClientTrans
|
|
|
91
91
|
readonly packetName?: string;
|
|
92
92
|
readonly timeoutMs?: number;
|
|
93
93
|
readonly signal?: AbortSignal;
|
|
94
|
+
readonly onAdmitted?: () => void;
|
|
94
95
|
}): Promise<TReply>;
|
|
95
96
|
requestRawFromSpotToSpot(sourceSpot: ZLinkBackendSpot, spotRouteTarget: ZLinkSpotRouteTarget, request: Message, options: {
|
|
96
97
|
readonly timeoutMs?: number;
|
|
97
98
|
readonly signal?: AbortSignal;
|
|
99
|
+
readonly onAdmitted?: () => void;
|
|
98
100
|
}): Promise<readonly Message[]>;
|
|
99
101
|
requestRawToSpot(spotRouteTarget: ZLinkSpotRouteTarget, request: Message, options: {
|
|
100
102
|
readonly timeoutMs?: number;
|
|
101
103
|
readonly signal?: AbortSignal;
|
|
104
|
+
readonly onAdmitted?: () => void;
|
|
102
105
|
}): Promise<readonly Message[]>;
|
|
103
106
|
private requestRawToSpotScoped;
|
|
104
107
|
private requireManager;
|
|
105
108
|
private meshNode;
|
|
106
|
-
private isSelfNode;
|
|
107
109
|
private isKnownBackendPeer;
|
|
108
110
|
private submitLocalNode;
|
|
109
111
|
private requireMeshNode;
|
|
@@ -19,6 +19,7 @@ const framework_errors_internal_1 = require("../framework-errors-internal");
|
|
|
19
19
|
const submission_result_1 = require("../messaging/submission-result");
|
|
20
20
|
const routing_id_1 = require("../routing-id");
|
|
21
21
|
const channel_envelope_1 = require("./channel-envelope");
|
|
22
|
+
const NON_BLOCKING_SEND_OPTIONS = Object.freeze({ flags: runtime_values_1.ZLINK_BACKEND_SEND_DONT_WAIT });
|
|
22
23
|
class ZLinkRuntimeRouteTransport {
|
|
23
24
|
manager;
|
|
24
25
|
routeChannelPredicate;
|
|
@@ -52,15 +53,19 @@ class ZLinkRuntimeRouteTransport {
|
|
|
52
53
|
this.routeChannelPredicate?.(routerChannelId) ??
|
|
53
54
|
false);
|
|
54
55
|
}
|
|
55
|
-
|
|
56
|
+
submit(meshName, targetNodeRid, packetName, message, metadata) {
|
|
56
57
|
// Call-scoped flow (spec 27 §4): the envelope flow pair lives only for
|
|
57
58
|
// the duration of this outbound call, never in the caller's context.
|
|
58
|
-
|
|
59
|
+
if (!this.flowCreationEnabled())
|
|
60
|
+
return this.submitNode(meshName, targetNodeRid, packetName, message, metadata, false);
|
|
61
|
+
return (0, flow_context_1.runWithOutboundFlow)(true, () => this.submitNode(meshName, targetNodeRid, packetName, message, metadata, false));
|
|
59
62
|
}
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
submitInfrastructure(meshName, targetNodeRid, packetName, message, metadata) {
|
|
64
|
+
if (!this.flowCreationEnabled())
|
|
65
|
+
return this.submitNode(meshName, targetNodeRid, packetName, message, metadata, true);
|
|
66
|
+
return (0, flow_context_1.runWithOutboundFlow)(true, () => this.submitNode(meshName, targetNodeRid, packetName, message, metadata, true));
|
|
62
67
|
}
|
|
63
|
-
|
|
68
|
+
submitNode(meshName, targetNodeRid, packetName, message, metadata, allowObjectClientTarget) {
|
|
64
69
|
const node = this.meshNode(meshName);
|
|
65
70
|
if (node === undefined) {
|
|
66
71
|
return this.requireManager().routeSubmit(meshName, targetNodeRid, packetName, message, metadata);
|
|
@@ -70,28 +75,35 @@ class ZLinkRuntimeRouteTransport {
|
|
|
70
75
|
return { status: submission_result_1.ZLinkSubmitStatus.TargetNotFound };
|
|
71
76
|
}
|
|
72
77
|
const parts = this.encodeMessage(3 /* ZLinkChannelMessageKind.Command */, meshName, packetName, message, undefined, metadata);
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
75
|
-
return this.submitLocalNode(meshName, String(
|
|
78
|
+
const sourceNodeRid = node.routingId ?? node.status().routingId;
|
|
79
|
+
if ((0, routing_id_1.routingIdsEqual)(sourceNodeRid, targetNodeRid)) {
|
|
80
|
+
return this.submitLocalNode(meshName, String(sourceNodeRid), parts);
|
|
76
81
|
}
|
|
77
|
-
if (
|
|
78
|
-
this.
|
|
82
|
+
if (this.manualNodeTarget?.(meshName, targetNodeRid) === false &&
|
|
83
|
+
!this.isKnownBackendPeer(node, targetNodeRid)) {
|
|
79
84
|
return { status: submission_result_1.ZLinkSubmitStatus.TargetNotFound };
|
|
80
85
|
}
|
|
81
86
|
try {
|
|
82
|
-
|
|
87
|
+
const submitted = node.sendToNode((0, routing_id_1.toBackendRoutingId)(targetNodeRid), parts, NON_BLOCKING_SEND_OPTIONS);
|
|
88
|
+
return submitted instanceof Promise
|
|
89
|
+
? submitted.then(mapMeshSubmitResult, (error) => {
|
|
90
|
+
throw mapMeshSubmissionError(error, `MeshNode '${meshName}' send to node '${targetNodeRid}'`);
|
|
91
|
+
})
|
|
92
|
+
: mapMeshSubmitResult(submitted);
|
|
83
93
|
}
|
|
84
94
|
catch (error) {
|
|
85
|
-
throw mapMeshSubmissionError(error,
|
|
95
|
+
throw mapMeshSubmissionError(error, `MeshNode '${meshName}' send to node '${targetNodeRid}'`);
|
|
86
96
|
}
|
|
87
97
|
}
|
|
88
|
-
request(meshName, targetNodeRid, packetName, request, timeoutMs, signal, metadata) {
|
|
89
|
-
|
|
98
|
+
request(meshName, targetNodeRid, packetName, request, timeoutMs, signal, metadata, onAdmitted) {
|
|
99
|
+
if (!this.flowCreationEnabled())
|
|
100
|
+
return this.requestScoped(meshName, targetNodeRid, packetName, request, timeoutMs, signal, metadata, onAdmitted);
|
|
101
|
+
return (0, flow_context_1.runWithOutboundFlow)(true, () => this.requestScoped(meshName, targetNodeRid, packetName, request, timeoutMs, signal, metadata, onAdmitted));
|
|
90
102
|
}
|
|
91
|
-
async requestScoped(meshName, targetNodeRid, packetName, request, timeoutMs, signal, metadata) {
|
|
103
|
+
async requestScoped(meshName, targetNodeRid, packetName, request, timeoutMs, signal, metadata, onAdmitted) {
|
|
92
104
|
const node = this.meshNode(meshName);
|
|
93
105
|
if (node === undefined) {
|
|
94
|
-
return this.requireManager().routeRequest(meshName, targetNodeRid, packetName, request, timeoutMs, signal, metadata);
|
|
106
|
+
return this.requireManager().routeRequest(meshName, targetNodeRid, packetName, request, timeoutMs, signal, metadata, onAdmitted);
|
|
95
107
|
}
|
|
96
108
|
const correlationId = (0, channel_envelope_1.newChannelCorrelationId)();
|
|
97
109
|
try {
|
|
@@ -100,14 +112,18 @@ class ZLinkRuntimeRouteTransport {
|
|
|
100
112
|
throw (0, framework_errors_internal_1.createInternalFrameworkException)(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.RequestTargetNotFound, `MeshNode '${meshName}' target '${targetNodeRid}' is an Object Client.`);
|
|
101
113
|
}
|
|
102
114
|
const parts = this.encodeMessage(1 /* ZLinkChannelMessageKind.Request */, meshName, packetName, request, timeoutMs ?? Registration_1.DEFAULT_REQUEST_TIMEOUT_MS, metadata, correlationId);
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
115
|
+
const requestOptions = { flags: 1, onAdmitted, timeoutMs: requestTimeoutBudget(timeoutMs) };
|
|
116
|
+
let completion;
|
|
117
|
+
try {
|
|
118
|
+
completion = await this.completionTable(meshName).submit(() => {
|
|
119
|
+
const operationId = node.requestToNode((0, routing_id_1.toBackendRoutingId)(targetNodeRid), parts, requestOptions);
|
|
120
|
+
this.traceNodeRequest(ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Sent, undefined, meshName, targetNodeRid, packetName, correlationId);
|
|
121
|
+
return operationId;
|
|
122
|
+
}, signal);
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
throw mapMeshSubmissionError(error, `MeshNode '${meshName}' request to node '${targetNodeRid}'`);
|
|
126
|
+
}
|
|
111
127
|
const reply = this.decodeMeshReply(meshName, completion);
|
|
112
128
|
this.traceNodeRequest(ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.ReplyReceived, 'succeeded', meshName, targetNodeRid, packetName, correlationId);
|
|
113
129
|
return reply;
|
|
@@ -142,7 +158,7 @@ class ZLinkRuntimeRouteTransport {
|
|
|
142
158
|
const parts = this.encodeMessage(3 /* ZLinkChannelMessageKind.Command */, channelName, packetName, message, undefined, metadata);
|
|
143
159
|
const operation = `MeshNode '${meshName}' send to channel '${channelName}'`;
|
|
144
160
|
try {
|
|
145
|
-
const result = mapMeshSubmitResult(await node.sendToChannel(channelName, parts,
|
|
161
|
+
const result = mapMeshSubmitResult(await node.sendToChannel(channelName, parts, NON_BLOCKING_SEND_OPTIONS));
|
|
146
162
|
if (result.status === submission_result_1.ZLinkSubmitStatus.TargetNotFound) {
|
|
147
163
|
this.metrics?.recordChannelSelectionFailure(meshName, channelName, 'no_ready_target');
|
|
148
164
|
}
|
|
@@ -152,42 +168,38 @@ class ZLinkRuntimeRouteTransport {
|
|
|
152
168
|
throw mapMeshSubmissionError(error, operation);
|
|
153
169
|
}
|
|
154
170
|
}
|
|
155
|
-
requestToChannel(meshName, channelName, packetName, request, timeoutMs, signal, metadata) {
|
|
156
|
-
|
|
171
|
+
requestToChannel(meshName, channelName, packetName, request, timeoutMs, signal, metadata, onAdmitted) {
|
|
172
|
+
if (!this.flowCreationEnabled())
|
|
173
|
+
return this.requestToChannelScoped(meshName, channelName, packetName, request, timeoutMs, signal, metadata, onAdmitted);
|
|
174
|
+
return (0, flow_context_1.runWithOutboundFlow)(true, () => this.requestToChannelScoped(meshName, channelName, packetName, request, timeoutMs, signal, metadata, onAdmitted));
|
|
157
175
|
}
|
|
158
|
-
async requestToChannelScoped(meshName, channelName, packetName, request, timeoutMs, signal, metadata) {
|
|
176
|
+
async requestToChannelScoped(meshName, channelName, packetName, request, timeoutMs, signal, metadata, onAdmitted) {
|
|
159
177
|
(0, abort_1.throwIfAborted)(signal);
|
|
160
178
|
const node = this.requireMeshNode(meshName);
|
|
161
179
|
const parts = this.encodeMessage(1 /* ZLinkChannelMessageKind.Request */, channelName, packetName, request, timeoutMs ?? Registration_1.DEFAULT_REQUEST_TIMEOUT_MS, metadata);
|
|
162
180
|
const metric = this.metrics?.startRequest(meshName, 'channel');
|
|
163
181
|
try {
|
|
164
|
-
const
|
|
182
|
+
const requestOptions = { flags: 1, timeoutMs: requestTimeoutBudget(timeoutMs), onAdmitted };
|
|
183
|
+
let completion;
|
|
184
|
+
try {
|
|
185
|
+
completion = await this.completionTable(meshName).submit(() => node.requestToChannel(channelName, parts, requestOptions), signal);
|
|
186
|
+
}
|
|
187
|
+
catch (error) {
|
|
188
|
+
throw mapMeshSubmissionError(error, `MeshNode '${meshName}' request to channel '${channelName}'`);
|
|
189
|
+
}
|
|
165
190
|
const reply = this.decodeMeshReply(meshName, completion);
|
|
166
191
|
metric?.complete('completed');
|
|
167
192
|
return reply;
|
|
168
193
|
}
|
|
169
194
|
catch (error) {
|
|
170
|
-
metric?.complete(requestMetricOutcome(error));
|
|
171
|
-
if (
|
|
195
|
+
metric?.complete(requestMetricOutcome(error, signal));
|
|
196
|
+
if (error instanceof contracts_1.ZLinkFrameworkException &&
|
|
197
|
+
(0, framework_errors_internal_1.internalFrameworkErrorKind)(error) === framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.RequestTargetNotFound) {
|
|
172
198
|
this.metrics?.recordChannelSelectionFailure(meshName, channelName, 'no_ready_target');
|
|
173
199
|
}
|
|
174
200
|
throw error;
|
|
175
201
|
}
|
|
176
202
|
}
|
|
177
|
-
async submitRequestOperation(meshName, timeoutMs, signal, operation, attempt) {
|
|
178
|
-
const effectiveTimeoutMs = Math.max(1, timeoutMs ?? Registration_1.DEFAULT_REQUEST_TIMEOUT_MS);
|
|
179
|
-
const deadlineMs = performance.now() + effectiveTimeoutMs;
|
|
180
|
-
const remainingTimeoutMs = deadlineMs - performance.now();
|
|
181
|
-
if (remainingTimeoutMs <= 0) {
|
|
182
|
-
throw (0, framework_errors_internal_1.createInternalFrameworkException)(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.DeadlineExceeded, `${operation} timed out before submission.`);
|
|
183
|
-
}
|
|
184
|
-
try {
|
|
185
|
-
return await this.completionTable(meshName).submit(() => attempt(Math.max(1, Math.ceil(remainingTimeoutMs))), signal);
|
|
186
|
-
}
|
|
187
|
-
catch (error) {
|
|
188
|
-
throw mapMeshSubmissionError(error, operation);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
203
|
sendToSpot(spotRouteTarget, message, options) {
|
|
192
204
|
return (0, flow_context_1.runWithOutboundFlow)(this.flowCreationEnabled(), () => this.sendToSpotScoped(spotRouteTarget, message, options));
|
|
193
205
|
}
|
|
@@ -232,18 +244,19 @@ class ZLinkRuntimeRouteTransport {
|
|
|
232
244
|
if (spotRouteTarget.spotKind === Spots_1.ZLinkSpotKind.Instance) {
|
|
233
245
|
throw new configuration_1.ZLinkConfigurationException('Instance Spot routes require the MeshNode command 39 transport.');
|
|
234
246
|
}
|
|
235
|
-
return this.requireManager().routeRequestToSpot(spotRouteTarget, options.packetName, request, options.timeoutMs, options.signal, options.metadata);
|
|
247
|
+
return this.requireManager().routeRequestToSpot(spotRouteTarget, options.packetName, request, options.timeoutMs, options.signal, options.metadata, options.onAdmitted);
|
|
236
248
|
}
|
|
237
249
|
(0, abort_1.throwIfAborted)(options.signal);
|
|
238
250
|
let completionPromise;
|
|
239
251
|
try {
|
|
240
252
|
const encoded = this.encodeMessage(1 /* ZLinkChannelMessageKind.Request */, meshName, options.packetName, request, options.timeoutMs, options.metadata);
|
|
241
253
|
completionPromise = this.completionTable(meshName).submit(() => spotRouteTarget.spotKind === Spots_1.ZLinkSpotKind.Instance
|
|
242
|
-
? node.requestInstanceSpot(instanceSpotRouteFence(spotRouteTarget), encoded, options.timeoutMs, undefined, options.metadata, options.instanceSpot)
|
|
254
|
+
? node.requestInstanceSpot(instanceSpotRouteFence(spotRouteTarget), encoded, options.timeoutMs, undefined, options.metadata, options.instanceSpot, options.onAdmitted)
|
|
243
255
|
: node
|
|
244
256
|
.entrySpot()
|
|
245
257
|
.requestToSpot((0, routing_id_1.toBackendRoutingId)(spotRouteTarget.targetNodeRid), (0, routing_id_1.toBackendRoutingId)(spotRouteTarget.spotId), spotRouteTarget.targetSpotGeneration ?? 0n, encoded, {
|
|
246
258
|
flags: 1,
|
|
259
|
+
onAdmitted: options.onAdmitted,
|
|
247
260
|
timeoutMs: options.timeoutMs,
|
|
248
261
|
routeFence: directSpotRouteFence(spotRouteTarget),
|
|
249
262
|
entrySpot: spotRouteTarget.spotKind === Spots_1.ZLinkSpotKind.Entry
|
|
@@ -255,10 +268,10 @@ class ZLinkRuntimeRouteTransport {
|
|
|
255
268
|
return this.waitForMeshReply(meshName, completionPromise);
|
|
256
269
|
}
|
|
257
270
|
async requestFromSpotToSpot(sourceSpot, spotRouteTarget, request, options) {
|
|
258
|
-
return this.requireManager().routeRequestFromSpotToSpot(sourceSpot, spotRouteTarget, options.packetName, request, options.timeoutMs, options.signal);
|
|
271
|
+
return this.requireManager().routeRequestFromSpotToSpot(sourceSpot, spotRouteTarget, options.packetName, request, options.timeoutMs, options.signal, options.onAdmitted);
|
|
259
272
|
}
|
|
260
273
|
async requestRawFromSpotToSpot(sourceSpot, spotRouteTarget, request, options) {
|
|
261
|
-
return this.requireManager().routeRequestRawFromSpotToSpot(sourceSpot, spotRouteTarget, request, options.timeoutMs, options.signal);
|
|
274
|
+
return this.requireManager().routeRequestRawFromSpotToSpot(sourceSpot, spotRouteTarget, request, options.timeoutMs, options.signal, options.onAdmitted);
|
|
262
275
|
}
|
|
263
276
|
requestRawToSpot(spotRouteTarget, request, options) {
|
|
264
277
|
return (0, flow_context_1.runWithOutboundFlow)(this.flowCreationEnabled(), () => this.requestRawToSpotScoped(spotRouteTarget, request, options));
|
|
@@ -277,6 +290,7 @@ class ZLinkRuntimeRouteTransport {
|
|
|
277
290
|
.entrySpot()
|
|
278
291
|
.requestToSpot((0, routing_id_1.toBackendRoutingId)(spotRouteTarget.targetNodeRid), (0, routing_id_1.toBackendRoutingId)(spotRouteTarget.spotId), spotRouteTarget.targetSpotGeneration ?? 0n, parts, {
|
|
279
292
|
flags: 1,
|
|
293
|
+
onAdmitted: options.onAdmitted,
|
|
280
294
|
timeoutMs: options.timeoutMs,
|
|
281
295
|
routeFence: directSpotRouteFence(spotRouteTarget),
|
|
282
296
|
entrySpot: spotRouteTarget.spotKind === Spots_1.ZLinkSpotKind.Entry
|
|
@@ -302,7 +316,7 @@ class ZLinkRuntimeRouteTransport {
|
|
|
302
316
|
(0, mesh_completion_table_1.closeMeshCompletion)(completion);
|
|
303
317
|
}
|
|
304
318
|
}
|
|
305
|
-
return this.requireManager().routeRequestRawToSpot(spotRouteTarget, request, options.timeoutMs, options.signal);
|
|
319
|
+
return this.requireManager().routeRequestRawToSpot(spotRouteTarget, request, options.timeoutMs, options.signal, options.onAdmitted);
|
|
306
320
|
}
|
|
307
321
|
requireManager() {
|
|
308
322
|
const manager = this.manager();
|
|
@@ -312,11 +326,7 @@ class ZLinkRuntimeRouteTransport {
|
|
|
312
326
|
return manager;
|
|
313
327
|
}
|
|
314
328
|
meshNode(meshName) {
|
|
315
|
-
|
|
316
|
-
return runtime?.meshNode?.(meshName);
|
|
317
|
-
}
|
|
318
|
-
isSelfNode(node, targetNodeRid) {
|
|
319
|
-
return (0, routing_id_1.routingIdsEqual)(node.status().routingId, targetNodeRid);
|
|
329
|
+
return this.meshRuntime?.()?.meshNode?.(meshName);
|
|
320
330
|
}
|
|
321
331
|
isKnownBackendPeer(node, targetNodeRid) {
|
|
322
332
|
return node
|
|
@@ -411,6 +421,13 @@ function instanceSpotRouteFence(target) {
|
|
|
411
421
|
storeVersion: target.authorityStoreVersion
|
|
412
422
|
};
|
|
413
423
|
}
|
|
424
|
+
/**
|
|
425
|
+
* The binding request timeout for one submission. The binding owns the
|
|
426
|
+
* deadline after submit; the completion table slot only waits for it.
|
|
427
|
+
*/
|
|
428
|
+
function requestTimeoutBudget(timeoutMs) {
|
|
429
|
+
return Math.max(1, Math.ceil(timeoutMs ?? Registration_1.DEFAULT_REQUEST_TIMEOUT_MS));
|
|
430
|
+
}
|
|
414
431
|
function mapMeshSubmitResult(result) {
|
|
415
432
|
return (0, submission_result_1.classifySubmitResult)(result, 'Mesh submission');
|
|
416
433
|
}
|
|
@@ -469,14 +486,16 @@ function meshRequestFailure(meshName, result, nativeErrno) {
|
|
|
469
486
|
});
|
|
470
487
|
return error;
|
|
471
488
|
}
|
|
472
|
-
function requestMetricOutcome(error) {
|
|
489
|
+
function requestMetricOutcome(error, signal) {
|
|
473
490
|
if (error instanceof contracts_1.ZLinkFrameworkException) {
|
|
474
|
-
if ((0, framework_errors_internal_1.internalFrameworkErrorKind)(error) === framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.RequestTargetNotFound)
|
|
475
|
-
return 'target_not_found';
|
|
476
491
|
if ((0, framework_errors_internal_1.internalFrameworkErrorKind)(error) === framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.DeadlineExceeded)
|
|
477
492
|
return 'timed_out';
|
|
478
493
|
if ((0, framework_errors_internal_1.internalFrameworkErrorKind)(error) === framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.RuntimeShutdown)
|
|
479
494
|
return 'shutdown';
|
|
480
495
|
}
|
|
496
|
+
if (signal?.aborted === true &&
|
|
497
|
+
(error === signal.reason ||
|
|
498
|
+
(error instanceof Error && (error.cause === signal.reason || error.name === 'AbortError'))))
|
|
499
|
+
return 'cancelled';
|
|
481
500
|
return 'failed';
|
|
482
501
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ZLinkClientServerLocationRuntime = void 0;
|
|
4
|
+
const routing_id_1 = require("../routing-id");
|
|
4
5
|
const RegistrationBuilderPolicy_1 = require("../../contracts/Configuration/RegistrationBuilderPolicy");
|
|
5
6
|
const Locations_1 = require("../../contracts/Locations");
|
|
6
7
|
const Options_1 = require("../../contracts/Locations/Options");
|
|
@@ -91,7 +92,7 @@ class ZLinkClientServerLocationRuntime {
|
|
|
91
92
|
ownerId: owner.ownerId,
|
|
92
93
|
leaseGeneration: owner.leaseGeneration
|
|
93
94
|
};
|
|
94
|
-
const result = await this.store.updateClientServer(candidate, Locations_1.ZLinkLocationWriteIntent.Takeover, signal);
|
|
95
|
+
const result = await this.locationRuntime.writeDescriptor((writeSignal) => this.store.updateClientServer(candidate, Locations_1.ZLinkLocationWriteIntent.Takeover, writeSignal), signal);
|
|
95
96
|
if (result.status !== Locations_1.ZLinkLocationWriteStatus.Stored) {
|
|
96
97
|
throw new configuration_1.ZLinkConfigurationException(`ClientServer server '${channelName}' descriptor recovery was fenced.`);
|
|
97
98
|
}
|
|
@@ -115,7 +116,7 @@ class ZLinkClientServerLocationRuntime {
|
|
|
115
116
|
descriptorRevision: current.descriptorRevision + 1n,
|
|
116
117
|
weight: runtimeWeight
|
|
117
118
|
};
|
|
118
|
-
const result = await this.store.updateClientServer(candidate, Locations_1.ZLinkLocationWriteIntent.Renew, signal);
|
|
119
|
+
const result = await this.locationRuntime.writeDescriptor((writeSignal) => this.store.updateClientServer(candidate, Locations_1.ZLinkLocationWriteIntent.Renew, writeSignal), signal);
|
|
119
120
|
if (result.status !== Locations_1.ZLinkLocationWriteStatus.Stored) {
|
|
120
121
|
throw new configuration_1.ZLinkConfigurationException(`ClientServer server '${channelName}' descriptor renewal was fenced.`);
|
|
121
122
|
}
|
|
@@ -138,7 +139,7 @@ class ZLinkClientServerLocationRuntime {
|
|
|
138
139
|
leaseGeneration: owner.leaseGeneration,
|
|
139
140
|
updatedAt: new Date(0)
|
|
140
141
|
};
|
|
141
|
-
const result = await this.store.updateClientServer(descriptor, Locations_1.ZLinkLocationWriteIntent.NewClaim, signal);
|
|
142
|
+
const result = await this.locationRuntime.writeDescriptor((writeSignal) => this.store.updateClientServer(descriptor, Locations_1.ZLinkLocationWriteIntent.NewClaim, writeSignal), signal);
|
|
142
143
|
if (result.status !== Locations_1.ZLinkLocationWriteStatus.Stored) {
|
|
143
144
|
throw new configuration_1.ZLinkConfigurationException(`ClientServer server '${channelName}' descriptor claim failed with '${result.status}'.`);
|
|
144
145
|
}
|
|
@@ -452,7 +453,7 @@ function requestAdmission(dealer, descriptor, timeoutMs) {
|
|
|
452
453
|
}
|
|
453
454
|
function requireMatchingAdmission(expected, actual) {
|
|
454
455
|
if (actual.channelName !== expected.channelName ||
|
|
455
|
-
actual.serverRid
|
|
456
|
+
!(0, routing_id_1.routingIdsEqual)(actual.serverRid, expected.serverRid) ||
|
|
456
457
|
actual.lifecycleGeneration !== expected.lifecycleGeneration ||
|
|
457
458
|
actual.descriptorRevision !== expected.descriptorRevision ||
|
|
458
459
|
actual.weight !== expected.weight ||
|
|
@@ -4,9 +4,10 @@ import type { ZLinkDispatchErrorSink } from '../diagnostics/dispatch-error-port'
|
|
|
4
4
|
export type { ZLinkDispatchErrorSink } from '../diagnostics/dispatch-error-port';
|
|
5
5
|
type ZLinkRuntimeDispatchFailure = ZLinkDispatchFailure & {
|
|
6
6
|
readonly error?: unknown;
|
|
7
|
+
readonly severity?: 'warning';
|
|
7
8
|
};
|
|
8
9
|
export declare class ZLinkDispatchErrorReporter {
|
|
9
|
-
|
|
10
|
+
readonly metrics?: ZLinkRuntimeMetrics | undefined;
|
|
10
11
|
private reportedEvents;
|
|
11
12
|
/**
|
|
12
13
|
* Success-path tracer companion: every surface already receives a reporter, so
|
|
@@ -63,7 +63,8 @@ class ZLinkDispatchErrorReporter {
|
|
|
63
63
|
errorType: errorInfo.errorType,
|
|
64
64
|
errorMessage: errorInfo.errorMessage,
|
|
65
65
|
errorCauseType: errorInfo.errorCauseType,
|
|
66
|
-
errorCauseMessage: errorInfo.errorCauseMessage
|
|
66
|
+
errorCauseMessage: errorInfo.errorCauseMessage,
|
|
67
|
+
severity: normalized.severity
|
|
67
68
|
});
|
|
68
69
|
}
|
|
69
70
|
captureEnabled() {
|
|
@@ -30,7 +30,7 @@ export declare class ZLinkFanoutLocationRuntime {
|
|
|
30
30
|
lifecycleGeneration: bigint;
|
|
31
31
|
descriptorRevision: bigint;
|
|
32
32
|
advertisedEndpoint: string;
|
|
33
|
-
state: "error" | "preparing" | "serving" | "
|
|
33
|
+
state: "error" | "preparing" | "serving" | "stopped" | "retiring";
|
|
34
34
|
}[] | undefined;
|
|
35
35
|
private isAutomaticSubscriber;
|
|
36
36
|
reclaimOwnerRows(signal?: AbortSignal): Promise<void>;
|
|
@@ -112,7 +112,7 @@ class ZLinkFanoutLocationRuntime {
|
|
|
112
112
|
ownerId: owner.ownerId,
|
|
113
113
|
leaseGeneration: owner.leaseGeneration
|
|
114
114
|
};
|
|
115
|
-
const result = await this.store.updateFanoutPublisher(candidate, Locations_1.ZLinkLocationWriteIntent.Takeover, signal);
|
|
115
|
+
const result = await this.locationRuntime.writeDescriptor((writeSignal) => this.store.updateFanoutPublisher(candidate, Locations_1.ZLinkLocationWriteIntent.Takeover, writeSignal), signal);
|
|
116
116
|
if (result.status !== Locations_1.ZLinkLocationWriteStatus.Stored) {
|
|
117
117
|
throw new configuration_1.ZLinkConfigurationException(`Fanout publisher '${channelName}' descriptor recovery was fenced.`);
|
|
118
118
|
}
|
|
@@ -135,7 +135,7 @@ class ZLinkFanoutLocationRuntime {
|
|
|
135
135
|
}
|
|
136
136
|
const current = await this.lane.run(() => this.localDescriptors.get(channelName));
|
|
137
137
|
if (current !== undefined) {
|
|
138
|
-
const result = await this.store.updateFanoutPublisher(current, Locations_1.ZLinkLocationWriteIntent.Renew, signal);
|
|
138
|
+
const result = await this.locationRuntime.writeDescriptor((writeSignal) => this.store.updateFanoutPublisher(current, Locations_1.ZLinkLocationWriteIntent.Renew, writeSignal), signal);
|
|
139
139
|
if (result.status !== Locations_1.ZLinkLocationWriteStatus.Stored) {
|
|
140
140
|
throw new configuration_1.ZLinkConfigurationException(`Fanout publisher '${channelName}' descriptor renewal was fenced.`);
|
|
141
141
|
}
|
|
@@ -169,7 +169,7 @@ class ZLinkFanoutLocationRuntime {
|
|
|
169
169
|
leaseGeneration: owner.leaseGeneration,
|
|
170
170
|
updatedAt: new Date(0)
|
|
171
171
|
};
|
|
172
|
-
const result = await this.store.updateFanoutPublisher(descriptor, Locations_1.ZLinkLocationWriteIntent.NewClaim, signal);
|
|
172
|
+
const result = await this.locationRuntime.writeDescriptor((writeSignal) => this.store.updateFanoutPublisher(descriptor, Locations_1.ZLinkLocationWriteIntent.NewClaim, writeSignal), signal);
|
|
173
173
|
if (result.status !== Locations_1.ZLinkLocationWriteStatus.Stored) {
|
|
174
174
|
throw new configuration_1.ZLinkConfigurationException(`Fanout publisher '${channelName}' descriptor claim failed with '${result.status}'.`);
|
|
175
175
|
}
|
|
@@ -5,5 +5,5 @@ export declare class ZLinkLocalSpotRouteTransport {
|
|
|
5
5
|
private readonly defaultRequestTimeoutMs;
|
|
6
6
|
constructor(dispatcher: ZLinkLocalSpotRouteDispatcher | undefined, defaultRequestTimeoutMs: number | undefined);
|
|
7
7
|
send(routerChannelId: string, spotId: RoutingId, packetName: string | undefined, message: unknown, metadata?: ReadonlyMap<string, string>): Promise<void>;
|
|
8
|
-
request<TReply>(routerChannelId: string, spotId: RoutingId, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal): Promise<TReply>;
|
|
8
|
+
request<TReply>(routerChannelId: string, spotId: RoutingId, packetName: string | undefined, request: unknown, timeoutMs: number | undefined, signal?: AbortSignal, onAdmitted?: () => void): Promise<TReply>;
|
|
9
9
|
}
|
|
@@ -18,12 +18,13 @@ class ZLinkLocalSpotRouteTransport {
|
|
|
18
18
|
metadata
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
request(routerChannelId, spotId, packetName, request, timeoutMs, signal) {
|
|
21
|
+
request(routerChannelId, spotId, packetName, request, timeoutMs, signal, onAdmitted) {
|
|
22
22
|
if (this.dispatcher === undefined) {
|
|
23
23
|
throw new configuration_1.ZLinkConfigurationException(`Route channel '${routerChannelId}' could not dispatch local SPOT request.`);
|
|
24
24
|
}
|
|
25
25
|
const pending = this.dispatcher.request(spotId, packetName, request, {
|
|
26
26
|
channelName: routerChannelId,
|
|
27
|
+
onAdmitted,
|
|
27
28
|
signal
|
|
28
29
|
});
|
|
29
30
|
const effectiveTimeoutMs = timeoutMs ?? this.defaultRequestTimeoutMs;
|
|
@@ -7,6 +7,6 @@ export declare class ZLinkRouterSocketSpotRouteTransport {
|
|
|
7
7
|
private readonly sockets;
|
|
8
8
|
constructor(sockets: ZLinkChannelSocketRegistry);
|
|
9
9
|
send(target: ZLinkSpotRouteTarget, parts: readonly Message[], flags: ZLinkBackendSendFlags): Promise<void>;
|
|
10
|
-
request<TReply>(target: ZLinkSpotRouteTarget, parts: readonly Message[], codecs: ZLinkChannelEnvelopeCodecRegistry | undefined, flags: ZLinkBackendSendFlags, timeoutMs: number | undefined, signal?: AbortSignal): Promise<TReply>;
|
|
11
|
-
requestRaw(target: ZLinkSpotRouteTarget, request: Message, timeoutMs: number | undefined, signal?: AbortSignal): Promise<readonly Message[]>;
|
|
10
|
+
request<TReply>(target: ZLinkSpotRouteTarget, parts: readonly Message[], codecs: ZLinkChannelEnvelopeCodecRegistry | undefined, flags: ZLinkBackendSendFlags, timeoutMs: number | undefined, signal?: AbortSignal, onAdmitted?: () => void): Promise<TReply>;
|
|
11
|
+
requestRaw(target: ZLinkSpotRouteTarget, request: Message, timeoutMs: number | undefined, signal?: AbortSignal, onAdmitted?: () => void): Promise<readonly Message[]>;
|
|
12
12
|
}
|
|
@@ -17,10 +17,10 @@ class ZLinkRouterSocketSpotRouteTransport {
|
|
|
17
17
|
(0, channel_envelope_1.closeMessages)(parts);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
async request(target, parts, codecs, flags, timeoutMs, signal) {
|
|
20
|
+
async request(target, parts, codecs, flags, timeoutMs, signal, onAdmitted) {
|
|
21
21
|
const router = this.sockets.routeRouter(target.routerChannelId);
|
|
22
22
|
void flags;
|
|
23
|
-
const operation = router.requestToSpot(target.targetNodeRid, target.spotId, parts, timeoutMs);
|
|
23
|
+
const operation = router.requestToSpot(target.targetNodeRid, target.spotId, parts, timeoutMs, onAdmitted);
|
|
24
24
|
const replyParts = await (0, abort_1.awaitWithAbort)(operation, signal, () => {
|
|
25
25
|
void operation.then(channel_envelope_1.closeMessages, () => undefined);
|
|
26
26
|
});
|
|
@@ -32,9 +32,9 @@ class ZLinkRouterSocketSpotRouteTransport {
|
|
|
32
32
|
(0, channel_envelope_1.closeMessages)(parts);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
async requestRaw(target, request, timeoutMs, signal) {
|
|
35
|
+
async requestRaw(target, request, timeoutMs, signal, onAdmitted) {
|
|
36
36
|
const router = this.sockets.routeRouter(target.routerChannelId);
|
|
37
|
-
const operation = router.requestToSpot(target.targetNodeRid, target.spotId, [request], timeoutMs);
|
|
37
|
+
const operation = router.requestToSpot(target.targetNodeRid, target.spotId, [request], timeoutMs, onAdmitted);
|
|
38
38
|
return await (0, abort_1.awaitWithAbort)(operation, signal, () => {
|
|
39
39
|
void operation.then(channel_envelope_1.closeMessages, () => undefined);
|
|
40
40
|
});
|