@zlink-systems/framework 0.30.3 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/contracts/Actors/ZLinkActor.d.ts +2 -0
- package/dist/contracts/Actors/ZLinkSessionBindingIdentity.d.ts +6 -0
- package/dist/contracts/Actors/ZLinkSessionBindingIdentity.js +2 -0
- package/dist/contracts/Actors/index.d.ts +1 -0
- package/dist/contracts/Actors/index.js +1 -0
- package/dist/contracts/Common/CoreTypes.d.ts +1 -0
- package/dist/contracts/Common/HandlerMessageType.d.ts +8 -0
- package/dist/contracts/Common/HandlerMessageType.js +41 -0
- package/dist/contracts/Common/ZLinkEncodedPayload.d.ts +1 -1
- package/dist/contracts/Common/ZLinkEncodedPayload.js +12 -20
- package/dist/contracts/Common/ZLinkMessage.js +11 -7
- package/dist/contracts/Common/encoded-payload-storage.d.ts +0 -2
- package/dist/contracts/Common/encoded-payload-storage.js +4 -16
- package/dist/contracts/Common/index.d.ts +1 -1
- package/dist/contracts/Common/payload-slab.d.ts +4 -0
- package/dist/contracts/Common/payload-slab.js +30 -0
- package/dist/contracts/Configuration/RegistrationBuilders.js +15 -9
- package/dist/contracts/Configuration/RegistrationTypes.d.ts +19 -0
- package/dist/contracts/Handlers/Contexts.d.ts +1 -0
- package/dist/contracts/Locations/Authority.d.ts +2 -0
- package/dist/internal.d.ts +9 -0
- package/dist/internal.js +23 -1
- package/dist/nest-integration.d.ts +1 -0
- package/dist/nest-integration.js +3 -1
- package/dist/runtime/actors/actor-client.d.ts +6 -2
- package/dist/runtime/actors/actor-client.js +120 -82
- package/dist/runtime/actors/actor-context.js +16 -5
- package/dist/runtime/actors/actor-execution-context.js +2 -2
- package/dist/runtime/actors/actor-handoff.d.ts +12 -1
- package/dist/runtime/actors/actor-handoff.js +79 -34
- package/dist/runtime/actors/actor-join-deferred-scope.js +6 -6
- package/dist/runtime/actors/actor-local-native-join.d.ts +2 -2
- package/dist/runtime/actors/actor-local-native-join.js +19 -17
- package/dist/runtime/actors/actor-mailbox.d.ts +1 -1
- package/dist/runtime/actors/actor-remote-joiner.d.ts +2 -2
- package/dist/runtime/actors/actor-remote-joiner.js +4 -4
- package/dist/runtime/actors/actor-routed-join-transport.d.ts +9 -3
- package/dist/runtime/actors/actor-routed-json-request.d.ts +3 -0
- package/dist/runtime/actors/actor-runtime-contracts.d.ts +2 -2
- package/dist/runtime/actors/actor-runtime-state.d.ts +1 -1
- package/dist/runtime/actors/spot-actor-dispatch.d.ts +9 -5
- package/dist/runtime/actors/spot-actor-dispatch.js +60 -38
- package/dist/runtime/admission.d.ts +6 -4
- package/dist/runtime/admission.js +21 -10
- package/dist/runtime/application-jobs/application-ingress-record-owner.d.ts +1 -0
- package/dist/runtime/application-jobs/application-ingress-record-owner.js +3 -0
- package/dist/runtime/backend/contracts/index.d.ts +26 -10
- package/dist/runtime/backend/mesh-completion-table.d.ts +7 -1
- package/dist/runtime/backend/mesh-completion-table.js +84 -20
- package/dist/runtime/backend/mesh-dispatch-pump.d.ts +19 -6
- package/dist/runtime/backend/mesh-dispatch-pump.js +246 -147
- package/dist/runtime/backend/node/node-backend-adapter-support.d.ts +3 -2
- package/dist/runtime/backend/node/node-backend-adapter-support.js +27 -19
- package/dist/runtime/backend/node/node-dealer-channel-client-transport.d.ts +5 -2
- package/dist/runtime/backend/node/node-dealer-channel-client-transport.js +70 -13
- package/dist/runtime/backend/node/node-event-loop-poller.d.ts +2 -2
- package/dist/runtime/backend/node/node-event-loop-poller.js +4 -3
- package/dist/runtime/backend/node/node-mesh-backend-adapter.js +5 -1
- package/dist/runtime/backend/node/node-raw-binding-port.d.ts +7 -2
- package/dist/runtime/backend/node/node-raw-binding-port.js +99 -63
- package/dist/runtime/backend/node/node-raw-mesh-backend.d.ts +34 -16
- package/dist/runtime/backend/node/node-raw-mesh-backend.js +210 -106
- package/dist/runtime/backend/node/node-socket-backend-adapter.js +20 -6
- package/dist/runtime/backend/raw-binding-port.d.ts +6 -3
- package/dist/runtime/channels/channel-clients.js +3 -3
- package/dist/runtime/channels/channel-dispatch-pipeline.d.ts +11 -7
- package/dist/runtime/channels/channel-dispatch-pipeline.js +40 -22
- package/dist/runtime/channels/channel-dispatch-services.d.ts +3 -1
- package/dist/runtime/channels/channel-dispatch-services.js +7 -6
- package/dist/runtime/channels/channel-dispatchers.d.ts +13 -6
- package/dist/runtime/channels/channel-dispatchers.js +57 -36
- package/dist/runtime/channels/channel-envelope.d.ts +2 -2
- package/dist/runtime/channels/channel-envelope.js +609 -83
- package/dist/runtime/channels/channel-multipart.d.ts +1 -0
- package/dist/runtime/channels/channel-multipart.js +10 -6
- package/dist/runtime/channels/channel-outbound-operations.d.ts +6 -9
- package/dist/runtime/channels/channel-outbound-operations.js +107 -105
- package/dist/runtime/channels/channel-receive-loops.d.ts +9 -7
- package/dist/runtime/channels/channel-receive-loops.js +126 -90
- package/dist/runtime/channels/channel-runtime-lifecycle.d.ts +23 -6
- package/dist/runtime/channels/channel-runtime-lifecycle.js +47 -38
- package/dist/runtime/channels/channel-runtime-manager.d.ts +13 -6
- package/dist/runtime/channels/channel-runtime-manager.js +32 -14
- package/dist/runtime/channels/channel-socket-registry.d.ts +28 -4
- package/dist/runtime/channels/channel-socket-registry.js +9 -1
- package/dist/runtime/channels/channel-transports.d.ts +23 -16
- package/dist/runtime/channels/channel-transports.js +139 -119
- package/dist/runtime/channels/dispatch-error-reporter.d.ts +4 -4
- package/dist/runtime/channels/dispatch-error-reporter.js +5 -5
- package/dist/runtime/channels/fanout-location-runtime.d.ts +1 -1
- package/dist/runtime/channels/local-spot-route-transport.d.ts +5 -2
- package/dist/runtime/channels/local-spot-route-transport.js +15 -18
- package/dist/runtime/channels/router-socket-spot-route-transport.d.ts +6 -3
- package/dist/runtime/channels/router-socket-spot-route-transport.js +33 -19
- package/dist/runtime/channels/source-spot-router.d.ts +6 -3
- package/dist/runtime/channels/source-spot-router.js +34 -23
- package/dist/runtime/channels/spot-node-route-transport.d.ts +6 -3
- package/dist/runtime/channels/spot-node-route-transport.js +23 -17
- package/dist/runtime/channels/spot-route-bridge-transport.d.ts +6 -3
- package/dist/runtime/channels/spot-route-bridge-transport.js +38 -24
- package/dist/runtime/channels/spot-route-dispatch-strategy.d.ts +8 -4
- package/dist/runtime/channels/spot-route-dispatch-strategy.js +36 -23
- package/dist/runtime/diagnostics/dispatch-error-details.js +9 -3
- package/dist/runtime/diagnostics/message-flow-bootstrap.d.ts +1 -0
- package/dist/runtime/diagnostics/message-flow-bootstrap.js +8 -0
- package/dist/runtime/diagnostics/message-flow-delivery.d.ts +47 -0
- package/dist/runtime/diagnostics/message-flow-delivery.js +149 -0
- package/dist/runtime/diagnostics/message-flow-record.d.ts +50 -0
- package/dist/runtime/diagnostics/message-flow-record.js +228 -0
- package/dist/runtime/diagnostics/message-flow-worker.d.ts +1 -0
- package/dist/runtime/diagnostics/message-flow-worker.js +118 -0
- package/dist/runtime/diagnostics/message-flow.d.ts +7 -19
- package/dist/runtime/diagnostics/message-flow.js +42 -290
- package/dist/runtime/diagnostics/runtime-metrics.d.ts +4 -3
- package/dist/runtime/diagnostics/runtime-metrics.js +8 -4
- package/dist/runtime/execution/index.d.ts +1 -0
- package/dist/runtime/execution/index.js +6 -3
- package/dist/runtime/execution/serial-execution-queue.d.ts +26 -13
- package/dist/runtime/execution/serial-execution-queue.js +75 -71
- package/dist/runtime/foundation/durable-service-request.d.ts +12 -3
- package/dist/runtime/foundation/durable-service-request.js +158 -73
- package/dist/runtime/foundation/operation-registry.d.ts +33 -3
- package/dist/runtime/foundation/operation-registry.js +272 -33
- package/dist/runtime/foundation/raw-service-mesh-runtime.d.ts +62 -23
- package/dist/runtime/foundation/raw-service-mesh-runtime.js +373 -194
- package/dist/runtime/foundation/request-runtime.d.ts +17 -0
- package/dist/runtime/foundation/request-runtime.js +163 -0
- package/dist/runtime/foundation/service-discovery-registry.d.ts +4 -0
- package/dist/runtime/foundation/service-discovery-registry.js +6 -0
- package/dist/runtime/foundation/service-liveness-registry.d.ts +1 -1
- package/dist/runtime/foundation/service-mailbox.d.ts +4 -2
- package/dist/runtime/foundation/service-mailbox.js +4 -1
- package/dist/runtime/foundation/service-relocation-object-owner.d.ts +2 -2
- package/dist/runtime/foundation/service-relocation-object-owner.js +12 -5
- package/dist/runtime/foundation/service-runtime-contracts.d.ts +7 -2
- package/dist/runtime/foundation/service-stateful-registry.d.ts +6 -2
- package/dist/runtime/foundation/service-stateful-registry.js +38 -17
- package/dist/runtime/foundation/service-stateful-runtime.d.ts +91 -26
- package/dist/runtime/foundation/service-stateful-runtime.js +245 -120
- package/dist/runtime/foundation/service-stateful-wire-codec.d.ts +3 -0
- package/dist/runtime/foundation/service-stateful-wire-codec.js +15 -0
- package/dist/runtime/foundation/service-topology-registry.d.ts +2 -0
- package/dist/runtime/foundation/service-topology-registry.js +13 -3
- package/dist/runtime/foundation/service-wire-constants.generated.d.ts +1 -0
- package/dist/runtime/foundation/service-wire-constants.generated.js +12 -0
- package/dist/runtime/foundation/service-wire-m6a-codec.d.ts +5 -1
- package/dist/runtime/foundation/service-wire-m6a-codec.js +50 -15
- package/dist/runtime/host/actor-packet-relay.d.ts +5 -6
- package/dist/runtime/host/actor-packet-relay.js +58 -57
- package/dist/runtime/host/actor-placement-coordinator.d.ts +1 -1
- package/dist/runtime/host/actor-runtime-options-factory.d.ts +2 -0
- package/dist/runtime/host/actor-runtime-options-factory.js +3 -2
- package/dist/runtime/host/actor-transfer-runtime.d.ts +3 -3
- package/dist/runtime/host/application-job-queue.d.ts +7 -5
- package/dist/runtime/host/application-job-queue.js +33 -21
- package/dist/runtime/host/bound-session-relay.js +0 -1
- package/dist/runtime/host/channel-runtime-options-factory.d.ts +2 -0
- package/dist/runtime/host/channel-runtime-options-factory.js +1 -0
- package/dist/runtime/host/entry-actor-runtime.d.ts +5 -2
- package/dist/runtime/host/entry-actor-runtime.js +2 -2
- package/dist/runtime/host/index.d.ts +106 -37
- package/dist/runtime/host/index.js +303 -151
- package/dist/runtime/host/location-runtime-owner.d.ts +2 -2
- package/dist/runtime/host/location-runtime-owner.js +1 -1
- package/dist/runtime/host/service-relocation-host-runtime.d.ts +195 -45
- package/dist/runtime/host/service-relocation-host-runtime.js +257 -144
- package/dist/runtime/host/spot-address-transport.d.ts +3 -0
- package/dist/runtime/host/spot-address-transport.js +73 -76
- package/dist/runtime/host/spot-runtime-options-factory.js +2 -0
- package/dist/runtime/host/user-spot-creation-coordinator.d.ts +3 -1
- package/dist/runtime/host/user-spot-creation-coordinator.js +49 -21
- package/dist/runtime/internal-observation.d.ts +1 -0
- package/dist/runtime/internal-observation.js +5 -0
- package/dist/runtime/locations/actor-location-claims.d.ts +1 -1
- package/dist/runtime/locations/actor-location-claims.js +15 -6
- package/dist/runtime/locations/auto-connect-loop.d.ts +0 -1
- package/dist/runtime/locations/auto-connect-loop.js +25 -19
- package/dist/runtime/locations/auto-connect-planner.js +2 -5
- package/dist/runtime/locations/auto-connect-reconciler.d.ts +1 -0
- package/dist/runtime/locations/auto-connect-reconciler.js +35 -23
- package/dist/runtime/locations/in-memory-authority-store.d.ts +1 -0
- package/dist/runtime/locations/in-memory-authority-store.js +15 -5
- package/dist/runtime/locations/in-memory-location-store.d.ts +0 -2
- package/dist/runtime/locations/in-memory-location-store.js +1 -38
- package/dist/runtime/locations/lifecycle.d.ts +1 -1
- package/dist/runtime/locations/lifecycle.js +2 -2
- package/dist/runtime/locations/location-store-repository.d.ts +0 -1
- package/dist/runtime/locations/location-store-repository.js +163 -246
- package/dist/runtime/locations/resolvers.d.ts +8 -1
- package/dist/runtime/locations/resolvers.js +16 -2
- package/dist/runtime/locations/runtime.d.ts +3 -3
- package/dist/runtime/locations/runtime.js +12 -16
- package/dist/runtime/messaging/creation-payload-codec.js +8 -7
- package/dist/runtime/messaging/framework-json-v1.d.ts +1 -1
- package/dist/runtime/messaging/framework-json-v1.js +6 -2
- package/dist/runtime/messaging/payload-codec.js +21 -35
- package/dist/runtime/messaging/request-deadline.d.ts +4 -2
- package/dist/runtime/messaging/request-deadline.js +40 -25
- package/dist/runtime/messaging/request-result.d.ts +14 -1
- package/dist/runtime/messaging/request-result.js +74 -13
- package/dist/runtime/protocol/service_wire_codec.generated.d.ts +4 -0
- package/dist/runtime/protocol/service_wire_codec.generated.js +17 -7
- package/dist/runtime/spots/index.d.ts +28 -7
- package/dist/runtime/spots/index.js +31 -6
- package/dist/runtime/spots/spot-activation-registry.d.ts +3 -2
- package/dist/runtime/spots/spot-activation-registry.js +13 -8
- package/dist/runtime/spots/spot-activation-state.d.ts +2 -0
- package/dist/runtime/spots/spot-activation-state.js +1 -0
- package/dist/runtime/spots/spot-actor-admission-coordinator.d.ts +9 -4
- package/dist/runtime/spots/spot-actor-admission-coordinator.js +33 -12
- package/dist/runtime/spots/spot-actor-ingress-admission.d.ts +40 -0
- package/dist/runtime/spots/spot-actor-ingress-admission.js +78 -0
- package/dist/runtime/spots/spot-actor-membership.js +3 -3
- package/dist/runtime/spots/spot-actor-packet-dispatch.d.ts +16 -43
- package/dist/runtime/spots/spot-actor-packet-dispatch.js +56 -113
- package/dist/runtime/spots/spot-actor-packet-drain.d.ts +1 -0
- package/dist/runtime/spots/spot-actor-packet-drain.js +12 -5
- package/dist/runtime/spots/spot-entry-activation.d.ts +4 -3
- package/dist/runtime/spots/spot-entry-activation.js +7 -12
- package/dist/runtime/spots/spot-handler-registry.d.ts +5 -1
- package/dist/runtime/spots/spot-handler-registry.js +31 -15
- package/dist/runtime/spots/spot-manager-public.js +3 -2
- package/dist/runtime/spots/spot-node-runtime-manager.d.ts +11 -6
- package/dist/runtime/spots/spot-node-runtime-manager.js +6 -1
- package/dist/runtime/spots/spot-outbound.d.ts +8 -2
- package/dist/runtime/spots/spot-outbound.js +5 -5
- package/dist/runtime/spots/spot-route-packet-dispatch.js +13 -8
- package/dist/runtime/spots/spot-routed-spot-packet-dispatch.d.ts +3 -3
- package/dist/runtime/spots/spot-routed-spot-packet-dispatch.js +9 -5
- package/dist/runtime/spots/spot-runtime-ports.d.ts +2 -2
- package/dist/runtime/spots/spot-serial-executor.d.ts +2 -1
- package/dist/runtime/spots/spot-serial-turn-executor.js +20 -26
- package/dist/runtime/spots/spot-subscription-dispatch.js +5 -2
- package/dist/runtime/spots/spot-timer.d.ts +1 -1
- package/dist/runtime/streams/actor-session-binding-registry.d.ts +11 -3
- package/dist/runtime/streams/actor-session-binding-registry.js +28 -0
- package/dist/runtime/streams/bound-actor-relay-sender.d.ts +2 -2
- package/dist/runtime/streams/bound-actor-relay-sender.js +3 -4
- package/dist/runtime/streams/bound-session-service.js +6 -7
- package/dist/runtime/streams/index.d.ts +3 -3
- package/dist/runtime/streams/index.js +22 -2
- package/dist/runtime/streams/managed-stream.js +2 -1
- package/dist/runtime/streams/session-calls.d.ts +1 -1
- package/dist/runtime/streams/session-calls.js +3 -9
- package/dist/runtime/streams/session-context.d.ts +2 -2
- package/dist/runtime/streams/session-context.js +2 -2
- package/dist/runtime/streams/stream-session-runtime.d.ts +1 -0
- package/dist/runtime/streams/stream-session-runtime.js +64 -33
- package/package.json +3 -3
- package/src/contracts/Actors/ZLinkActor.ts +6 -0
- package/src/contracts/Actors/ZLinkSessionBindingIdentity.ts +7 -0
- package/src/contracts/Actors/index.ts +1 -0
- package/src/contracts/Common/CoreTypes.ts +1 -0
- package/src/contracts/Common/HandlerMessageType.ts +50 -0
- package/src/contracts/Common/ZLinkEncodedPayload.ts +13 -25
- package/src/contracts/Common/ZLinkMessage.ts +11 -7
- package/src/contracts/Common/encoded-payload-storage.ts +4 -16
- package/src/contracts/Common/index.ts +1 -1
- package/src/contracts/Common/payload-slab.ts +29 -0
- package/src/contracts/Configuration/RegistrationBuilders.ts +29 -15
- package/src/contracts/Configuration/RegistrationTypes.ts +19 -0
- package/src/contracts/Handlers/Contexts.ts +1 -0
- package/src/contracts/Locations/Authority.ts +7 -1
- package/src/internal.ts +17 -0
- package/src/nest-integration.ts +1 -0
- package/src/runtime/actors/actor-client.ts +257 -163
- package/src/runtime/actors/actor-context.ts +26 -14
- package/src/runtime/actors/actor-execution-context.ts +2 -2
- package/src/runtime/actors/actor-handoff.ts +86 -51
- package/src/runtime/actors/actor-join-deferred-scope.ts +6 -6
- package/src/runtime/actors/actor-local-native-join.ts +38 -17
- package/src/runtime/actors/actor-mailbox.ts +1 -1
- package/src/runtime/actors/actor-remote-joiner.ts +8 -4
- package/src/runtime/actors/actor-routed-join-transport.ts +13 -5
- package/src/runtime/actors/actor-routed-json-request.ts +3 -0
- package/src/runtime/actors/actor-runtime-contracts.ts +4 -2
- package/src/runtime/actors/actor-runtime-state.ts +1 -1
- package/src/runtime/actors/spot-actor-dispatch.ts +70 -68
- package/src/runtime/admission.ts +42 -15
- package/src/runtime/application-jobs/application-ingress-record-owner.ts +4 -0
- package/src/runtime/backend/contracts/index.ts +77 -10
- package/src/runtime/backend/mesh-completion-table.ts +106 -15
- package/src/runtime/backend/mesh-dispatch-pump.ts +294 -146
- package/src/runtime/backend/node/node-backend-adapter-support.ts +42 -32
- package/src/runtime/backend/node/node-dealer-channel-client-transport.ts +91 -34
- package/src/runtime/backend/node/node-event-loop-poller.ts +14 -5
- package/src/runtime/backend/node/node-mesh-backend-adapter.ts +5 -1
- package/src/runtime/backend/node/node-raw-binding-port.ts +180 -69
- package/src/runtime/backend/node/node-raw-mesh-backend.ts +386 -157
- package/src/runtime/backend/node/node-socket-backend-adapter.ts +56 -11
- package/src/runtime/backend/raw-binding-port.ts +13 -5
- package/src/runtime/channels/channel-clients.ts +26 -11
- package/src/runtime/channels/channel-dispatch-pipeline.ts +77 -65
- package/src/runtime/channels/channel-dispatch-services.ts +7 -12
- package/src/runtime/channels/channel-dispatchers.ts +93 -39
- package/src/runtime/channels/channel-envelope.ts +680 -144
- package/src/runtime/channels/channel-multipart.ts +17 -13
- package/src/runtime/channels/channel-outbound-operations.ts +204 -178
- package/src/runtime/channels/channel-receive-loops.ts +160 -107
- package/src/runtime/channels/channel-runtime-lifecycle.ts +64 -59
- package/src/runtime/channels/channel-runtime-manager.ts +74 -27
- package/src/runtime/channels/channel-socket-registry.ts +20 -5
- package/src/runtime/channels/channel-transports.ts +414 -287
- package/src/runtime/channels/dispatch-error-reporter.ts +4 -9
- package/src/runtime/channels/local-spot-route-transport.ts +27 -29
- package/src/runtime/channels/router-socket-spot-route-transport.ts +63 -32
- package/src/runtime/channels/source-spot-router.ts +75 -38
- package/src/runtime/channels/spot-node-route-transport.ts +67 -37
- package/src/runtime/channels/spot-route-bridge-transport.ts +62 -30
- package/src/runtime/channels/spot-route-dispatch-strategy.ts +105 -34
- package/src/runtime/diagnostics/dispatch-error-details.ts +10 -2
- package/src/runtime/diagnostics/message-flow-bootstrap.ts +6 -0
- package/src/runtime/diagnostics/message-flow-delivery.ts +171 -0
- package/src/runtime/diagnostics/message-flow-record.ts +295 -0
- package/src/runtime/diagnostics/message-flow-worker.ts +146 -0
- package/src/runtime/diagnostics/message-flow.ts +49 -362
- package/src/runtime/diagnostics/runtime-metrics.ts +10 -4
- package/src/runtime/execution/index.ts +6 -0
- package/src/runtime/execution/serial-execution-queue.ts +94 -96
- package/src/runtime/foundation/durable-service-request.ts +212 -89
- package/src/runtime/foundation/operation-registry.ts +287 -38
- package/src/runtime/foundation/raw-service-mesh-runtime.ts +617 -292
- package/src/runtime/foundation/request-runtime.ts +227 -0
- package/src/runtime/foundation/service-discovery-registry.ts +7 -0
- package/src/runtime/foundation/service-liveness-registry.ts +1 -1
- package/src/runtime/foundation/service-mailbox.ts +7 -2
- package/src/runtime/foundation/service-relocation-object-owner.ts +21 -6
- package/src/runtime/foundation/service-runtime-contracts.ts +12 -2
- package/src/runtime/foundation/service-stateful-registry.ts +52 -19
- package/src/runtime/foundation/service-stateful-runtime.ts +365 -198
- package/src/runtime/foundation/service-stateful-wire-codec.ts +18 -0
- package/src/runtime/foundation/service-topology-registry.ts +21 -3
- package/src/runtime/foundation/service-wire-constants.generated.ts +10 -0
- package/src/runtime/foundation/service-wire-m6a-codec.ts +69 -17
- package/src/runtime/host/actor-packet-relay.ts +160 -156
- package/src/runtime/host/actor-placement-coordinator.ts +1 -1
- package/src/runtime/host/actor-runtime-options-factory.ts +7 -2
- package/src/runtime/host/actor-transfer-runtime.ts +3 -3
- package/src/runtime/host/application-job-queue.ts +56 -27
- package/src/runtime/host/bound-session-relay.ts +0 -1
- package/src/runtime/host/channel-runtime-options-factory.ts +3 -0
- package/src/runtime/host/entry-actor-runtime.ts +14 -6
- package/src/runtime/host/index.ts +388 -113
- package/src/runtime/host/location-runtime-owner.ts +3 -3
- package/src/runtime/host/service-relocation-host-runtime.ts +380 -252
- package/src/runtime/host/spot-address-transport.ts +110 -95
- package/src/runtime/host/spot-runtime-options-factory.ts +3 -0
- package/src/runtime/host/user-spot-creation-coordinator.ts +69 -22
- package/src/runtime/internal-observation.ts +2 -0
- package/src/runtime/locations/actor-location-claims.ts +42 -16
- package/src/runtime/locations/auto-connect-loop.ts +24 -16
- package/src/runtime/locations/auto-connect-planner.ts +2 -5
- package/src/runtime/locations/auto-connect-reconciler.ts +37 -24
- package/src/runtime/locations/in-memory-authority-store.ts +27 -7
- package/src/runtime/locations/in-memory-location-store.ts +1 -74
- package/src/runtime/locations/lifecycle.ts +4 -2
- package/src/runtime/locations/location-store-repository.ts +228 -308
- package/src/runtime/locations/resolvers.ts +20 -8
- package/src/runtime/locations/runtime.ts +16 -28
- package/src/runtime/messaging/creation-payload-codec.ts +12 -10
- package/src/runtime/messaging/framework-json-v1.ts +10 -1
- package/src/runtime/messaging/payload-codec.ts +50 -75
- package/src/runtime/messaging/request-deadline.ts +47 -39
- package/src/runtime/messaging/request-result.ts +88 -17
- package/src/runtime/protocol/service_wire_codec.generated.ts +18 -8
- package/src/runtime/protocol/service_wire_pilot_codec.generated.ts +1 -1
- package/src/runtime/spots/index.ts +57 -10
- package/src/runtime/spots/spot-activation-registry.ts +12 -8
- package/src/runtime/spots/spot-activation-state.ts +2 -0
- package/src/runtime/spots/spot-actor-admission-coordinator.ts +62 -37
- package/src/runtime/spots/spot-actor-ingress-admission.ts +157 -0
- package/src/runtime/spots/spot-actor-membership.ts +8 -5
- package/src/runtime/spots/spot-actor-packet-dispatch.ts +122 -206
- package/src/runtime/spots/spot-actor-packet-drain.ts +21 -6
- package/src/runtime/spots/spot-entry-activation.ts +25 -35
- package/src/runtime/spots/spot-handler-registry.ts +72 -15
- package/src/runtime/spots/spot-manager-public.ts +4 -2
- package/src/runtime/spots/spot-node-runtime-manager.ts +16 -7
- package/src/runtime/spots/spot-outbound.ts +26 -10
- package/src/runtime/spots/spot-route-packet-dispatch.ts +18 -8
- package/src/runtime/spots/spot-routed-spot-packet-dispatch.ts +14 -8
- package/src/runtime/spots/spot-runtime-ports.ts +5 -2
- package/src/runtime/spots/spot-serial-executor.ts +1 -1
- package/src/runtime/spots/spot-serial-turn-executor.ts +25 -40
- package/src/runtime/spots/spot-subscription-dispatch.ts +9 -2
- package/src/runtime/spots/spot-timer.ts +1 -1
- package/src/runtime/streams/actor-session-binding-registry.ts +46 -3
- package/src/runtime/streams/bound-actor-relay-sender.ts +16 -5
- package/src/runtime/streams/bound-session-service.ts +10 -7
- package/src/runtime/streams/index.ts +30 -4
- package/src/runtime/streams/managed-stream.ts +2 -1
- package/src/runtime/streams/session-calls.ts +9 -14
- package/src/runtime/streams/session-context.ts +6 -11
- package/src/runtime/streams/stream-session-runtime.ts +79 -40
- package/dist/runtime/spots/spot-lifecycle-metrics.d.ts +0 -8
- package/dist/runtime/spots/spot-lifecycle-metrics.js +0 -17
- package/src/runtime/spots/spot-lifecycle-metrics.ts +0 -16
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ZLinkHandlerMessageType } from '../../contracts/Common/HandlerMessageType';
|
|
1
2
|
import { ZlinkStreamContentType } from '@zlink-systems/stream-wire';
|
|
2
3
|
import {
|
|
3
4
|
type Type,
|
|
@@ -14,6 +15,10 @@ import {
|
|
|
14
15
|
} from '../../contracts';
|
|
15
16
|
|
|
16
17
|
import type { Message } from '../../contracts/Common/Message';
|
|
18
|
+
import {
|
|
19
|
+
resolveHandlerMessageType,
|
|
20
|
+
resolveMessageTypeForDecode
|
|
21
|
+
} from '../../contracts/Common/HandlerMessageType';
|
|
17
22
|
import type { ZLinkProviderResolver } from '../../contracts/Common/ZLinkProviderResolver';
|
|
18
23
|
import { readZLinkDecoratorMetadata } from '../../contracts/Handlers/Attributes';
|
|
19
24
|
import { ZLinkConfigurationException } from '../configuration';
|
|
@@ -37,11 +42,15 @@ export interface ZLinkActorPacketDescriptor {
|
|
|
37
42
|
readonly packetName: string;
|
|
38
43
|
readonly actorType: Type<ZLinkActor>;
|
|
39
44
|
readonly handlerType: Type;
|
|
45
|
+
readonly messageType?: ZLinkHandlerMessageType;
|
|
40
46
|
readonly methodName?: string;
|
|
41
47
|
}
|
|
42
48
|
|
|
43
49
|
export class ZLinkSpotActorHandlerRegistryRuntime implements ZLinkActorHandlerRegistry {
|
|
44
|
-
private readonly packets = new Map<
|
|
50
|
+
private readonly packets = new Map<
|
|
51
|
+
ZLinkActorPacketKind,
|
|
52
|
+
Map<string, Map<string, ZLinkActorPacketDescriptor>>
|
|
53
|
+
>();
|
|
45
54
|
|
|
46
55
|
addHandler<THandler>(handlerType: Type<THandler>, packetName?: string): this {
|
|
47
56
|
const metadata = readZLinkDecoratorMetadata(handlerType).find(
|
|
@@ -54,6 +63,7 @@ export class ZLinkSpotActorHandlerRegistryRuntime implements ZLinkActorHandlerRe
|
|
|
54
63
|
`Actor packet handler '${handlerType.name}' must declare a packet name.`
|
|
55
64
|
);
|
|
56
65
|
}
|
|
66
|
+
const messageType = resolveHandlerMessageType(handlerType);
|
|
57
67
|
return this.addPacket({
|
|
58
68
|
kind:
|
|
59
69
|
metadata.kind === 'spotActorSend'
|
|
@@ -62,13 +72,16 @@ export class ZLinkSpotActorHandlerRegistryRuntime implements ZLinkActorHandlerRe
|
|
|
62
72
|
packetName: resolvedPacketName,
|
|
63
73
|
actorType: Object as unknown as Type<ZLinkActor>,
|
|
64
74
|
handlerType,
|
|
75
|
+
...(messageType === undefined ? {} : { messageType }),
|
|
65
76
|
methodName: metadata.methodName
|
|
66
77
|
});
|
|
67
78
|
}
|
|
68
79
|
|
|
69
80
|
addPacket(descriptor: ZLinkActorPacketDescriptor): this {
|
|
70
|
-
const
|
|
71
|
-
|
|
81
|
+
const actorTypeName = descriptor.actorType.name;
|
|
82
|
+
let packets = this.packets.get(descriptor.kind);
|
|
83
|
+
let actors = packets?.get(descriptor.packetName);
|
|
84
|
+
if (actors?.has(actorTypeName) === true) {
|
|
72
85
|
throw createInternalFrameworkException(
|
|
73
86
|
ZLinkFrameworkInternalErrorKind.InvalidOperation,
|
|
74
87
|
`Actor packet '${descriptor.packetName}' for '${descriptor.actorType.name}' is already registered.`
|
|
@@ -80,7 +93,15 @@ export class ZLinkSpotActorHandlerRegistryRuntime implements ZLinkActorHandlerRe
|
|
|
80
93
|
(descriptor.kind === ZLinkActorPacketKind.Send ? 'spotActorSend' : 'spotActorRequest') &&
|
|
81
94
|
entry.packetName === descriptor.packetName
|
|
82
95
|
);
|
|
83
|
-
|
|
96
|
+
if (packets === undefined) {
|
|
97
|
+
packets = new Map();
|
|
98
|
+
this.packets.set(descriptor.kind, packets);
|
|
99
|
+
}
|
|
100
|
+
if (actors === undefined) {
|
|
101
|
+
actors = new Map();
|
|
102
|
+
packets.set(descriptor.packetName, actors);
|
|
103
|
+
}
|
|
104
|
+
actors.set(actorTypeName, {
|
|
84
105
|
...descriptor,
|
|
85
106
|
methodName: descriptor.methodName ?? metadata?.methodName
|
|
86
107
|
});
|
|
@@ -92,24 +113,20 @@ export class ZLinkSpotActorHandlerRegistryRuntime implements ZLinkActorHandlerRe
|
|
|
92
113
|
actor: ZLinkActor,
|
|
93
114
|
packetName: string
|
|
94
115
|
): ZLinkActorPacketDescriptor | undefined {
|
|
116
|
+
const actors = this.packets.get(kind)?.get(packetName);
|
|
117
|
+
if (actors === undefined) return undefined;
|
|
95
118
|
const actorType = actor.constructor as Type<ZLinkActor>;
|
|
96
|
-
const exact =
|
|
119
|
+
const exact = actors.get(actorType.name);
|
|
97
120
|
if (exact !== undefined) {
|
|
98
121
|
return exact;
|
|
99
122
|
}
|
|
100
|
-
const wildcard =
|
|
101
|
-
packetKey(kind, Object as unknown as Type<ZLinkActor>, packetName)
|
|
102
|
-
);
|
|
123
|
+
const wildcard = actors.get(Object.name);
|
|
103
124
|
if (wildcard !== undefined) {
|
|
104
125
|
return wildcard;
|
|
105
126
|
}
|
|
106
127
|
|
|
107
|
-
for (const descriptor of
|
|
108
|
-
if (
|
|
109
|
-
descriptor.kind === kind &&
|
|
110
|
-
descriptor.packetName === packetName &&
|
|
111
|
-
actor instanceof descriptor.actorType
|
|
112
|
-
) {
|
|
128
|
+
for (const descriptor of actors.values()) {
|
|
129
|
+
if (actor instanceof descriptor.actorType) {
|
|
113
130
|
return descriptor;
|
|
114
131
|
}
|
|
115
132
|
}
|
|
@@ -142,7 +159,7 @@ export class ZLinkSpotActorDispatcher {
|
|
|
142
159
|
actor: ZLinkActor,
|
|
143
160
|
packetName: string,
|
|
144
161
|
message: TMessage,
|
|
145
|
-
context
|
|
162
|
+
context?: Partial<ZLinkMessageContext>
|
|
146
163
|
): Promise<void> {
|
|
147
164
|
return this.dispatchSendDecoded(actor, packetName, () => message, context);
|
|
148
165
|
}
|
|
@@ -150,26 +167,22 @@ export class ZLinkSpotActorDispatcher {
|
|
|
150
167
|
dispatchSendDecoded<TMessage>(
|
|
151
168
|
actor: ZLinkActor,
|
|
152
169
|
packetName: string,
|
|
153
|
-
decode: () => TMessage,
|
|
154
|
-
context
|
|
170
|
+
decode: (messageType?: Type) => TMessage,
|
|
171
|
+
context?: Partial<ZLinkMessageContext>
|
|
155
172
|
): Promise<void> {
|
|
156
173
|
return this.execute(async () => {
|
|
157
174
|
const descriptor = this.requirePacket(ZLinkActorPacketKind.Send, actor, packetName);
|
|
158
|
-
const message = decode();
|
|
159
|
-
this.options.onHandlerStart?.();
|
|
175
|
+
const message = decode(resolveMessageTypeForDecode(descriptor.messageType));
|
|
160
176
|
await this.invokeHandler<ZLinkSpotActorSendHandler<ZLinkSpot, ZLinkActor, TMessage>, void>(
|
|
161
177
|
actor,
|
|
162
178
|
descriptor,
|
|
163
|
-
(handler, method) =>
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
message
|
|
171
|
-
)
|
|
172
|
-
)
|
|
179
|
+
(handler, method) => {
|
|
180
|
+
const handlerContext = this.createContext(packetName, context);
|
|
181
|
+
return runActorHandlerWithDeferredJoins(() => {
|
|
182
|
+
this.options.onHandlerStart?.();
|
|
183
|
+
return method.call(handler, this.options.spot, actor, handlerContext, message);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
173
186
|
);
|
|
174
187
|
});
|
|
175
188
|
}
|
|
@@ -178,7 +191,7 @@ export class ZLinkSpotActorDispatcher {
|
|
|
178
191
|
actor: ZLinkActor,
|
|
179
192
|
packetName: string,
|
|
180
193
|
request: TRequest,
|
|
181
|
-
context
|
|
194
|
+
context?: Partial<ZLinkMessageContext>
|
|
182
195
|
): Promise<TReply> {
|
|
183
196
|
return this.dispatchRequestThenDecoded<TRequest, TReply, TReply>(
|
|
184
197
|
actor,
|
|
@@ -192,8 +205,8 @@ export class ZLinkSpotActorDispatcher {
|
|
|
192
205
|
dispatchRequestDecoded<TRequest, TReply>(
|
|
193
206
|
actor: ZLinkActor,
|
|
194
207
|
packetName: string,
|
|
195
|
-
decode: () => TRequest,
|
|
196
|
-
context
|
|
208
|
+
decode: (messageType?: Type) => TRequest,
|
|
209
|
+
context?: Partial<ZLinkMessageContext>
|
|
197
210
|
): Promise<TReply> {
|
|
198
211
|
return this.dispatchRequestThenDecoded<TRequest, TReply, TReply>(
|
|
199
212
|
actor,
|
|
@@ -208,7 +221,7 @@ export class ZLinkSpotActorDispatcher {
|
|
|
208
221
|
actor: ZLinkActor,
|
|
209
222
|
packetName: string,
|
|
210
223
|
request: TRequest,
|
|
211
|
-
context: Partial<ZLinkMessageContext>
|
|
224
|
+
context: Partial<ZLinkMessageContext> | undefined,
|
|
212
225
|
afterReply: (
|
|
213
226
|
reply: TReply,
|
|
214
227
|
options: ZLinkSpotActorReplyOptionsSnapshot
|
|
@@ -231,8 +244,8 @@ export class ZLinkSpotActorDispatcher {
|
|
|
231
244
|
dispatchRequestThenDecoded<TRequest, TReply, TResult>(
|
|
232
245
|
actor: ZLinkActor,
|
|
233
246
|
packetName: string,
|
|
234
|
-
decode: () => TRequest,
|
|
235
|
-
context: Partial<ZLinkMessageContext>
|
|
247
|
+
decode: (messageType?: Type) => TRequest,
|
|
248
|
+
context: Partial<ZLinkMessageContext> | undefined,
|
|
236
249
|
afterReply: (
|
|
237
250
|
reply: TReply,
|
|
238
251
|
options: ZLinkSpotActorReplyOptionsSnapshot
|
|
@@ -244,35 +257,31 @@ export class ZLinkSpotActorDispatcher {
|
|
|
244
257
|
): Promise<TResult> {
|
|
245
258
|
return this.execute(async () => {
|
|
246
259
|
const descriptor = this.requirePacket(ZLinkActorPacketKind.Request, actor, packetName);
|
|
247
|
-
const request = decode();
|
|
248
|
-
this.options.onHandlerStart?.();
|
|
260
|
+
const request = decode(resolveMessageTypeForDecode(descriptor.messageType));
|
|
249
261
|
return await this.invokeHandler<
|
|
250
262
|
ZLinkSpotActorRequestHandler<ZLinkSpot, ZLinkActor, TRequest, TReply>,
|
|
251
263
|
TResult
|
|
252
|
-
>(actor, descriptor, (handler, method) =>
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
this.createContext(packetName, context),
|
|
260
|
-
request
|
|
261
|
-
),
|
|
264
|
+
>(actor, descriptor, (handler, method) => {
|
|
265
|
+
const handlerContext = this.createContext(packetName, context);
|
|
266
|
+
return runActorHandlerWithDeferredJoins(
|
|
267
|
+
() => {
|
|
268
|
+
this.options.onHandlerStart?.();
|
|
269
|
+
return method.call(handler, this.options.spot, actor, handlerContext, request);
|
|
270
|
+
},
|
|
262
271
|
(reply) =>
|
|
263
272
|
afterReply(reply, {
|
|
264
|
-
metadata:
|
|
273
|
+
metadata: ZLinkMessageMetadataEmpty.values,
|
|
265
274
|
compressPayload: false
|
|
266
275
|
}),
|
|
267
276
|
beforeReply === undefined
|
|
268
277
|
? undefined
|
|
269
278
|
: (reply) =>
|
|
270
279
|
beforeReply(reply, {
|
|
271
|
-
metadata:
|
|
280
|
+
metadata: ZLinkMessageMetadataEmpty.values,
|
|
272
281
|
compressPayload: false
|
|
273
282
|
})
|
|
274
|
-
)
|
|
275
|
-
);
|
|
283
|
+
);
|
|
284
|
+
});
|
|
276
285
|
});
|
|
277
286
|
}
|
|
278
287
|
|
|
@@ -353,7 +362,7 @@ export class ZLinkSpotActorDispatcher {
|
|
|
353
362
|
);
|
|
354
363
|
}
|
|
355
364
|
|
|
356
|
-
|
|
365
|
+
invokeHandler<THandler, TResult>(
|
|
357
366
|
actor: ZLinkActor,
|
|
358
367
|
descriptor: Pick<ZLinkActorPacketDescriptor, 'handlerType' | 'methodName'>,
|
|
359
368
|
callback: (
|
|
@@ -361,7 +370,7 @@ export class ZLinkSpotActorDispatcher {
|
|
|
361
370
|
method: THandler extends { handle: infer TMethod } ? TMethod : never
|
|
362
371
|
) => Promise<TResult>
|
|
363
372
|
): Promise<TResult> {
|
|
364
|
-
return
|
|
373
|
+
return runWithLifecycleHandler(
|
|
365
374
|
actor,
|
|
366
375
|
descriptor.handlerType,
|
|
367
376
|
this.options.providerResolver,
|
|
@@ -389,29 +398,22 @@ export class ZLinkSpotActorDispatcher {
|
|
|
389
398
|
return pending;
|
|
390
399
|
}
|
|
391
400
|
|
|
392
|
-
|
|
401
|
+
createContext(
|
|
393
402
|
packetName: string,
|
|
394
|
-
context: Partial<ZLinkMessageContext>
|
|
403
|
+
context: Partial<ZLinkMessageContext> | undefined
|
|
395
404
|
): ZLinkMessageContext {
|
|
396
405
|
return {
|
|
397
|
-
meshName: context
|
|
398
|
-
channelName: context
|
|
406
|
+
meshName: context?.meshName,
|
|
407
|
+
channelName: context?.channelName,
|
|
399
408
|
packetName,
|
|
400
|
-
contentType: context
|
|
401
|
-
metadata: context
|
|
402
|
-
correlationId: context
|
|
409
|
+
contentType: context?.contentType,
|
|
410
|
+
metadata: context?.metadata ?? ZLinkMessageMetadataEmpty,
|
|
411
|
+
correlationId: context?.correlationId,
|
|
412
|
+
receivedAt: context?.receivedAt ?? new Date()
|
|
403
413
|
};
|
|
404
414
|
}
|
|
405
415
|
}
|
|
406
416
|
|
|
407
|
-
function packetKey(
|
|
408
|
-
kind: ZLinkActorPacketKind,
|
|
409
|
-
actorType: Type<ZLinkActor>,
|
|
410
|
-
packetName: string
|
|
411
|
-
): string {
|
|
412
|
-
return `${kind}:${actorType.name}:${packetName}`;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
417
|
function actorDispatchHandlerNotFound(message: string): ZLinkFrameworkException {
|
|
416
418
|
return createInternalFrameworkException(
|
|
417
419
|
ZLinkFrameworkInternalErrorKind.ActorDispatchHandlerNotFound,
|
package/src/runtime/admission.ts
CHANGED
|
@@ -3,12 +3,15 @@ import {
|
|
|
3
3
|
createInternalFrameworkException
|
|
4
4
|
} from './framework-errors-internal';
|
|
5
5
|
import { isPromiseLike } from './abort';
|
|
6
|
+
import { ReceiveKind, type ReceiveRecord } from './foundation/service-runtime-contracts';
|
|
6
7
|
const BACKING_ARRAY_COMPACTION_MIN_HEAD = 1024;
|
|
7
8
|
|
|
8
9
|
/** Runs host admission inside the domain's request completion boundary. */
|
|
9
|
-
export type ZLinkMeshDispatchAdmission = (
|
|
10
|
-
dispatch: () => void | Promise<void>,
|
|
11
|
-
onRejected?: (error: unknown) => void | Promise<void
|
|
10
|
+
export type ZLinkMeshDispatchAdmission = <TReceiver = void, TContext = void>(
|
|
11
|
+
dispatch: (this: TReceiver, context: TContext) => void | Promise<void>,
|
|
12
|
+
onRejected?: (this: TReceiver, error: unknown, context: TContext) => void | Promise<void>,
|
|
13
|
+
receiver?: TReceiver,
|
|
14
|
+
context?: TContext
|
|
12
15
|
) => void | Promise<void>;
|
|
13
16
|
|
|
14
17
|
/** 소비한 배열 prefix가 정리 조건에 도달했는지 판정합니다. */
|
|
@@ -46,8 +49,8 @@ export class ZLinkRuntimeAdmissionGate {
|
|
|
46
49
|
}
|
|
47
50
|
}
|
|
48
51
|
|
|
49
|
-
accepts(meshName: string): boolean {
|
|
50
|
-
return this.
|
|
52
|
+
accepts(meshName: string, kind?: ReceiveRecord['kind']): boolean {
|
|
53
|
+
return this.isOpen(this.requireState(meshName), kind);
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
pending(meshName: string): number {
|
|
@@ -70,8 +73,12 @@ export class ZLinkRuntimeAdmissionGate {
|
|
|
70
73
|
}
|
|
71
74
|
}
|
|
72
75
|
|
|
73
|
-
claim(
|
|
74
|
-
|
|
76
|
+
claim(
|
|
77
|
+
meshName: string,
|
|
78
|
+
operation: string,
|
|
79
|
+
kind?: ReceiveRecord['kind']
|
|
80
|
+
): ZLinkApplicationWorkClaim {
|
|
81
|
+
const state = this.enter(meshName, operation, kind);
|
|
75
82
|
let closed = false;
|
|
76
83
|
return {
|
|
77
84
|
close: () => {
|
|
@@ -87,22 +94,27 @@ export class ZLinkRuntimeAdmissionGate {
|
|
|
87
94
|
* admission in the same turn; asynchronous work leaves it from the single
|
|
88
95
|
* continuation on its result.
|
|
89
96
|
*/
|
|
90
|
-
run<T>(
|
|
97
|
+
run<T, TReceiver = void, TContext = void>(
|
|
91
98
|
meshName: string,
|
|
92
99
|
operation: string,
|
|
93
|
-
work: () => T | Promise<T>,
|
|
94
|
-
|
|
100
|
+
work: (this: TReceiver, context: TContext) => T | Promise<T>,
|
|
101
|
+
kind?: ReceiveRecord['kind'],
|
|
102
|
+
onRejected?: (this: TReceiver, error: unknown, context: TContext) => T | Promise<T>,
|
|
103
|
+
receiver?: TReceiver,
|
|
104
|
+
context?: TContext
|
|
95
105
|
): T | Promise<T> {
|
|
96
106
|
let state: ZLinkMeshAdmissionState;
|
|
97
107
|
let result: T | Promise<T>;
|
|
98
108
|
try {
|
|
99
|
-
state = this.enter(meshName, operation);
|
|
109
|
+
state = this.enter(meshName, operation, kind);
|
|
100
110
|
} catch (error) {
|
|
101
111
|
// The domain owns admission rejection completion, just as it owns handler failure.
|
|
102
|
-
return onRejected === undefined
|
|
112
|
+
return onRejected === undefined
|
|
113
|
+
? Promise.reject(error)
|
|
114
|
+
: onRejected.call(receiver as TReceiver, error, context as TContext);
|
|
103
115
|
}
|
|
104
116
|
try {
|
|
105
|
-
result = work();
|
|
117
|
+
result = work.call(receiver as TReceiver, context as TContext);
|
|
106
118
|
} catch (error) {
|
|
107
119
|
exitAdmission(state);
|
|
108
120
|
return Promise.reject(error);
|
|
@@ -123,9 +135,24 @@ export class ZLinkRuntimeAdmissionGate {
|
|
|
123
135
|
);
|
|
124
136
|
}
|
|
125
137
|
|
|
126
|
-
private
|
|
138
|
+
private isOpen(state: ZLinkMeshAdmissionState, kind?: ReceiveRecord['kind']): boolean {
|
|
139
|
+
return (
|
|
140
|
+
!state.sealed &&
|
|
141
|
+
(kind === ReceiveKind.NodeSend ||
|
|
142
|
+
kind === ReceiveKind.NodeRequest ||
|
|
143
|
+
kind === ReceiveKind.ChannelSend ||
|
|
144
|
+
kind === ReceiveKind.ChannelRequest ||
|
|
145
|
+
this.ownerAdmissionOpen())
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
private enter(
|
|
150
|
+
meshName: string,
|
|
151
|
+
operation: string,
|
|
152
|
+
kind?: ReceiveRecord['kind']
|
|
153
|
+
): ZLinkMeshAdmissionState {
|
|
127
154
|
const state = this.requireState(meshName);
|
|
128
|
-
if (this.
|
|
155
|
+
if (this.isOpen(state, kind)) {
|
|
129
156
|
state.active += 1;
|
|
130
157
|
return state;
|
|
131
158
|
}
|
|
@@ -105,6 +105,10 @@ export class ApplicationJobRecordLease implements ApplicationJobPermitPort {
|
|
|
105
105
|
private permit: ApplicationJobPermitPort | undefined
|
|
106
106
|
) {}
|
|
107
107
|
|
|
108
|
+
reacquire(signal: AbortSignal): Promise<ApplicationJobPermitPort> {
|
|
109
|
+
return this.shared.acquirePermit(signal);
|
|
110
|
+
}
|
|
111
|
+
|
|
108
112
|
get origin(): ApplicationJobOrigin {
|
|
109
113
|
return this.shared.origin;
|
|
110
114
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { PendingOperation } from '../../foundation/operation-registry';
|
|
2
|
+
import type { RequestRuntime } from '../../foundation/request-runtime';
|
|
1
3
|
import type {
|
|
2
4
|
RequestResult,
|
|
3
5
|
SubmitResult,
|
|
@@ -72,6 +74,7 @@ export type ZLinkBackendRequestSourceAcceptance = (
|
|
|
72
74
|
| Promise<import('../../locations/request-source-resolver').ZLinkRequestSourceFence | undefined>;
|
|
73
75
|
|
|
74
76
|
export interface ZLinkBackendMeshNode {
|
|
77
|
+
setRequestRuntime?(requests: RequestRuntime): void;
|
|
75
78
|
acceptRelocatedActorTerminal?(
|
|
76
79
|
operation: { readonly high: bigint; readonly low: bigint },
|
|
77
80
|
replyRouteId: bigint,
|
|
@@ -146,7 +149,8 @@ export interface ZLinkBackendMeshNode {
|
|
|
146
149
|
deadlineUnixMs: bigint,
|
|
147
150
|
sourceSpotId?: string,
|
|
148
151
|
metadata?: ReadonlyMap<string, string>,
|
|
149
|
-
onAdmitted?: () => void
|
|
152
|
+
onAdmitted?: () => void,
|
|
153
|
+
requestOperation?: PendingOperation<unknown>
|
|
150
154
|
): MeshOperationId;
|
|
151
155
|
sendToInstanceSpot(
|
|
152
156
|
route: ServiceInstanceRouteFence,
|
|
@@ -162,7 +166,9 @@ export interface ZLinkBackendMeshNode {
|
|
|
162
166
|
sourceSpotId?: string,
|
|
163
167
|
metadata?: ReadonlyMap<string, string>,
|
|
164
168
|
instanceIntent?: boolean,
|
|
165
|
-
onAdmitted?: () => void
|
|
169
|
+
onAdmitted?: () => void,
|
|
170
|
+
requestOperation?: PendingOperation<unknown>,
|
|
171
|
+
completion?: ZLinkMeshCompletionHandler
|
|
166
172
|
): MeshOperationId;
|
|
167
173
|
registerUserSpotOperationHandler(handler: ServiceUserSpotOperationHandler): void;
|
|
168
174
|
requestUserSpotCreate(
|
|
@@ -247,6 +253,7 @@ export interface ZLinkBackendMeshNode {
|
|
|
247
253
|
frames: readonly Uint8Array[],
|
|
248
254
|
options?: {
|
|
249
255
|
readonly timeoutMs?: number;
|
|
256
|
+
readonly requestOperation?: PendingOperation<unknown>;
|
|
250
257
|
readonly signal?: AbortSignal;
|
|
251
258
|
readonly onSubmitted?: (signal: AbortSignal) => Promise<void>;
|
|
252
259
|
}
|
|
@@ -257,9 +264,11 @@ export interface ZLinkBackendMeshNode {
|
|
|
257
264
|
options?: {
|
|
258
265
|
flags?: number;
|
|
259
266
|
timeoutMs?: number;
|
|
267
|
+
readonly requestOperation?: PendingOperation<unknown>;
|
|
260
268
|
applicationMetadata?: Buffer;
|
|
261
269
|
onAdmitted?: () => void;
|
|
262
|
-
}
|
|
270
|
+
},
|
|
271
|
+
completion?: import('../mesh-completion-table').ZLinkMeshCompletionHandler
|
|
263
272
|
): MeshOperationId;
|
|
264
273
|
sendToChannel(
|
|
265
274
|
channelName: string,
|
|
@@ -272,9 +281,11 @@ export interface ZLinkBackendMeshNode {
|
|
|
272
281
|
options?: {
|
|
273
282
|
flags?: number;
|
|
274
283
|
timeoutMs?: number;
|
|
284
|
+
readonly requestOperation?: PendingOperation<unknown>;
|
|
275
285
|
applicationMetadata?: Buffer;
|
|
276
286
|
onAdmitted?: () => void;
|
|
277
|
-
}
|
|
287
|
+
},
|
|
288
|
+
completion?: import('../mesh-completion-table').ZLinkMeshCompletionHandler
|
|
278
289
|
): MeshOperationId;
|
|
279
290
|
status(): MeshNodeStatus;
|
|
280
291
|
peers(): MeshPeerEntry[];
|
|
@@ -407,10 +418,12 @@ export interface ZLinkBackendMeshNode {
|
|
|
407
418
|
options?: {
|
|
408
419
|
flags?: number;
|
|
409
420
|
timeoutMs?: number;
|
|
421
|
+
readonly requestOperation?: PendingOperation<unknown>;
|
|
410
422
|
applicationMetadata?: Buffer;
|
|
411
423
|
onAdmitted?: () => void;
|
|
412
424
|
routeFence?: import('../../foundation/service-stateful-wire-codec').ServiceActorRouteFence;
|
|
413
|
-
}
|
|
425
|
+
},
|
|
426
|
+
completion?: ZLinkMeshCompletionHandler
|
|
414
427
|
): MeshOperationId;
|
|
415
428
|
actorSendToActor(
|
|
416
429
|
source: ZLinkBackendActorRef,
|
|
@@ -425,6 +438,7 @@ export interface ZLinkBackendMeshNode {
|
|
|
425
438
|
options?: {
|
|
426
439
|
flags?: number;
|
|
427
440
|
timeoutMs?: number;
|
|
441
|
+
readonly requestOperation?: PendingOperation<unknown>;
|
|
428
442
|
applicationMetadata?: Buffer;
|
|
429
443
|
onAdmitted?: () => void;
|
|
430
444
|
}
|
|
@@ -553,8 +567,16 @@ export interface ZLinkBackendDealerSocket extends ZLinkBackendConnectableSocket
|
|
|
553
567
|
request(
|
|
554
568
|
message: Message | readonly Message[],
|
|
555
569
|
timeoutMs?: number,
|
|
556
|
-
onAdmitted?: () => void
|
|
570
|
+
onAdmitted?: () => void,
|
|
571
|
+
requestOperation?: undefined
|
|
557
572
|
): Promise<readonly Message[]>;
|
|
573
|
+
request(
|
|
574
|
+
message: Message | readonly Message[],
|
|
575
|
+
timeoutMs: number | undefined,
|
|
576
|
+
onAdmitted: (() => void) | undefined,
|
|
577
|
+
requestOperation: PendingOperation<unknown>,
|
|
578
|
+
receiver: import('../../foundation/operation-registry').OperationObserver<unknown, unknown>
|
|
579
|
+
): void;
|
|
558
580
|
recv(flags?: ZLinkBackendRecvFlags): Received | undefined;
|
|
559
581
|
}
|
|
560
582
|
|
|
@@ -572,6 +594,11 @@ export interface ZLinkBackendRequestOperation {
|
|
|
572
594
|
message(message: MessageLike): ZLinkBackendRequestOperation;
|
|
573
595
|
timeout(timeoutMs: number): ZLinkBackendRequestOperation;
|
|
574
596
|
submit(onAdmitted?: () => void): Promise<readonly Message[]>;
|
|
597
|
+
submit(
|
|
598
|
+
onAdmitted: (() => void) | undefined,
|
|
599
|
+
requestOperation: PendingOperation<unknown>,
|
|
600
|
+
receiver: import('../../foundation/operation-registry').OperationObserver<unknown, unknown>
|
|
601
|
+
): void;
|
|
575
602
|
}
|
|
576
603
|
|
|
577
604
|
export interface ZLinkBackendRouterSocket extends ZLinkBackendConnectableSocket {
|
|
@@ -590,8 +617,17 @@ export interface ZLinkBackendRouterSocket extends ZLinkBackendConnectableSocket
|
|
|
590
617
|
routingId: RoutingId,
|
|
591
618
|
message: Message | readonly Message[],
|
|
592
619
|
timeoutMs?: number,
|
|
593
|
-
onAdmitted?: () => void
|
|
620
|
+
onAdmitted?: () => void,
|
|
621
|
+
requestOperation?: undefined
|
|
594
622
|
): Promise<readonly Message[]>;
|
|
623
|
+
request(
|
|
624
|
+
routingId: RoutingId,
|
|
625
|
+
message: Message | readonly Message[],
|
|
626
|
+
timeoutMs: number | undefined,
|
|
627
|
+
onAdmitted: (() => void) | undefined,
|
|
628
|
+
requestOperation: PendingOperation<unknown>,
|
|
629
|
+
receiver: import('../../foundation/operation-registry').OperationObserver<unknown, unknown>
|
|
630
|
+
): void;
|
|
595
631
|
sendToSpot(
|
|
596
632
|
targetNodeRid: RoutingId,
|
|
597
633
|
targetSpotId: RoutingId,
|
|
@@ -603,8 +639,18 @@ export interface ZLinkBackendRouterSocket extends ZLinkBackendConnectableSocket
|
|
|
603
639
|
targetSpotId: RoutingId,
|
|
604
640
|
parts: readonly Message[],
|
|
605
641
|
timeoutMs?: number,
|
|
606
|
-
onAdmitted?: () => void
|
|
642
|
+
onAdmitted?: () => void,
|
|
643
|
+
requestOperation?: undefined
|
|
607
644
|
): Promise<readonly Message[]>;
|
|
645
|
+
requestToSpot(
|
|
646
|
+
targetNodeRid: RoutingId,
|
|
647
|
+
targetSpotId: RoutingId,
|
|
648
|
+
parts: readonly Message[],
|
|
649
|
+
timeoutMs: number | undefined,
|
|
650
|
+
onAdmitted: (() => void) | undefined,
|
|
651
|
+
requestOperation: PendingOperation<unknown>,
|
|
652
|
+
receiver: import('../../foundation/operation-registry').OperationObserver<unknown, unknown>
|
|
653
|
+
): void;
|
|
608
654
|
disconnectPeer(routingId: RoutingId): void;
|
|
609
655
|
reply(routingId: RoutingId, replyToken: unknown): ZLinkBackendReplyOperation;
|
|
610
656
|
reply(routingId: RoutingId, replyToken: unknown, message: Message | readonly Message[]): void;
|
|
@@ -761,8 +807,17 @@ export interface ZLinkBackendSpot extends ZLinkBackendObject {
|
|
|
761
807
|
channelName: string,
|
|
762
808
|
payload: Message | readonly Message[],
|
|
763
809
|
timeoutMs?: number,
|
|
764
|
-
onAdmitted?: () => void
|
|
810
|
+
onAdmitted?: () => void,
|
|
811
|
+
requestOperation?: undefined
|
|
765
812
|
): Promise<readonly Message[]>;
|
|
813
|
+
requestToChannel(
|
|
814
|
+
channelName: string,
|
|
815
|
+
payload: Message | readonly Message[],
|
|
816
|
+
timeoutMs: number | undefined,
|
|
817
|
+
onAdmitted: (() => void) | undefined,
|
|
818
|
+
requestOperation: PendingOperation<unknown>,
|
|
819
|
+
receiver: import('../../foundation/operation-registry').OperationObserver<unknown, unknown>
|
|
820
|
+
): void;
|
|
766
821
|
sendToChannel(channelName: string, payload: Message | readonly Message[]): Promise<void>;
|
|
767
822
|
publish(
|
|
768
823
|
topic: string,
|
|
@@ -779,8 +834,18 @@ export interface ZLinkBackendSpot extends ZLinkBackendObject {
|
|
|
779
834
|
spotId: RoutingId,
|
|
780
835
|
payload: Message | readonly Message[],
|
|
781
836
|
timeoutMs?: number,
|
|
782
|
-
onAdmitted?: () => void
|
|
837
|
+
onAdmitted?: () => void,
|
|
838
|
+
requestOperation?: undefined
|
|
783
839
|
): Promise<readonly Message[]>;
|
|
840
|
+
requestToSpot(
|
|
841
|
+
targetRid: RoutingId,
|
|
842
|
+
spotId: RoutingId,
|
|
843
|
+
payload: Message | readonly Message[],
|
|
844
|
+
timeoutMs: number | undefined,
|
|
845
|
+
onAdmitted: (() => void) | undefined,
|
|
846
|
+
requestOperation: PendingOperation<unknown>,
|
|
847
|
+
receiver: import('../../foundation/operation-registry').OperationObserver<unknown, unknown>
|
|
848
|
+
): void;
|
|
784
849
|
dispose(): Promise<void>;
|
|
785
850
|
}
|
|
786
851
|
|
|
@@ -800,6 +865,8 @@ export interface ZLinkMeshBackendAdapter {
|
|
|
800
865
|
options: {
|
|
801
866
|
readonly meshName: string;
|
|
802
867
|
readonly routingId?: RoutingId;
|
|
868
|
+
readonly sendHighWaterMark?: number;
|
|
869
|
+
readonly receiveHighWaterMark?: number;
|
|
803
870
|
readonly receiveTimeoutMs?: number;
|
|
804
871
|
readonly trustProfile?: string;
|
|
805
872
|
readonly applicationJobQueue: import('../../application-jobs/contracts').ApplicationJobQueuePort;
|