@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
|
@@ -515,6 +515,9 @@ export type ServiceStatefulReplyTail = {
|
|
|
515
515
|
readonly kind: 'streamBind';
|
|
516
516
|
readonly bindingGeneration: bigint;
|
|
517
517
|
readonly authorityOwnerGeneration: bigint;
|
|
518
|
+
} | {
|
|
519
|
+
readonly kind: 'streamBindRejected';
|
|
520
|
+
readonly rejectionMessage: string;
|
|
518
521
|
} | {
|
|
519
522
|
readonly kind: 'userSpotCreate';
|
|
520
523
|
readonly createResult: 'existing' | 'created' | 'rejected';
|
|
@@ -40,6 +40,7 @@ const service_wire_codec_generated_1 = require("../protocol/service_wire_codec.g
|
|
|
40
40
|
const stream_wire_1 = require("@zlink-systems/stream-wire");
|
|
41
41
|
const InternalDefaults_1 = require("../../contracts/Configuration/InternalDefaults");
|
|
42
42
|
const framework_errors_internal_1 = require("../framework-errors-internal");
|
|
43
|
+
const runtime_values_1 = require("../backend/runtime-values");
|
|
43
44
|
const service_wire_codec_generated_2 = require("../protocol/service_wire_codec.generated");
|
|
44
45
|
const service_wire_pilot_codec_generated_1 = require("../protocol/service_wire_pilot_codec.generated");
|
|
45
46
|
const routing_id_2 = require("../routing-id");
|
|
@@ -1226,6 +1227,12 @@ function decodeStatefulReply(frame, expectedCorrelation, operationKind, hasPaylo
|
|
|
1226
1227
|
};
|
|
1227
1228
|
}
|
|
1228
1229
|
}
|
|
1230
|
+
else if (operationKind === 'streamBind' && terminalResult === runtime_values_1.RequestResult.Rejected) {
|
|
1231
|
+
tail = {
|
|
1232
|
+
kind: 'streamBindRejected',
|
|
1233
|
+
rejectionMessage: reader.text16('rejectionMessage')
|
|
1234
|
+
};
|
|
1235
|
+
}
|
|
1229
1236
|
reader.end();
|
|
1230
1237
|
return {
|
|
1231
1238
|
correlation,
|
|
@@ -1275,6 +1282,8 @@ function encodeReplyTail(tail) {
|
|
|
1275
1282
|
}
|
|
1276
1283
|
case 'streamBind':
|
|
1277
1284
|
return concat(u64(tail.bindingGeneration), u64(tail.authorityOwnerGeneration));
|
|
1285
|
+
case 'streamBindRejected':
|
|
1286
|
+
return concat(text16(tail.rejectionMessage, 'rejectionMessage'));
|
|
1278
1287
|
case 'userSpotCreate':
|
|
1279
1288
|
return concat(Buffer.of(['existing', 'created', 'rejected'].indexOf(tail.createResult) + 1), rid(tail.spotId, 'spotId'), u64(tail.objectGeneration));
|
|
1280
1289
|
case 'userSpotClose':
|
|
@@ -1385,6 +1394,12 @@ function rid(value, name) {
|
|
|
1385
1394
|
function text8(value, name) {
|
|
1386
1395
|
return sized8(value, name);
|
|
1387
1396
|
}
|
|
1397
|
+
function text16(value, name) {
|
|
1398
|
+
const bytes = (0, service_wire_binary_primitives_1.encodeCanonicalServiceWireText)(value, name, 0xffff, outOfRange);
|
|
1399
|
+
if (bytes.byteLength === 0)
|
|
1400
|
+
fail(`${name} must not be empty.`);
|
|
1401
|
+
return concat(u16(bytes.byteLength), bytes);
|
|
1402
|
+
}
|
|
1388
1403
|
function optionalRid(value) {
|
|
1389
1404
|
return value === undefined ? Buffer.of(0) : rid(value, 'sourceSpotId');
|
|
1390
1405
|
}
|
|
@@ -56,6 +56,8 @@ export declare class ServiceTopologyRegistry {
|
|
|
56
56
|
peer(nodeRoutingId: string): AdmittedServicePeer | undefined;
|
|
57
57
|
routeAdmission(nodeRoutingId: string): ServiceRouteAdmission | undefined;
|
|
58
58
|
admittedPeer(nodeRoutingId: string): AdmittedServicePeer | undefined;
|
|
59
|
+
hasRemoteAdmit(nodeRoutingId: string, connectionId?: string | bigint): boolean;
|
|
60
|
+
readyPeer(nodeRoutingId: string): AdmittedServicePeer | undefined;
|
|
59
61
|
peers(): readonly AdmittedServicePeer[];
|
|
60
62
|
private peersCore;
|
|
61
63
|
notRequiredPeers(): readonly ServiceNodeDescriptor[];
|
|
@@ -128,6 +128,14 @@ class ServiceTopologyRegistry {
|
|
|
128
128
|
admittedPeer(nodeRoutingId) {
|
|
129
129
|
return this.peersByRid.get(nodeRoutingId);
|
|
130
130
|
}
|
|
131
|
+
hasRemoteAdmit(nodeRoutingId, connectionId) {
|
|
132
|
+
const admission = this.routeAdmission(nodeRoutingId);
|
|
133
|
+
return (admission?.remoteAdmitReceived === true &&
|
|
134
|
+
(connectionId === undefined || admission.connectionId === connectionId));
|
|
135
|
+
}
|
|
136
|
+
readyPeer(nodeRoutingId) {
|
|
137
|
+
return this.hasRemoteAdmit(nodeRoutingId) ? this.admittedPeer(nodeRoutingId) : undefined;
|
|
138
|
+
}
|
|
131
139
|
peers() {
|
|
132
140
|
return this.peersCore();
|
|
133
141
|
}
|
|
@@ -204,7 +212,7 @@ class ServiceTopologyRegistry {
|
|
|
204
212
|
peer: clonePeer(peer),
|
|
205
213
|
channel: selectableChannel(peer.descriptor, channelName)
|
|
206
214
|
}))
|
|
207
|
-
.filter((value) => value.channel !== undefined), (value) => value.channel.weight, (value) => value.peer.descriptor.nodeRoutingId, (left, right) => compareOrdinal(left.peer.descriptor.nodeRoutingId, right.peer.descriptor.nodeRoutingId), (value) => isReady(value.peer))?.peer;
|
|
215
|
+
.filter((value) => value.channel !== undefined), (value) => value.channel.weight, (value) => value.peer.descriptor.nodeRoutingId, (left, right) => compareOrdinal(left.peer.descriptor.nodeRoutingId, right.peer.descriptor.nodeRoutingId), (value) => this.readyPeer(value.peer.descriptor.nodeRoutingId) !== undefined && isReady(value.peer))?.peer;
|
|
208
216
|
}
|
|
209
217
|
selectPlacement(isReady = () => true) {
|
|
210
218
|
return this.selectWeightedCycle('placement', () => [...this.peersByRid.values()]
|
|
@@ -216,7 +224,7 @@ class ServiceTopologyRegistry {
|
|
|
216
224
|
descriptor.activeCapacityUsed < descriptor.activeCapacityLimit &&
|
|
217
225
|
descriptor.pendingCapacityUsed < descriptor.pendingCapacityLimit);
|
|
218
226
|
})
|
|
219
|
-
.map(clonePeer), (peer) => peer.descriptor.placementWeight, (peer) => peer.descriptor.nodeRoutingId, (left, right) => compareOrdinal(left.descriptor.nodeRoutingId, right.descriptor.nodeRoutingId), isReady);
|
|
227
|
+
.map(clonePeer), (peer) => peer.descriptor.placementWeight, (peer) => peer.descriptor.nodeRoutingId, (left, right) => compareOrdinal(left.descriptor.nodeRoutingId, right.descriptor.nodeRoutingId), (peer) => this.readyPeer(peer.descriptor.nodeRoutingId) !== undefined && isReady(peer));
|
|
220
228
|
}
|
|
221
229
|
selectObjectPlacement(stableType, isReady = () => true) {
|
|
222
230
|
return this.selectObjectPlacementWithStatus(stableType, isReady).descriptor;
|
|
@@ -249,7 +257,9 @@ class ServiceTopologyRegistry {
|
|
|
249
257
|
descriptor.pendingCapacityUsed < descriptor.pendingCapacityLimit);
|
|
250
258
|
if (withCapacity.length === 0)
|
|
251
259
|
return { status: 'capacity', eligible: [] };
|
|
252
|
-
const weighted = withCapacity.filter((descriptor) => descriptor.placementWeight > 0
|
|
260
|
+
const weighted = withCapacity.filter((descriptor) => descriptor.placementWeight > 0 &&
|
|
261
|
+
(descriptor.nodeRoutingId === this.local.nodeRoutingId ||
|
|
262
|
+
this.readyPeer(descriptor.nodeRoutingId) !== undefined));
|
|
253
263
|
return { status: weighted.some(isReady) ? 'available' : 'unavailable', eligible: weighted };
|
|
254
264
|
}
|
|
255
265
|
instanceSpotPlacementTypes() {
|
|
@@ -110,3 +110,4 @@ export declare const ServiceWireExactTerminalByFailureCode: {
|
|
|
110
110
|
readonly 35: 105;
|
|
111
111
|
};
|
|
112
112
|
export declare const isValidServiceWireTerminalFailure: (terminal: number, failureCode: number) => boolean;
|
|
113
|
+
export declare function recoverRequestCorrelation(bytes: Uint8Array): bigint | undefined;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isValidServiceWireTerminalFailure = exports.ServiceWireExactTerminalByFailureCode = exports.ServiceWireBoundaryTerminalResults = exports.ServiceWireFrameworkErrorCode = exports.ServiceWireFlag = exports.ServiceWireCommand = exports.SERVICE_FRAMEWORK_MULTIPART_CONTENT_TYPE = exports.SERVICE_FRAMEWORK_MULTIPART_PACKET_NAME = exports.SERVICE_WIRE_REQUIRED_CAPABILITY = exports.SERVICE_WIRE_METADATA_BYTES = exports.SERVICE_WIRE_MAJOR = exports.SERVICE_WIRE_MAGIC = void 0;
|
|
4
|
+
exports.recoverRequestCorrelation = recoverRequestCorrelation;
|
|
4
5
|
// Generated from service-wire-v1.schema.json. Do not edit.
|
|
5
6
|
exports.SERVICE_WIRE_MAGIC = [90, 77];
|
|
6
7
|
exports.SERVICE_WIRE_MAJOR = 1;
|
|
@@ -132,3 +133,14 @@ const isValidServiceWireTerminalFailure = (terminal, failureCode) => {
|
|
|
132
133
|
return exports.ServiceWireExactTerminalByFailureCode[failureCode] === terminal;
|
|
133
134
|
};
|
|
134
135
|
exports.isValidServiceWireTerminalFailure = isValidServiceWireTerminalFailure;
|
|
136
|
+
function recoverRequestCorrelation(bytes) {
|
|
137
|
+
if (bytes.length < 13
|
|
138
|
+
|| bytes[0] !== 90 || bytes[1] !== 77
|
|
139
|
+
|| bytes[2] !== 1
|
|
140
|
+
|| ![17, 19, 22, 25, 26, 27, 28, 38, 47, 48, 49, 54].includes(bytes[3]))
|
|
141
|
+
return undefined;
|
|
142
|
+
let correlation = 0n;
|
|
143
|
+
for (let index = 5; index < 13; ++index)
|
|
144
|
+
correlation = (correlation << 8n) | BigInt(bytes[index]);
|
|
145
|
+
return correlation === 0n ? undefined : correlation;
|
|
146
|
+
}
|
|
@@ -78,12 +78,16 @@ export declare function decodeChannelRequestHeader(frame: Uint8Array, header?: S
|
|
|
78
78
|
export declare function encodeReplyHeader(correlation: bigint, terminalResult?: number, failureCode?: number, tail?: Uint8Array): Buffer;
|
|
79
79
|
export declare function decodeReplyHeader(frame: Uint8Array): ServiceReplyHeader;
|
|
80
80
|
export declare function encodeApplicationPayload(payload: ServiceApplicationPayload): Buffer;
|
|
81
|
+
/** Encodes a retained internal application frame with its own backing store. */
|
|
82
|
+
export declare function encodeOwnedApplicationPayload(payload: ServiceApplicationPayload): Buffer;
|
|
81
83
|
/**
|
|
82
84
|
* Encodes the framework multipart payload directly into its M6A application
|
|
83
85
|
* frame. The caller supplies borrowed message views; this function performs
|
|
84
86
|
* the single ownership copy needed for the outbound frame.
|
|
85
87
|
*/
|
|
86
|
-
export declare function encodeMultipartApplicationPayload(parts: readonly Uint8Array[], packetName: string, contentType: string): Buffer;
|
|
88
|
+
export declare function encodeMultipartApplicationPayload(parts: readonly (Uint8Array | string)[], packetName: string, contentType: string): Buffer;
|
|
89
|
+
/** Encodes bare multipart bytes with the same writer as application frames. */
|
|
90
|
+
export declare function encodeMultipartPayload(parts: readonly (Uint8Array | string)[]): Buffer;
|
|
87
91
|
export declare function decodeApplicationPayload(frame: Uint8Array): ServiceApplicationPayload;
|
|
88
92
|
/**
|
|
89
93
|
* Decodes only the M6A envelope fields and returns a view of its payload.
|
|
@@ -11,7 +11,9 @@ exports.decodeChannelRequestHeader = decodeChannelRequestHeader;
|
|
|
11
11
|
exports.encodeReplyHeader = encodeReplyHeader;
|
|
12
12
|
exports.decodeReplyHeader = decodeReplyHeader;
|
|
13
13
|
exports.encodeApplicationPayload = encodeApplicationPayload;
|
|
14
|
+
exports.encodeOwnedApplicationPayload = encodeOwnedApplicationPayload;
|
|
14
15
|
exports.encodeMultipartApplicationPayload = encodeMultipartApplicationPayload;
|
|
16
|
+
exports.encodeMultipartPayload = encodeMultipartPayload;
|
|
15
17
|
exports.decodeApplicationPayload = decodeApplicationPayload;
|
|
16
18
|
exports.decodeApplicationPayloadView = decodeApplicationPayloadView;
|
|
17
19
|
exports.decodeMultipartApplicationPayloadView = decodeMultipartApplicationPayloadView;
|
|
@@ -24,6 +26,7 @@ exports.encodeReject = encodeReject;
|
|
|
24
26
|
exports.decodeReject = decodeReject;
|
|
25
27
|
exports.decodeHeader = decodeHeader;
|
|
26
28
|
const stream_wire_1 = require("@zlink-systems/stream-wire");
|
|
29
|
+
const payload_slab_1 = require("../../contracts/Common/payload-slab");
|
|
27
30
|
const EndpointNotation_1 = require("../../contracts/Configuration/EndpointNotation");
|
|
28
31
|
const service_topology_registry_1 = require("./service-topology-registry");
|
|
29
32
|
const service_wire_binary_primitives_1 = require("./service-wire-binary-primitives");
|
|
@@ -141,7 +144,14 @@ function decodeReplyHeader(frame) {
|
|
|
141
144
|
return result;
|
|
142
145
|
}
|
|
143
146
|
function encodeApplicationPayload(payload) {
|
|
144
|
-
|
|
147
|
+
return encodeApplicationPayloadWith(payload, payload_slab_1.allocatePayloadBytes);
|
|
148
|
+
}
|
|
149
|
+
/** Encodes a retained internal application frame with its own backing store. */
|
|
150
|
+
function encodeOwnedApplicationPayload(payload) {
|
|
151
|
+
return encodeApplicationPayloadWith(payload, allocateOwnedPayloadBytes);
|
|
152
|
+
}
|
|
153
|
+
function encodeApplicationPayloadWith(payload, allocate) {
|
|
154
|
+
const result = allocateApplicationPayload(payload.packetName, payload.contentType, payload.payload.byteLength, allocate);
|
|
145
155
|
result.set(payload.payload, result.byteLength - payload.payload.byteLength);
|
|
146
156
|
return result;
|
|
147
157
|
}
|
|
@@ -151,31 +161,52 @@ function encodeApplicationPayload(payload) {
|
|
|
151
161
|
* the single ownership copy needed for the outbound frame.
|
|
152
162
|
*/
|
|
153
163
|
function encodeMultipartApplicationPayload(parts, packetName, contentType) {
|
|
164
|
+
const multipartLength = multipartPayloadLength(parts);
|
|
165
|
+
const result = allocateApplicationPayload(packetName, contentType, multipartLength, payload_slab_1.allocatePayloadBytes);
|
|
166
|
+
writeMultipartPayload(result, result.byteLength - multipartLength, parts);
|
|
167
|
+
return result;
|
|
168
|
+
}
|
|
169
|
+
/** Encodes bare multipart bytes with the same writer as application frames. */
|
|
170
|
+
function encodeMultipartPayload(parts) {
|
|
171
|
+
const result = Buffer.alloc(multipartPayloadLength(parts));
|
|
172
|
+
writeMultipartPayload(result, 0, parts);
|
|
173
|
+
return result;
|
|
174
|
+
}
|
|
175
|
+
function multipartPartLength(part) {
|
|
176
|
+
return typeof part === 'string' ? Buffer.byteLength(part, 'utf8') : part.byteLength;
|
|
177
|
+
}
|
|
178
|
+
function multipartPayloadLength(parts) {
|
|
154
179
|
if (parts.length === 0)
|
|
155
180
|
fail('Multipart payload must contain at least one part.');
|
|
156
181
|
if (parts.length > MAX_U32)
|
|
157
182
|
fail('Multipart part count exceeds u32.');
|
|
158
|
-
let
|
|
159
|
-
for (
|
|
160
|
-
|
|
183
|
+
let length = 4;
|
|
184
|
+
for (let index = 0; index < parts.length; index += 1) {
|
|
185
|
+
const partLength = multipartPartLength(parts[index]);
|
|
186
|
+
if (partLength > MAX_U32)
|
|
161
187
|
fail('Multipart part exceeds u32.');
|
|
162
|
-
|
|
163
|
-
if (
|
|
188
|
+
length += 4 + partLength;
|
|
189
|
+
if (length > MAX_U32)
|
|
164
190
|
fail('Multipart payload exceeds u32.');
|
|
165
191
|
}
|
|
166
|
-
|
|
167
|
-
|
|
192
|
+
return length;
|
|
193
|
+
}
|
|
194
|
+
function writeMultipartPayload(result, offset, parts) {
|
|
168
195
|
result.writeUInt32BE(parts.length, offset);
|
|
169
196
|
offset += 4;
|
|
170
|
-
for (
|
|
171
|
-
|
|
197
|
+
for (let index = 0; index < parts.length; index += 1) {
|
|
198
|
+
const part = parts[index];
|
|
199
|
+
const length = multipartPartLength(part);
|
|
200
|
+
result.writeUInt32BE(length, offset);
|
|
172
201
|
offset += 4;
|
|
173
|
-
|
|
174
|
-
|
|
202
|
+
if (typeof part === 'string')
|
|
203
|
+
result.write(part, offset, length, 'utf8');
|
|
204
|
+
else
|
|
205
|
+
result.set(part, offset);
|
|
206
|
+
offset += length;
|
|
175
207
|
}
|
|
176
|
-
return result;
|
|
177
208
|
}
|
|
178
|
-
function allocateApplicationPayload(packetName, contentType, payloadLength) {
|
|
209
|
+
function allocateApplicationPayload(packetName, contentType, payloadLength, allocate) {
|
|
179
210
|
const packetNameLength = (0, service_wire_binary_primitives_1.canonicalServiceWireTextLength)(packetName, 'packetName', service_wire_binary_primitives_1.SERVICE_WIRE_TEXT8_MAX_BYTES, fail);
|
|
180
211
|
const contentTypeLength = (0, service_wire_binary_primitives_1.canonicalServiceWireTextLength)(contentType, 'contentType', service_wire_binary_primitives_1.SERVICE_WIRE_TEXT8_MAX_BYTES, fail);
|
|
181
212
|
if (payloadLength > MAX_U32)
|
|
@@ -185,7 +216,8 @@ function allocateApplicationPayload(packetName, contentType, payloadLength) {
|
|
|
185
216
|
const bodyLength = frameLength - prefixLength;
|
|
186
217
|
if (bodyLength > MAX_U32)
|
|
187
218
|
fail('Application payload body exceeds u32.');
|
|
188
|
-
|
|
219
|
+
// Both callers write every payload byte after these header fields.
|
|
220
|
+
const result = allocate(frameLength);
|
|
189
221
|
result[0] = exports.APPLICATION_PAYLOAD_VERSION;
|
|
190
222
|
result.writeUInt32BE(bodyLength, 1);
|
|
191
223
|
let offset = writeText8(result, prefixLength, packetName, packetNameLength);
|
|
@@ -193,6 +225,9 @@ function allocateApplicationPayload(packetName, contentType, payloadLength) {
|
|
|
193
225
|
result.writeUInt32BE(payloadLength, offset);
|
|
194
226
|
return result;
|
|
195
227
|
}
|
|
228
|
+
function allocateOwnedPayloadBytes(length) {
|
|
229
|
+
return Buffer.allocUnsafeSlow(length);
|
|
230
|
+
}
|
|
196
231
|
function decodeApplicationPayload(frame) {
|
|
197
232
|
const decoded = decodeApplicationPayloadView(frame);
|
|
198
233
|
return {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import type { ZLinkActorSessionAuthorityFence } from '../streams/actor-session-binding-registry';
|
|
1
2
|
import { ZLinkFrameworkInternalErrorKind } from '../framework-errors-internal';
|
|
2
3
|
import type { ActorRef, RoutingId, ZLinkRouteMessageContext, ZLinkSessionActor } from '../../contracts';
|
|
3
4
|
import type { Message } from '../../contracts/Common/Message';
|
|
4
5
|
import { type ZLinkActorRoutedJoinTransport, type ZLinkRemoteActorPacketTarget, type ZLinkRemoteBoundSessionTarget } from '../actors';
|
|
5
6
|
import type { DefaultZLinkActorManager } from '../actors';
|
|
6
|
-
import type {
|
|
7
|
+
import type { ZLinkSpotNodeRuntimeManager } from '../spots';
|
|
7
8
|
import type { ZLinkDetachedTaskRunner } from '../spots/spot-actor-join-dispatch';
|
|
8
9
|
import type { ZLinkBoundSessionResponsePort, ZLinkSessionBindingConfirmationOptions, ZLinkStreamActorLookupPort } from '../streams/stream-binding-runtime-ports';
|
|
9
10
|
import type { ServiceStreamSessionBinding } from '../foundation/service-runtime-contracts';
|
|
@@ -16,7 +17,6 @@ export interface ZLinkActorPacketRelayOptions {
|
|
|
16
17
|
readonly streamBindingRuntime: () => ZLinkBoundSessionResponsePort & ZLinkStreamActorLookupPort;
|
|
17
18
|
readonly meshRouters: MeshRouterResolver;
|
|
18
19
|
readonly actorManager: () => DefaultZLinkActorManager | undefined;
|
|
19
|
-
readonly spotManager: () => DefaultZLinkSpotManager | undefined;
|
|
20
20
|
readonly spotNodeRuntime: () => ZLinkSpotNodeRuntimeManager | undefined;
|
|
21
21
|
readonly detachedTaskRunner: ZLinkDetachedTaskRunner;
|
|
22
22
|
readonly errorSink: () => {
|
|
@@ -30,11 +30,11 @@ export declare class ZLinkActorPacketRelay {
|
|
|
30
30
|
private readonly options;
|
|
31
31
|
private readonly targets;
|
|
32
32
|
constructor(options: ZLinkActorPacketRelayOptions);
|
|
33
|
-
notifyBoundActorDisconnected(actor: ZLinkSessionActor, signal?: AbortSignal, binding?: ServiceStreamSessionBinding): Promise<void>;
|
|
33
|
+
notifyBoundActorDisconnected(actor: ZLinkSessionActor, signal?: AbortSignal, binding?: ServiceStreamSessionBinding, authorityFence?: ZLinkActorSessionAuthorityFence): Promise<void>;
|
|
34
34
|
clearRemoteActorPacketTarget(actorId: string): void;
|
|
35
35
|
updateRemoteActorPacketTarget(actorId: string, value: unknown): Promise<void>;
|
|
36
36
|
actorPacketTargetForState(actorId: string): ZLinkRemoteActorPacketTarget | undefined;
|
|
37
|
-
notifyLocalActorDisconnectedById(actorId: string, signal?: AbortSignal, binding?: ServiceStreamSessionBinding, bindingActorRef?: ActorRef): Promise<void>;
|
|
37
|
+
notifyLocalActorDisconnectedById(actorId: string, signal?: AbortSignal, binding?: ServiceStreamSessionBinding, bindingActorRef?: ActorRef, authorityFence?: ZLinkActorSessionAuthorityFence): Promise<void>;
|
|
38
38
|
receiveRemoteActorPacketRelay(payload: unknown, _routeContext: ZLinkRouteMessageContext): Promise<{
|
|
39
39
|
readonly ok: boolean;
|
|
40
40
|
readonly error?: unknown;
|
|
@@ -52,7 +52,7 @@ export declare class ZLinkActorPacketRelay {
|
|
|
52
52
|
*/
|
|
53
53
|
private installSameNodeSessionBinding;
|
|
54
54
|
relayRemoteActorPacket(actor: ZLinkSessionActor, frameHeader: ZLinkStreamFrameHeader, payload: Message): Promise<boolean>;
|
|
55
|
-
notifyRemoteActorDisconnected(actorId: string, remoteTarget: ZLinkRemoteBoundSessionTarget | ZLinkRemoteActorPacketTarget, signal?: AbortSignal, bindingActorRef?: ActorRef, binding?: ServiceStreamSessionBinding): Promise<void>;
|
|
55
|
+
notifyRemoteActorDisconnected(actorId: string, remoteTarget: ZLinkRemoteBoundSessionTarget | ZLinkRemoteActorPacketTarget, signal?: AbortSignal, bindingActorRef?: ActorRef, binding?: ServiceStreamSessionBinding, authorityFence?: ZLinkActorSessionAuthorityFence): Promise<void>;
|
|
56
56
|
private disconnectedFrame;
|
|
57
57
|
private requireCurrentRemoteBinding;
|
|
58
58
|
private matchesCurrentRemoteBinding;
|
|
@@ -61,5 +61,4 @@ export declare class ZLinkActorPacketRelay {
|
|
|
61
61
|
private sendCapturedOrCurrentBoundSessionResponse;
|
|
62
62
|
private sendCapturedOrCurrentBoundSessionError;
|
|
63
63
|
private requireSpotNodeRuntime;
|
|
64
|
-
private requireSpotManager;
|
|
65
64
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ZLinkActorPacketRelay = void 0;
|
|
4
|
+
const request_result_1 = require("../messaging/request-result");
|
|
4
5
|
const framework_errors_internal_1 = require("../framework-errors-internal");
|
|
5
6
|
const runtime_message_1 = require("../backend/runtime-message");
|
|
6
7
|
const contracts_1 = require("../../contracts");
|
|
@@ -34,14 +35,14 @@ class ZLinkActorPacketRelay {
|
|
|
34
35
|
spotRouterChannelIdForMesh: spotRouterChannelIdByMesh?.call(options.meshRouters) ?? ((meshName) => meshName)
|
|
35
36
|
});
|
|
36
37
|
}
|
|
37
|
-
async notifyBoundActorDisconnected(actor, signal, binding) {
|
|
38
|
+
async notifyBoundActorDisconnected(actor, signal, binding, authorityFence) {
|
|
38
39
|
// The Session binding owns this route, including after relocation and detach (§5, §7).
|
|
39
40
|
const actorRefTarget = this.targets.targetForActorRef(actor.ref);
|
|
40
41
|
if (actorRefTarget !== undefined) {
|
|
41
|
-
await this.notifyRemoteActorDisconnected(actor.actorId, actorRefTarget, signal, actor.ref, binding);
|
|
42
|
+
await this.notifyRemoteActorDisconnected(actor.actorId, actorRefTarget, signal, actor.ref, binding, authorityFence);
|
|
42
43
|
return;
|
|
43
44
|
}
|
|
44
|
-
await this.notifyLocalActorDisconnectedById(actor.actorId, signal, binding, actor.ref);
|
|
45
|
+
await this.notifyLocalActorDisconnectedById(actor.actorId, signal, binding, actor.ref, authorityFence);
|
|
45
46
|
}
|
|
46
47
|
clearRemoteActorPacketTarget(actorId) {
|
|
47
48
|
this.targets.clear(actorId);
|
|
@@ -52,17 +53,17 @@ class ZLinkActorPacketRelay {
|
|
|
52
53
|
actorPacketTargetForState(actorId) {
|
|
53
54
|
return this.targets.targetForState(actorId);
|
|
54
55
|
}
|
|
55
|
-
async notifyLocalActorDisconnectedById(actorId, signal, binding, bindingActorRef) {
|
|
56
|
+
async notifyLocalActorDisconnectedById(actorId, signal, binding, bindingActorRef, authorityFence) {
|
|
56
57
|
(0, abort_1.throwIfAborted)(signal);
|
|
57
|
-
const state = this.options.actorManager()?.getState(actorId);
|
|
58
58
|
const frame = this.disconnectedFrame(actorId, binding);
|
|
59
59
|
const header = runtime_message_1.ZLinkBufferMessage.fromOwned(Buffer.from(frame.header));
|
|
60
60
|
const body = runtime_message_1.ZLinkBufferMessage.fromOwned(frame.payload);
|
|
61
61
|
try {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
const context = sessionActorFollowContext(bindingActorRef, authorityFence, [header, body], false);
|
|
63
|
+
const ref = context === undefined || bindingActorRef === undefined
|
|
64
|
+
? bindingActorRef
|
|
65
|
+
: (0, actor_message_follow_context_1.attachActorMessageFollowContext)(bindingActorRef, context);
|
|
66
|
+
await this.requireSpotNodeRuntime().dispatchEntryActorPacket('local', actorId, [header, body], false, undefined, ref);
|
|
66
67
|
}
|
|
67
68
|
finally {
|
|
68
69
|
header.close();
|
|
@@ -138,12 +139,9 @@ class ZLinkActorPacketRelay {
|
|
|
138
139
|
frameHeader.name !== actors_1.ZLINK_REMOTE_ACTOR_SESSION_DISCONNECTED_PACKET) {
|
|
139
140
|
this.requireCurrentRemoteBinding(relay, _routeContext);
|
|
140
141
|
}
|
|
141
|
-
const state = this.options.actorManager()?.getState(relay.actorId);
|
|
142
142
|
if (frameHeader.kind === protocol_1.ZLinkStreamMessageKind.Send ||
|
|
143
143
|
frameHeader.name === actors_1.ZLINK_REMOTE_ACTOR_SESSION_DISCONNECTED_PACKET) {
|
|
144
|
-
const dispatch =
|
|
145
|
-
? this.requireSpotNodeRuntime().dispatchEntryActorPacket('remote', relay.actorId, [header, body], false, remoteBoundSessionTarget, fallbackActorRef)
|
|
146
|
-
: this.requireSpotManager().dispatchRoutedActorPacket('remote', state.spotId, relay.actorId, [header, body], false, remoteBoundSessionTarget, fallbackActorRef);
|
|
144
|
+
const dispatch = this.requireSpotNodeRuntime().dispatchEntryActorPacket('remote', relay.actorId, [header, body], false, remoteBoundSessionTarget, fallbackActorRef);
|
|
147
145
|
if (frameHeader.name === actors_1.ZLINK_REMOTE_ACTOR_SESSION_DISCONNECTED_PACKET) {
|
|
148
146
|
await dispatch;
|
|
149
147
|
return {
|
|
@@ -182,9 +180,7 @@ class ZLinkActorPacketRelay {
|
|
|
182
180
|
if (frameHeader.kind === protocol_1.ZLinkStreamMessageKind.Request &&
|
|
183
181
|
frameHeader.requestSeq !== undefined &&
|
|
184
182
|
relay.returnResponse !== true) {
|
|
185
|
-
const dispatch =
|
|
186
|
-
? this.requireSpotNodeRuntime().dispatchEntryActorPacket('remote', relay.actorId, [header, body], false, remoteBoundSessionTarget, fallbackActorRef)
|
|
187
|
-
: this.requireSpotManager().dispatchRoutedActorPacket('remote', state.spotId, relay.actorId, [header, body], false, remoteBoundSessionTarget, fallbackActorRef);
|
|
183
|
+
const dispatch = this.requireSpotNodeRuntime().dispatchEntryActorPacket('remote', relay.actorId, [header, body], false, remoteBoundSessionTarget, fallbackActorRef);
|
|
188
184
|
closeFrameMessages = false;
|
|
189
185
|
const deferredPacketName = frameHeader.name;
|
|
190
186
|
const deferredRequestSeq = frameHeader.requestSeq;
|
|
@@ -224,9 +220,7 @@ class ZLinkActorPacketRelay {
|
|
|
224
220
|
actorPacketTarget: (0, actor_packet_relay_wire_1.encodeRemoteActorPacketTarget)(this.actorPacketTargetForState(relay.actorId))
|
|
225
221
|
};
|
|
226
222
|
}
|
|
227
|
-
const response =
|
|
228
|
-
? await this.requireSpotNodeRuntime().dispatchEntryActorPacket('remote', relay.actorId, [header, body], relay.returnResponse === true, remoteBoundSessionTarget, fallbackActorRef)
|
|
229
|
-
: await this.requireSpotManager().dispatchRoutedActorPacket('remote', state.spotId, relay.actorId, [header, body], relay.returnResponse === true, remoteBoundSessionTarget, fallbackActorRef);
|
|
223
|
+
const response = await this.requireSpotNodeRuntime().dispatchEntryActorPacket('remote', relay.actorId, [header, body], relay.returnResponse === true, remoteBoundSessionTarget, fallbackActorRef);
|
|
230
224
|
return {
|
|
231
225
|
ok: true,
|
|
232
226
|
response,
|
|
@@ -354,21 +348,9 @@ class ZLinkActorPacketRelay {
|
|
|
354
348
|
const header = runtime_message_1.ZLinkBufferMessage.fromOwned(Buffer.from(encodedHeader.buffer, encodedHeader.byteOffset, encodedHeader.byteLength));
|
|
355
349
|
let request;
|
|
356
350
|
try {
|
|
357
|
-
const
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
: (0, actor_message_follow_context_1.createInitialActorMessageFollowContext)({
|
|
361
|
-
meshName: storedActorRef.meshName,
|
|
362
|
-
actorRef: storedActorRef,
|
|
363
|
-
actorType: authority.actorType ?? '',
|
|
364
|
-
ownerNodeGeneration: authority.ownerNodeGeneration,
|
|
365
|
-
ownerId: authority.ownerId,
|
|
366
|
-
ownerLeaseGeneration: authority.ownerLeaseGeneration,
|
|
367
|
-
authorityOwnerGeneration: authority.authorityOwnerGeneration,
|
|
368
|
-
authorityStoreVersion: authority.authorityStoreVersion ?? ''
|
|
369
|
-
}, [header, payload], returnResponse, undefined, isValidMessageFollowId(frameHeader.correlationId)
|
|
370
|
-
? frameHeader.correlationId
|
|
371
|
-
: (0, actor_message_follow_context_1.createMessageFollowId)());
|
|
351
|
+
const messageFollowContext = sessionActorFollowContext(storedActorRef, aggregateRoute?.authorityFence, [header, payload], returnResponse, isValidMessageFollowId(frameHeader.correlationId)
|
|
352
|
+
? frameHeader.correlationId
|
|
353
|
+
: (0, actor_message_follow_context_1.createMessageFollowId)());
|
|
372
354
|
request = (0, actor_packet_relay_wire_1.encodeRemoteActorPacketRelayPayload)({
|
|
373
355
|
actorId: actor.actorId,
|
|
374
356
|
routerChannelId: remoteTarget.routerChannelId,
|
|
@@ -445,20 +427,32 @@ class ZLinkActorPacketRelay {
|
|
|
445
427
|
}
|
|
446
428
|
return true;
|
|
447
429
|
}
|
|
448
|
-
async notifyRemoteActorDisconnected(actorId, remoteTarget, signal, bindingActorRef, binding) {
|
|
430
|
+
async notifyRemoteActorDisconnected(actorId, remoteTarget, signal, bindingActorRef, binding, authorityFence) {
|
|
449
431
|
const spotKind = 'spotKind' in remoteTarget ? remoteTarget.spotKind : undefined;
|
|
450
432
|
const frame = this.disconnectedFrame(actorId, binding, 'sessionNodeRid' in remoteTarget ? remoteTarget : undefined);
|
|
451
|
-
const
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
433
|
+
const parts = [
|
|
434
|
+
runtime_message_1.ZLinkBufferMessage.fromOwned(Buffer.from(frame.header)),
|
|
435
|
+
runtime_message_1.ZLinkBufferMessage.fromOwned(frame.payload)
|
|
436
|
+
];
|
|
437
|
+
let payload;
|
|
438
|
+
try {
|
|
439
|
+
payload = (0, actor_packet_relay_wire_1.encodeRemoteActorPacketRelayPayload)({
|
|
440
|
+
actorId,
|
|
441
|
+
routerChannelId: remoteTarget.routerChannelId,
|
|
442
|
+
bindingActorRef,
|
|
443
|
+
messageFollowContext: sessionActorFollowContext(bindingActorRef, authorityFence, parts, false),
|
|
444
|
+
...frame
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
finally {
|
|
448
|
+
for (const part of parts)
|
|
449
|
+
part.close();
|
|
450
|
+
}
|
|
457
451
|
if ((spotKind ?? contracts_1.ZLinkSpotKind.Entry) === contracts_1.ZLinkSpotKind.Entry) {
|
|
458
|
-
await this.options.routeTransport.request(remoteTarget.routerChannelId, String(remoteTarget.targetNodeRid), actors_1.ZLINK_REMOTE_ACTOR_PACKET_RELAY_PACKET, payload, this.options.requestTimeoutMs, signal);
|
|
452
|
+
await (0, request_result_1.mapZLinkRequestReply)(this.options.routeTransport.request(remoteTarget.routerChannelId, String(remoteTarget.targetNodeRid), actors_1.ZLINK_REMOTE_ACTOR_PACKET_RELAY_PACKET, payload, this.options.requestTimeoutMs, signal));
|
|
459
453
|
return;
|
|
460
454
|
}
|
|
461
|
-
await this.options.routeTransport.requestToSpot({
|
|
455
|
+
await (0, request_result_1.mapZLinkRequestReply)(this.options.routeTransport.requestToSpot({
|
|
462
456
|
routerChannelId: remoteTarget.routerChannelId,
|
|
463
457
|
targetNodeRid: remoteTarget.targetNodeRid,
|
|
464
458
|
spotId: remoteTarget.spotId,
|
|
@@ -467,7 +461,7 @@ class ZLinkActorPacketRelay {
|
|
|
467
461
|
packetName: actors_1.ZLINK_REMOTE_ACTOR_PACKET_RELAY_PACKET,
|
|
468
462
|
timeoutMs: this.options.requestTimeoutMs,
|
|
469
463
|
signal
|
|
470
|
-
});
|
|
464
|
+
}));
|
|
471
465
|
}
|
|
472
466
|
disconnectedFrame(actorId, binding, target) {
|
|
473
467
|
const current = binding === undefined
|
|
@@ -502,7 +496,7 @@ class ZLinkActorPacketRelay {
|
|
|
502
496
|
async requestRemoteTarget(target, request, unavailableMessage, decodeReply, signal) {
|
|
503
497
|
if (target.spotKind === contracts_1.ZLinkSpotKind.Entry) {
|
|
504
498
|
try {
|
|
505
|
-
return await this.options.routeTransport.request(target.routerChannelId, String(target.targetNodeRid), actors_1.ZLINK_REMOTE_ACTOR_PACKET_RELAY_PACKET, request, this.options.requestTimeoutMs, signal);
|
|
499
|
+
return await (0, request_result_1.mapZLinkRequestReply)(this.options.routeTransport.request(target.routerChannelId, String(target.targetNodeRid), actors_1.ZLINK_REMOTE_ACTOR_PACKET_RELAY_PACKET, request, this.options.requestTimeoutMs, signal));
|
|
506
500
|
}
|
|
507
501
|
catch (error) {
|
|
508
502
|
if (!(error instanceof ConfigurationException_1.ZLinkConfigurationException)) {
|
|
@@ -514,12 +508,10 @@ class ZLinkActorPacketRelay {
|
|
|
514
508
|
}
|
|
515
509
|
async relayLocalActorPacket(actor, frameHeader, payload) {
|
|
516
510
|
const state = this.options.actorManager()?.getState(actor.actorId);
|
|
517
|
-
|
|
518
|
-
const hasActiveSpot = spotId !== undefined && this.options.spotManager()?.hasActiveSpot(spotId) === true;
|
|
519
|
-
if (!hasActiveSpot) {
|
|
511
|
+
if (state === undefined) {
|
|
520
512
|
return false;
|
|
521
513
|
}
|
|
522
|
-
const actorRef = state
|
|
514
|
+
const actorRef = state.nativeActorRef;
|
|
523
515
|
const localNode = this.options.spotNodeRuntime()?.primaryMeshNode;
|
|
524
516
|
const localNodeRid = localNode === undefined ? undefined : String(localNode.status().routingId);
|
|
525
517
|
if (actorRef?.nodeRid !== undefined &&
|
|
@@ -538,7 +530,7 @@ class ZLinkActorPacketRelay {
|
|
|
538
530
|
try {
|
|
539
531
|
this.options.detachedTaskRunner.runDetached('local actor packet relay', async () => {
|
|
540
532
|
try {
|
|
541
|
-
const response = await this.
|
|
533
|
+
const response = await this.requireSpotNodeRuntime().dispatchEntryActorPacket('local', actor.actorId, [header, body], returnResponse, undefined, actor.ref);
|
|
542
534
|
if (!returnResponse) {
|
|
543
535
|
return;
|
|
544
536
|
}
|
|
@@ -590,13 +582,6 @@ class ZLinkActorPacketRelay {
|
|
|
590
582
|
}
|
|
591
583
|
return runtime;
|
|
592
584
|
}
|
|
593
|
-
requireSpotManager() {
|
|
594
|
-
const manager = this.options.spotManager();
|
|
595
|
-
if (manager === undefined) {
|
|
596
|
-
throw new Error('SPOT manager runtime is not started.');
|
|
597
|
-
}
|
|
598
|
-
return manager;
|
|
599
|
-
}
|
|
600
585
|
}
|
|
601
586
|
exports.ZLinkActorPacketRelay = ZLinkActorPacketRelay;
|
|
602
587
|
function isValidMessageFollowId(value) {
|
|
@@ -608,3 +593,19 @@ function withDefaultSpotKind(target) {
|
|
|
608
593
|
? { ...target, spotKind: contracts_1.ZLinkSpotKind.Entry }
|
|
609
594
|
: target;
|
|
610
595
|
}
|
|
596
|
+
function sessionActorFollowContext(actorRef, authority, parts, request, operationId) {
|
|
597
|
+
if (actorRef === undefined ||
|
|
598
|
+
authority?.ownerId === undefined ||
|
|
599
|
+
authority.ownerNodeGeneration === undefined)
|
|
600
|
+
return undefined;
|
|
601
|
+
return (0, actor_message_follow_context_1.createInitialActorMessageFollowContext)({
|
|
602
|
+
meshName: actorRef.meshName,
|
|
603
|
+
actorRef,
|
|
604
|
+
actorType: authority.actorType ?? '',
|
|
605
|
+
ownerNodeGeneration: authority.ownerNodeGeneration,
|
|
606
|
+
ownerId: authority.ownerId,
|
|
607
|
+
ownerLeaseGeneration: authority.ownerLeaseGeneration,
|
|
608
|
+
authorityOwnerGeneration: authority.authorityOwnerGeneration,
|
|
609
|
+
authorityStoreVersion: authority.authorityStoreVersion ?? ''
|
|
610
|
+
}, parts, request, undefined, operationId);
|
|
611
|
+
}
|
|
@@ -21,7 +21,7 @@ export interface ZLinkActorPlacementCoordinatorOptions {
|
|
|
21
21
|
readonly decodeRemoteReply?: (payload: Uint8Array) => unknown;
|
|
22
22
|
}
|
|
23
23
|
export declare class ZLinkActorPlacementCoordinator {
|
|
24
|
-
|
|
24
|
+
readonly options: ZLinkActorPlacementCoordinatorOptions;
|
|
25
25
|
constructor(options: ZLinkActorPlacementCoordinatorOptions);
|
|
26
26
|
create(actorId: string, stableType: string, createOnly: boolean, meshName: string | undefined, requestPayload: Uint8Array, timeoutMs: number, signal?: AbortSignal): Promise<ZLinkActorCreateResult>;
|
|
27
27
|
handleRemoteCreate(record: ServiceActorCreateRecord, materialize: (requestPayload: Uint8Array, authority: ZLinkAuthoritySnapshot, signal: AbortSignal) => Promise<{
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RequestRuntime } from '../foundation/request-runtime';
|
|
1
2
|
import type { ActorRef, RoutingId, ZLinkActor, ZLinkMessage } from '../../contracts';
|
|
2
3
|
import type { ZLinkProviderResolver } from '../../contracts/Common/ZLinkProviderResolver';
|
|
3
4
|
import { type ZLinkBackendMeshNode, type ZLinkMeshCompletionTable } from '../backend';
|
|
@@ -15,6 +16,7 @@ import type { ZLinkRuntimeAdmissionGate } from '../admission';
|
|
|
15
16
|
import type { ZLinkRemoteActorPacketTarget } from '../actors';
|
|
16
17
|
import type { ZLinkActorJoinRelocation } from '../actors/actor-join-relocation';
|
|
17
18
|
export interface ZLinkActorRuntimeOptionsFactoryOptions {
|
|
19
|
+
readonly requests?: RequestRuntime;
|
|
18
20
|
readonly terminateActorActivation: (actor: ZLinkActor, terminal: () => Promise<void>) => Promise<void>;
|
|
19
21
|
readonly registration: ZLinkFrameworkRegistration;
|
|
20
22
|
/** Message flow tracer, so a failed deferred Join records its cause on the flow. */
|
|
@@ -139,6 +139,7 @@ class ZLinkActorRuntimeOptionsFactory {
|
|
|
139
139
|
createActorClientOptions() {
|
|
140
140
|
const locationResolver = this.options.createActorLocationResolver();
|
|
141
141
|
return {
|
|
142
|
+
requests: this.options.requests,
|
|
142
143
|
nodeProvider: this.options.meshNode,
|
|
143
144
|
completionTableProvider: this.options.meshCompletions,
|
|
144
145
|
locationResolver: () => locationResolver,
|
|
@@ -149,9 +150,9 @@ class ZLinkActorRuntimeOptionsFactory {
|
|
|
149
150
|
staleActorRefReporter: (_meshName, actorId) => this.options.actorHandoff.recordStaleFailure(actorId),
|
|
150
151
|
staleActorRefPredicate: (meshName, actor) => this.actorBelongsToMesh(meshName, actor.actorId) &&
|
|
151
152
|
this.options.actorHandoff.isKnownStale(actor),
|
|
152
|
-
handoffCapture: (meshName, actorId, parts, returnResponse, actor, deadlineUnixMs, onAdmitted) => this.actorBelongsToMesh(meshName, actorId) &&
|
|
153
|
+
handoffCapture: (meshName, actorId, parts, returnResponse, actor, deadlineUnixMs, onAdmitted, requestOperation) => this.actorBelongsToMesh(meshName, actorId) &&
|
|
153
154
|
!this.options.actorHandoff.isProvisional(actorId)
|
|
154
|
-
? this.options.actorHandoff.capture('local', actorId, parts, returnResponse, undefined, actor, deadlineUnixMs, undefined, undefined, onAdmitted)
|
|
155
|
+
? this.options.actorHandoff.capture('local', actorId, parts, returnResponse, undefined, actor, deadlineUnixMs, undefined, undefined, onAdmitted, requestOperation)
|
|
155
156
|
: undefined,
|
|
156
157
|
sendErrorReporter: this.options.reportPostCommitError
|
|
157
158
|
};
|
|
@@ -90,8 +90,8 @@ export declare class ZLinkActorTransferRuntime {
|
|
|
90
90
|
completeRelocationSourceLeave(actor: ZLinkActor, sourceSpotId: RoutingId | undefined, signal?: AbortSignal): Promise<void>;
|
|
91
91
|
relayMaintenanceTerminal(actorId: string, packet: ZLinkActorHandoffPacket, result: ZLinkActorHandoffResult, sourceNodeRid: RoutingId, targetAuthorityOwnerGeneration?: bigint): ZLinkActorHandoffTerminalAck;
|
|
92
92
|
relayCanonicalMaintenanceTerminal(operationId: string, replyRouteId: string, result: ZLinkActorHandoffResult, sourceNodeRid: RoutingId, targetAuthorityOwnerGeneration?: bigint): ZLinkActorHandoffTerminalAcceptance;
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
sealBoundSessionRoute(actor: ZLinkActor, state: ZLinkActorRuntimeState, signal?: AbortSignal, relocation?: ServiceWireOperationId, relocationTarget?: Pick<ZLinkMeshNodeDescriptor, 'rid' | 'lifecycleGeneration'>): Promise<ZLinkRemoteBoundSessionTarget | undefined>;
|
|
94
|
+
abortBoundSessionRouteSeal(actor: ZLinkActor, state: ZLinkActorRuntimeState, target: ZLinkRemoteBoundSessionTarget): Promise<void>;
|
|
95
95
|
private observeBoundSessionSealAbort;
|
|
96
96
|
getOrCreateRoutedActor(actorId: string, actorType: string, actorRef?: ActorRef, remoteBoundSessionTarget?: ZLinkRemoteBoundSessionTarget, actorCreateRequest?: Message, signal?: AbortSignal): Promise<{
|
|
97
97
|
readonly actor: ZLinkActor;
|
|
@@ -120,6 +120,6 @@ export declare class ZLinkActorTransferRuntime {
|
|
|
120
120
|
rollbackRoutedActor(actor: ZLinkActor, signal?: AbortSignal): Promise<void>;
|
|
121
121
|
actorEntryNodeRid(actor: ZLinkActor): RoutingId | undefined;
|
|
122
122
|
private requireActorManager;
|
|
123
|
-
|
|
123
|
+
publishBoundSessionOwnership(actorId: string, actorRef: ZLinkBackendActorRef, ownershipGeneration: bigint, target: ZLinkRemoteBoundSessionTarget | undefined, targetOwnerLeaseGeneration: bigint | undefined): Promise<void>;
|
|
124
124
|
}
|
|
125
125
|
export {};
|