@zlink-systems/framework 0.30.0 → 0.30.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +150 -68
- package/dist/.tsbuildinfo +1 -1
- package/dist/contracts/Actors/ZLinkActorClient.d.ts +2 -1
- package/dist/contracts/Channels/Calls.d.ts +2 -1
- package/dist/contracts/Common/ZLinkEncodedPayload.d.ts +6 -0
- package/dist/contracts/Common/ZLinkEncodedPayload.js +18 -3
- package/dist/contracts/Common/ZLinkMessageMetadata.js +11 -5
- package/dist/contracts/Common/encoded-payload-storage.d.ts +1 -1
- package/dist/contracts/Common/encoded-payload-storage.js +5 -2
- package/dist/contracts/Configuration/Builders.d.ts +1 -1
- package/dist/contracts/Configuration/RegistrationBuilderPolicy.d.ts +2 -1
- package/dist/contracts/Configuration/RegistrationBuilderPolicy.js +5 -1
- package/dist/contracts/Configuration/RegistrationBuilders.js +2 -2
- package/dist/contracts/Configuration/RegistrationTypes.d.ts +1 -0
- package/dist/contracts/Dispatch/ZLinkDispatchOptions.d.ts +2 -2
- package/dist/contracts/Handlers/Attributes.d.ts +5 -13
- package/dist/contracts/Handlers/Attributes.js +7 -11
- package/dist/contracts/Handlers/JsonContract.d.ts +2 -46
- package/dist/contracts/Handlers/JsonContract.js +4 -153
- package/dist/contracts/Locations/Rows.d.ts +2 -0
- package/dist/contracts/Spots/Contracts.d.ts +6 -1
- package/dist/contracts/Spots/ZLinkSpot.d.ts +3 -3
- package/dist/nest-integration.d.ts +1 -1
- package/dist/nest-integration.js +2 -1
- package/dist/runtime/abort.d.ts +5 -0
- package/dist/runtime/abort.js +10 -0
- package/dist/runtime/actors/actor-authority-publication.js +3 -2
- package/dist/runtime/actors/actor-client.d.ts +1 -2
- package/dist/runtime/actors/actor-client.js +52 -57
- package/dist/runtime/actors/actor-context.d.ts +2 -0
- package/dist/runtime/actors/actor-context.js +46 -9
- package/dist/runtime/actors/actor-handoff.d.ts +8 -4
- package/dist/runtime/actors/actor-handoff.js +219 -92
- package/dist/runtime/actors/actor-join-relocation.d.ts +3 -0
- package/dist/runtime/actors/actor-local-native-join.js +13 -12
- package/dist/runtime/actors/actor-mailbox.js +27 -1
- package/dist/runtime/actors/actor-remote-joiner.js +3 -1
- package/dist/runtime/actors/actor-remote-wire.js +15 -0
- package/dist/runtime/actors/actor-reply.d.ts +4 -0
- package/dist/runtime/actors/actor-reply.js +29 -0
- package/dist/runtime/actors/actor-routed-join-transport.d.ts +6 -2
- package/dist/runtime/actors/actor-routed-json-request.d.ts +2 -0
- package/dist/runtime/actors/actor-runtime-contracts.d.ts +2 -0
- package/dist/runtime/actors/actor-runtime-state.js +2 -20
- package/dist/runtime/actors/actor-source-transfer.d.ts +1 -17
- package/dist/runtime/actors/index.d.ts +8 -3
- package/dist/runtime/actors/index.js +55 -27
- package/dist/runtime/actors/session-disconnected-wire.d.ts +8 -0
- package/dist/runtime/actors/session-disconnected-wire.js +48 -0
- package/dist/runtime/actors/spot-actor-dispatch.js +2 -2
- package/dist/runtime/admission.d.ts +9 -1
- package/dist/runtime/admission.js +56 -23
- package/dist/runtime/application-jobs/application-ingress-record-owner.d.ts +6 -8
- package/dist/runtime/application-jobs/application-ingress-record-owner.js +39 -22
- package/dist/runtime/application-jobs/application-job-queue-scope.d.ts +15 -1
- package/dist/runtime/application-jobs/application-job-queue-scope.js +61 -20
- package/dist/runtime/application-jobs/contracts.d.ts +12 -1
- package/dist/runtime/backend/contracts/index.d.ts +37 -12
- package/dist/runtime/backend/mesh-actor-session-node-adapter.js +2 -2
- package/dist/runtime/backend/mesh-completion-table.d.ts +9 -1
- package/dist/runtime/backend/mesh-completion-table.js +154 -49
- package/dist/runtime/backend/mesh-dispatch-pump.d.ts +28 -1
- package/dist/runtime/backend/mesh-dispatch-pump.js +208 -101
- package/dist/runtime/backend/node/node-backend-adapter-support.d.ts +2 -2
- package/dist/runtime/backend/node/node-backend-adapter-support.js +16 -9
- package/dist/runtime/backend/node/node-dealer-channel-client-transport.d.ts +1 -1
- package/dist/runtime/backend/node/node-dealer-channel-client-transport.js +5 -2
- package/dist/runtime/backend/node/node-raw-binding-port.js +124 -72
- package/dist/runtime/backend/node/node-raw-mesh-backend.d.ts +46 -13
- package/dist/runtime/backend/node/node-raw-mesh-backend.js +181 -164
- package/dist/runtime/backend/node/node-socket-backend-adapter.d.ts +1 -1
- package/dist/runtime/backend/node/node-socket-backend-adapter.js +11 -11
- package/dist/runtime/backend/raw-binding-port.d.ts +2 -2
- package/dist/runtime/backend/runtime-message.d.ts +1 -0
- package/dist/runtime/backend/runtime-message.js +5 -0
- package/dist/runtime/backend/runtime-values.d.ts +1 -0
- package/dist/runtime/backend/runtime-values.js +2 -1
- package/dist/runtime/channels/channel-clients.d.ts +2 -0
- package/dist/runtime/channels/channel-clients.js +75 -23
- package/dist/runtime/channels/channel-dispatch-pipeline.d.ts +25 -5
- package/dist/runtime/channels/channel-dispatch-pipeline.js +111 -56
- package/dist/runtime/channels/channel-dispatch-services.d.ts +1 -0
- package/dist/runtime/channels/channel-dispatch-services.js +45 -0
- package/dist/runtime/channels/channel-dispatchers.d.ts +4 -3
- package/dist/runtime/channels/channel-dispatchers.js +62 -54
- package/dist/runtime/channels/channel-envelope-inspection.d.ts +1 -2
- package/dist/runtime/channels/channel-envelope-inspection.js +1 -16
- package/dist/runtime/channels/channel-envelope.d.ts +2 -0
- package/dist/runtime/channels/channel-envelope.js +146 -28
- package/dist/runtime/channels/channel-outbound-operations.d.ts +2 -2
- package/dist/runtime/channels/channel-outbound-operations.js +8 -8
- package/dist/runtime/channels/channel-runtime-lifecycle.d.ts +4 -3
- package/dist/runtime/channels/channel-runtime-lifecycle.js +19 -24
- package/dist/runtime/channels/channel-runtime-manager.d.ts +9 -8
- package/dist/runtime/channels/channel-runtime-manager.js +16 -16
- package/dist/runtime/channels/channel-transports.d.ts +18 -16
- package/dist/runtime/channels/channel-transports.js +77 -58
- package/dist/runtime/channels/client-server-location-runtime.js +5 -4
- package/dist/runtime/channels/dispatch-error-reporter.d.ts +2 -1
- package/dist/runtime/channels/dispatch-error-reporter.js +2 -1
- package/dist/runtime/channels/fanout-location-runtime.d.ts +1 -1
- package/dist/runtime/channels/fanout-location-runtime.js +3 -3
- package/dist/runtime/channels/local-spot-route-transport.d.ts +1 -1
- package/dist/runtime/channels/local-spot-route-transport.js +2 -1
- package/dist/runtime/channels/router-socket-spot-route-transport.d.ts +2 -2
- package/dist/runtime/channels/router-socket-spot-route-transport.js +4 -4
- package/dist/runtime/channels/source-spot-router.d.ts +2 -2
- package/dist/runtime/channels/source-spot-router.js +4 -4
- package/dist/runtime/channels/spot-node-route-transport.d.ts +2 -2
- package/dist/runtime/channels/spot-node-route-transport.js +4 -4
- package/dist/runtime/channels/spot-route-bridge-transport.d.ts +2 -2
- package/dist/runtime/channels/spot-route-bridge-transport.js +4 -4
- package/dist/runtime/channels/spot-route-dispatch-strategy.d.ts +5 -4
- package/dist/runtime/channels/spot-route-dispatch-strategy.js +18 -18
- package/dist/runtime/diagnostics/flow-context.js +19 -7
- package/dist/runtime/diagnostics/index.js +4 -9
- package/dist/runtime/diagnostics/message-flow.d.ts +8 -0
- package/dist/runtime/diagnostics/message-flow.js +35 -5
- package/dist/runtime/diagnostics/runtime-metrics.d.ts +2 -2
- package/dist/runtime/diagnostics/runtime-metrics.js +10 -8
- package/dist/runtime/execution/index.d.ts +4 -2
- package/dist/runtime/execution/index.js +33 -10
- package/dist/runtime/execution/serial-execution-queue.d.ts +5 -0
- package/dist/runtime/execution/serial-execution-queue.js +22 -2
- package/dist/runtime/execution/state-lane.d.ts +2 -0
- package/dist/runtime/execution/state-lane.js +5 -0
- package/dist/runtime/foundation/actor-join-recovery-codec.js +2 -2
- package/dist/runtime/foundation/durable-service-request.d.ts +14 -0
- package/dist/runtime/foundation/durable-service-request.js +98 -0
- package/dist/runtime/foundation/operation-identity.d.ts +1 -0
- package/dist/runtime/foundation/operation-identity.js +5 -1
- package/dist/runtime/foundation/operation-registry.d.ts +25 -1
- package/dist/runtime/foundation/operation-registry.js +86 -18
- package/dist/runtime/foundation/raw-service-mesh-runtime.d.ts +61 -8
- package/dist/runtime/foundation/raw-service-mesh-runtime.js +486 -266
- package/dist/runtime/foundation/service-liveness-registry.d.ts +12 -1
- package/dist/runtime/foundation/service-liveness-registry.js +38 -0
- package/dist/runtime/foundation/service-mailbox.d.ts +7 -0
- package/dist/runtime/foundation/service-maintenance-runtime.js +1 -6
- package/dist/runtime/foundation/service-relocation-object-owner.d.ts +3 -3
- package/dist/runtime/foundation/service-relocation-object-owner.js +48 -34
- package/dist/runtime/foundation/service-relocation-runtime.d.ts +2 -0
- package/dist/runtime/foundation/service-relocation-runtime.js +20 -4
- package/dist/runtime/foundation/service-runtime-contracts.d.ts +10 -1
- package/dist/runtime/foundation/service-session-binding-ingress-port.d.ts +2 -1
- package/dist/runtime/foundation/service-stateful-registry.d.ts +5 -4
- package/dist/runtime/foundation/service-stateful-registry.js +24 -26
- package/dist/runtime/foundation/service-stateful-runtime.d.ts +75 -9
- package/dist/runtime/foundation/service-stateful-runtime.js +486 -218
- package/dist/runtime/foundation/service-stateful-wire-codec.d.ts +14 -6
- package/dist/runtime/foundation/service-stateful-wire-codec.js +48 -27
- package/dist/runtime/foundation/service-topology-registry.d.ts +12 -2
- package/dist/runtime/foundation/service-topology-registry.js +61 -27
- package/dist/runtime/foundation/service-wire-binary-primitives.d.ts +6 -1
- package/dist/runtime/foundation/service-wire-binary-primitives.js +27 -11
- package/dist/runtime/foundation/service-wire-constants.generated.d.ts +1 -0
- package/dist/runtime/foundation/service-wire-constants.generated.js +1 -0
- package/dist/runtime/foundation/service-wire-m6a-codec.d.ts +13 -3
- package/dist/runtime/foundation/service-wire-m6a-codec.js +189 -78
- package/dist/runtime/handlers/handler-instance-scope.d.ts +8 -0
- package/dist/runtime/handlers/handler-instance-scope.js +54 -11
- package/dist/runtime/host/actor-packet-relay.d.ts +6 -4
- package/dist/runtime/host/actor-packet-relay.js +59 -72
- package/dist/runtime/host/actor-placement-coordinator.js +25 -8
- package/dist/runtime/host/actor-runtime-options-factory.js +2 -2
- package/dist/runtime/host/actor-transfer-runtime.d.ts +7 -31
- package/dist/runtime/host/actor-transfer-runtime.js +85 -331
- package/dist/runtime/host/application-job-queue.d.ts +40 -7
- package/dist/runtime/host/application-job-queue.js +137 -42
- package/dist/runtime/host/entry-actor-runtime.d.ts +1 -0
- package/dist/runtime/host/entry-actor-runtime.js +3 -0
- package/dist/runtime/host/index.d.ts +12 -2
- package/dist/runtime/host/index.js +300 -202
- package/dist/runtime/host/location-runtime-owner.js +2 -6
- package/dist/runtime/host/mesh-router-resolver.d.ts +4 -0
- package/dist/runtime/host/mesh-router-resolver.js +14 -6
- package/dist/runtime/host/remote-bound-session-relay.d.ts +2 -4
- package/dist/runtime/host/remote-bound-session-relay.js +73 -208
- package/dist/runtime/host/route-mesh-runtime.d.ts +2 -2
- package/dist/runtime/host/route-mesh-runtime.js +6 -4
- package/dist/runtime/host/runtime-shutdown.d.ts +1 -0
- package/dist/runtime/host/runtime-shutdown.js +3 -2
- package/dist/runtime/host/service-relocation-control.d.ts +1 -0
- package/dist/runtime/host/service-relocation-control.js +10 -4
- package/dist/runtime/host/service-relocation-host-runtime.d.ts +22 -14
- package/dist/runtime/host/service-relocation-host-runtime.js +754 -599
- package/dist/runtime/host/spot-address-transport.js +3 -2
- package/dist/runtime/host/spot-runtime-options-factory.js +16 -7
- package/dist/runtime/host/user-spot-creation-coordinator.js +33 -84
- package/dist/runtime/locations/actor-location-claims.d.ts +2 -2
- package/dist/runtime/locations/actor-location-claims.js +34 -19
- package/dist/runtime/locations/auto-connect-loop.d.ts +2 -0
- package/dist/runtime/locations/auto-connect-loop.js +22 -14
- package/dist/runtime/locations/auto-connect-reconciler.js +0 -6
- package/dist/runtime/locations/auto-connect-types.d.ts +0 -1
- package/dist/runtime/locations/descriptor-publication.d.ts +4 -0
- package/dist/runtime/locations/descriptor-publication.js +11 -0
- package/dist/runtime/locations/domain-store-contract.d.ts +1 -0
- package/dist/runtime/locations/in-memory-authority-store.d.ts +7 -1
- package/dist/runtime/locations/in-memory-authority-store.js +56 -19
- package/dist/runtime/locations/in-memory-location-store.js +1 -10
- package/dist/runtime/locations/index.d.ts +1 -0
- package/dist/runtime/locations/index.js +1 -0
- package/dist/runtime/locations/lease-tracker.js +1 -6
- package/dist/runtime/locations/lifecycle.d.ts +1 -2
- package/dist/runtime/locations/lifecycle.js +2 -5
- package/dist/runtime/locations/location-store-repository.d.ts +51 -1
- package/dist/runtime/locations/location-store-repository.js +363 -139
- package/dist/runtime/locations/relocation-blob.d.ts +18 -1
- package/dist/runtime/locations/relocation-blob.js +52 -1
- package/dist/runtime/locations/request-source-resolver.d.ts +37 -0
- package/dist/runtime/locations/request-source-resolver.js +80 -0
- package/dist/runtime/locations/resolvers.js +1 -1
- package/dist/runtime/locations/runtime.d.ts +7 -3
- package/dist/runtime/locations/runtime.js +61 -53
- package/dist/runtime/messaging/framework-json-v1.d.ts +4 -6
- package/dist/runtime/messaging/framework-json-v1.js +38 -294
- package/dist/runtime/messaging/packet-name.d.ts +1 -1
- package/dist/runtime/messaging/packet-name.js +8 -24
- package/dist/runtime/messaging/payload-codec.d.ts +7 -1
- package/dist/runtime/messaging/payload-codec.js +7 -6
- package/dist/runtime/messaging/request-result.d.ts +2 -0
- package/dist/runtime/messaging/request-result.js +57 -0
- package/dist/runtime/messaging/submission-result.d.ts +1 -0
- package/dist/runtime/messaging/submission-result.js +5 -2
- package/dist/runtime/protocol/service_wire_codec.generated.d.ts +34 -1
- package/dist/runtime/protocol/service_wire_codec.generated.js +229 -0
- package/dist/runtime/protocol/service_wire_pilot_codec.generated.d.ts +16 -1
- package/dist/runtime/protocol/service_wire_pilot_codec.generated.js +37 -8
- package/dist/runtime/spots/formal-remote-actor-admission-registry.d.ts +7 -2
- package/dist/runtime/spots/formal-remote-actor-admission-registry.js +36 -21
- package/dist/runtime/spots/index.d.ts +21 -11
- package/dist/runtime/spots/index.js +243 -178
- package/dist/runtime/spots/spot-activation-registry.d.ts +4 -2
- package/dist/runtime/spots/spot-activation-registry.js +21 -11
- package/dist/runtime/spots/spot-activation-state.d.ts +1 -1
- package/dist/runtime/spots/spot-activation-state.js +7 -7
- package/dist/runtime/spots/spot-activation.d.ts +7 -3
- package/dist/runtime/spots/spot-activation.js +140 -52
- package/dist/runtime/spots/spot-actor-admission-coordinator.d.ts +1 -0
- package/dist/runtime/spots/spot-actor-admission-coordinator.js +13 -22
- package/dist/runtime/spots/spot-actor-membership.d.ts +0 -1
- package/dist/runtime/spots/spot-actor-membership.js +0 -8
- package/dist/runtime/spots/spot-actor-packet-dispatch.js +33 -8
- package/dist/runtime/spots/spot-actor-packet-drain.js +5 -33
- package/dist/runtime/spots/spot-entry-activation.d.ts +2 -0
- package/dist/runtime/spots/spot-entry-activation.js +20 -11
- package/dist/runtime/spots/spot-handler-registry.d.ts +7 -4
- package/dist/runtime/spots/spot-handler-registry.js +24 -10
- package/dist/runtime/spots/spot-manager-internal-contracts.d.ts +2 -2
- package/dist/runtime/spots/spot-manager-public.js +2 -2
- package/dist/runtime/spots/spot-node-autoconnect.d.ts +2 -1
- package/dist/runtime/spots/spot-node-autoconnect.js +22 -42
- package/dist/runtime/spots/spot-node-runtime-manager.d.ts +19 -2
- package/dist/runtime/spots/spot-node-runtime-manager.js +115 -50
- package/dist/runtime/spots/spot-outbound.d.ts +3 -0
- package/dist/runtime/spots/spot-outbound.js +27 -18
- package/dist/runtime/spots/spot-remote-codec.js +5 -1
- package/dist/runtime/spots/spot-routed-spot-packet-dispatch.d.ts +1 -0
- package/dist/runtime/spots/spot-routed-spot-packet-dispatch.js +1 -1
- package/dist/runtime/spots/spot-runtime-ports.d.ts +1 -1
- package/dist/runtime/spots/spot-serial-executor.d.ts +10 -0
- package/dist/runtime/spots/spot-serial-executor.js +61 -8
- package/dist/runtime/spots/spot-serial-turn-executor.js +19 -2
- package/dist/runtime/spots/spot-subscription-dispatch.js +1 -4
- package/dist/runtime/spots/spot-timer.d.ts +57 -5
- package/dist/runtime/spots/spot-timer.js +288 -103
- package/dist/runtime/streams/actor-session-binding-registry.d.ts +42 -11
- package/dist/runtime/streams/actor-session-binding-registry.js +165 -48
- package/dist/runtime/streams/actor-session-binding-runtime-owner.d.ts +8 -4
- package/dist/runtime/streams/bound-actor-relay-sender.d.ts +2 -1
- package/dist/runtime/streams/bound-actor-relay-sender.js +15 -8
- package/dist/runtime/streams/bound-session-service.d.ts +1 -1
- package/dist/runtime/streams/bound-session-service.js +6 -11
- package/dist/runtime/streams/index.d.ts +3 -2
- package/dist/runtime/streams/index.js +6 -4
- package/dist/runtime/streams/managed-stream.js +3 -2
- package/dist/runtime/streams/native-fallback-bound-session.js +8 -73
- package/dist/runtime/streams/session-actor-coordinator.d.ts +2 -8
- package/dist/runtime/streams/session-actor-coordinator.js +15 -32
- package/dist/runtime/streams/stream-binding-runtime-ports.d.ts +3 -10
- package/dist/runtime/streams/stream-session-runtime.d.ts +1 -1
- package/dist/runtime/streams/stream-session-runtime.js +14 -31
- package/dist/runtime/workers/index.js +1 -1
- package/package.json +3 -3
- package/src/contracts/Actors/ZLinkActorClient.ts +2 -1
- package/src/contracts/Channels/Calls.ts +2 -1
- package/src/contracts/Common/ZLinkEncodedPayload.ts +24 -4
- package/src/contracts/Common/ZLinkMessageMetadata.ts +13 -8
- package/src/contracts/Common/encoded-payload-storage.ts +6 -3
- package/src/contracts/Configuration/Builders.ts +4 -1
- package/src/contracts/Configuration/RegistrationBuilderPolicy.ts +7 -2
- package/src/contracts/Configuration/RegistrationBuilders.ts +6 -2
- package/src/contracts/Configuration/RegistrationTypes.ts +1 -0
- package/src/contracts/Dispatch/ZLinkDispatchOptions.ts +2 -1
- package/src/contracts/Handlers/Attributes.ts +14 -21
- package/src/contracts/Handlers/JsonContract.ts +8 -216
- package/src/contracts/Locations/Rows.ts +2 -0
- package/src/contracts/Spots/Contracts.ts +10 -1
- package/src/contracts/Spots/ZLinkSpot.ts +3 -3
- package/src/nest-integration.ts +1 -0
- package/src/runtime/abort.ts +12 -0
- package/src/runtime/actors/actor-authority-publication.ts +3 -2
- package/src/runtime/actors/actor-client.ts +100 -85
- package/src/runtime/actors/actor-context.ts +49 -9
- package/src/runtime/actors/actor-handoff.ts +291 -110
- package/src/runtime/actors/actor-join-relocation.ts +3 -0
- package/src/runtime/actors/actor-local-native-join.ts +21 -26
- package/src/runtime/actors/actor-mailbox.ts +40 -2
- package/src/runtime/actors/actor-remote-joiner.ts +6 -1
- package/src/runtime/actors/actor-remote-wire.ts +17 -0
- package/src/runtime/actors/actor-reply.ts +42 -0
- package/src/runtime/actors/actor-routed-join-transport.ts +14 -4
- package/src/runtime/actors/actor-routed-json-request.ts +10 -2
- package/src/runtime/actors/actor-runtime-contracts.ts +2 -0
- package/src/runtime/actors/actor-runtime-state.ts +2 -20
- package/src/runtime/actors/actor-source-transfer.ts +1 -34
- package/src/runtime/actors/index.ts +60 -32
- package/src/runtime/actors/session-disconnected-wire.ts +66 -0
- package/src/runtime/actors/spot-actor-dispatch.ts +4 -2
- package/src/runtime/admission.ts +69 -21
- package/src/runtime/application-jobs/application-ingress-record-owner.ts +41 -25
- package/src/runtime/application-jobs/application-job-queue-scope.ts +83 -22
- package/src/runtime/application-jobs/contracts.ts +16 -1
- package/src/runtime/backend/contracts/index.ts +92 -18
- package/src/runtime/backend/mesh-actor-session-node-adapter.ts +5 -3
- package/src/runtime/backend/mesh-completion-table.ts +160 -57
- package/src/runtime/backend/mesh-dispatch-pump.ts +237 -108
- package/src/runtime/backend/node/node-backend-adapter-support.ts +17 -8
- package/src/runtime/backend/node/node-dealer-channel-client-transport.ts +12 -2
- package/src/runtime/backend/node/node-raw-binding-port.ts +148 -85
- package/src/runtime/backend/node/node-raw-mesh-backend.ts +315 -201
- package/src/runtime/backend/node/node-socket-backend-adapter.ts +26 -11
- package/src/runtime/backend/raw-binding-port.ts +7 -2
- package/src/runtime/backend/runtime-message.ts +6 -0
- package/src/runtime/backend/runtime-values.ts +1 -0
- package/src/runtime/channels/channel-clients.ts +132 -58
- package/src/runtime/channels/channel-dispatch-pipeline.ts +198 -114
- package/src/runtime/channels/channel-dispatch-services.ts +69 -1
- package/src/runtime/channels/channel-dispatchers.ts +136 -90
- package/src/runtime/channels/channel-envelope-inspection.ts +2 -16
- package/src/runtime/channels/channel-envelope.ts +225 -31
- package/src/runtime/channels/channel-outbound-operations.ts +22 -8
- package/src/runtime/channels/channel-runtime-lifecycle.ts +13 -13
- package/src/runtime/channels/channel-runtime-manager.ts +41 -17
- package/src/runtime/channels/channel-transports.ts +171 -112
- package/src/runtime/channels/client-server-location-runtime.ts +11 -10
- package/src/runtime/channels/dispatch-error-reporter.ts +4 -2
- package/src/runtime/channels/fanout-location-runtime.ts +17 -9
- package/src/runtime/channels/local-spot-route-transport.ts +3 -1
- package/src/runtime/channels/router-socket-spot-route-transport.ts +13 -4
- package/src/runtime/channels/source-spot-router.ts +8 -4
- package/src/runtime/channels/spot-node-route-transport.ts +8 -4
- package/src/runtime/channels/spot-route-bridge-transport.ts +6 -4
- package/src/runtime/channels/spot-route-dispatch-strategy.ts +47 -18
- package/src/runtime/diagnostics/flow-context.ts +20 -7
- package/src/runtime/diagnostics/index.ts +1 -7
- package/src/runtime/diagnostics/message-flow.ts +47 -9
- package/src/runtime/diagnostics/runtime-metrics.ts +12 -10
- package/src/runtime/execution/index.ts +40 -14
- package/src/runtime/execution/serial-execution-queue.ts +33 -4
- package/src/runtime/execution/state-lane.ts +7 -0
- package/src/runtime/foundation/actor-join-recovery-codec.ts +2 -2
- package/src/runtime/foundation/durable-service-request.ts +137 -0
- package/src/runtime/foundation/operation-identity.ts +5 -1
- package/src/runtime/foundation/operation-registry.ts +98 -20
- package/src/runtime/foundation/raw-service-mesh-runtime.ts +704 -336
- package/src/runtime/foundation/service-liveness-registry.ts +39 -0
- package/src/runtime/foundation/service-mailbox.ts +8 -0
- package/src/runtime/foundation/service-maintenance-runtime.ts +1 -8
- package/src/runtime/foundation/service-relocation-object-owner.ts +55 -36
- package/src/runtime/foundation/service-relocation-runtime.ts +25 -4
- package/src/runtime/foundation/service-runtime-contracts.ts +19 -2
- package/src/runtime/foundation/service-session-binding-ingress-port.ts +2 -1
- package/src/runtime/foundation/service-stateful-registry.ts +38 -35
- package/src/runtime/foundation/service-stateful-runtime.ts +732 -275
- package/src/runtime/foundation/service-stateful-wire-codec.ts +49 -16
- package/src/runtime/foundation/service-topology-registry.ts +91 -36
- package/src/runtime/foundation/service-wire-binary-primitives.ts +35 -12
- package/src/runtime/foundation/service-wire-constants.generated.ts +1 -0
- package/src/runtime/foundation/service-wire-m6a-codec.ts +231 -76
- package/src/runtime/handlers/handler-instance-scope.ts +67 -16
- package/src/runtime/host/actor-packet-relay.ts +113 -94
- package/src/runtime/host/actor-placement-coordinator.ts +31 -8
- package/src/runtime/host/actor-runtime-options-factory.ts +13 -2
- package/src/runtime/host/actor-transfer-runtime.ts +104 -430
- package/src/runtime/host/application-job-queue.ts +160 -41
- package/src/runtime/host/entry-actor-runtime.ts +4 -0
- package/src/runtime/host/index.ts +473 -271
- package/src/runtime/host/location-runtime-owner.ts +2 -6
- package/src/runtime/host/mesh-router-resolver.ts +13 -5
- package/src/runtime/host/remote-bound-session-relay.ts +88 -271
- package/src/runtime/host/route-mesh-runtime.ts +12 -6
- package/src/runtime/host/runtime-shutdown.ts +15 -4
- package/src/runtime/host/service-relocation-control.ts +11 -5
- package/src/runtime/host/service-relocation-host-runtime.ts +1092 -759
- package/src/runtime/host/spot-address-transport.ts +4 -2
- package/src/runtime/host/spot-runtime-options-factory.ts +20 -7
- package/src/runtime/host/user-spot-creation-coordinator.ts +41 -100
- package/src/runtime/locations/actor-location-claims.ts +52 -30
- package/src/runtime/locations/auto-connect-loop.ts +22 -14
- package/src/runtime/locations/auto-connect-reconciler.ts +0 -6
- package/src/runtime/locations/auto-connect-types.ts +0 -1
- package/src/runtime/locations/descriptor-publication.ts +7 -0
- package/src/runtime/locations/domain-store-contract.ts +5 -0
- package/src/runtime/locations/in-memory-authority-store.ts +85 -23
- package/src/runtime/locations/in-memory-location-store.ts +1 -12
- package/src/runtime/locations/index.ts +1 -0
- package/src/runtime/locations/lease-tracker.ts +2 -9
- package/src/runtime/locations/lifecycle.ts +8 -26
- package/src/runtime/locations/location-store-repository.ts +628 -152
- package/src/runtime/locations/relocation-blob.ts +75 -1
- package/src/runtime/locations/request-source-resolver.ts +138 -0
- package/src/runtime/locations/resolvers.ts +2 -2
- package/src/runtime/locations/runtime.ts +98 -64
- package/src/runtime/messaging/framework-json-v1.ts +5 -325
- package/src/runtime/messaging/packet-name.ts +5 -25
- package/src/runtime/messaging/payload-codec.ts +8 -11
- package/src/runtime/messaging/request-result.ts +62 -0
- package/src/runtime/messaging/submission-result.ts +5 -1
- package/src/runtime/protocol/service_wire_codec.generated.ts +218 -5
- package/src/runtime/protocol/service_wire_pilot_codec.generated.ts +16 -13
- package/src/runtime/spots/formal-remote-actor-admission-registry.ts +46 -25
- package/src/runtime/spots/index.ts +389 -283
- package/src/runtime/spots/spot-activation-registry.ts +25 -13
- package/src/runtime/spots/spot-activation-state.ts +12 -19
- package/src/runtime/spots/spot-activation.ts +198 -96
- package/src/runtime/spots/spot-actor-admission-coordinator.ts +25 -55
- package/src/runtime/spots/spot-actor-membership.ts +0 -15
- package/src/runtime/spots/spot-actor-packet-dispatch.ts +56 -11
- package/src/runtime/spots/spot-actor-packet-drain.ts +9 -52
- package/src/runtime/spots/spot-entry-activation.ts +33 -21
- package/src/runtime/spots/spot-handler-registry.ts +56 -12
- package/src/runtime/spots/spot-manager-internal-contracts.ts +2 -2
- package/src/runtime/spots/spot-manager-public.ts +2 -2
- package/src/runtime/spots/spot-node-autoconnect.ts +28 -47
- package/src/runtime/spots/spot-node-runtime-manager.ts +197 -67
- package/src/runtime/spots/spot-outbound.ts +39 -19
- package/src/runtime/spots/spot-remote-codec.ts +9 -2
- package/src/runtime/spots/spot-routed-spot-packet-dispatch.ts +2 -1
- package/src/runtime/spots/spot-runtime-ports.ts +1 -1
- package/src/runtime/spots/spot-serial-executor.ts +97 -25
- package/src/runtime/spots/spot-serial-turn-executor.ts +22 -3
- package/src/runtime/spots/spot-subscription-dispatch.ts +1 -4
- package/src/runtime/spots/spot-timer.ts +418 -158
- package/src/runtime/streams/actor-session-binding-registry.ts +236 -64
- package/src/runtime/streams/actor-session-binding-runtime-owner.ts +16 -8
- package/src/runtime/streams/bound-actor-relay-sender.ts +23 -9
- package/src/runtime/streams/bound-session-service.ts +7 -10
- package/src/runtime/streams/index.ts +12 -6
- package/src/runtime/streams/managed-stream.ts +4 -2
- package/src/runtime/streams/native-fallback-bound-session.ts +14 -103
- package/src/runtime/streams/session-actor-coordinator.ts +39 -88
- package/src/runtime/streams/stream-binding-runtime-ports.ts +3 -9
- package/src/runtime/streams/stream-session-runtime.ts +13 -34
- package/src/runtime/workers/index.ts +1 -1
|
@@ -137,6 +137,9 @@ exports.encodeRelocationPhase = encodeRelocationPhase;
|
|
|
137
137
|
exports.enumWireSourceCleanupState = enumWireSourceCleanupState;
|
|
138
138
|
exports.decodeSourceCleanupState = decodeSourceCleanupState;
|
|
139
139
|
exports.encodeSourceCleanupState = encodeSourceCleanupState;
|
|
140
|
+
exports.enumWireSessionSealResult = enumWireSessionSealResult;
|
|
141
|
+
exports.decodeSessionSealResult = decodeSessionSealResult;
|
|
142
|
+
exports.encodeSessionSealResult = encodeSessionSealResult;
|
|
140
143
|
exports.enumWireReplyRelayAckStatus = enumWireReplyRelayAckStatus;
|
|
141
144
|
exports.decodeReplyRelayAckStatus = decodeReplyRelayAckStatus;
|
|
142
145
|
exports.encodeReplyRelayAckStatus = encodeReplyRelayAckStatus;
|
|
@@ -351,6 +354,10 @@ exports.decodeRelocationPendingTimerTick = decodeRelocationPendingTimerTick;
|
|
|
351
354
|
exports.encodeRelocationPendingTimerTick = encodeRelocationPendingTimerTick;
|
|
352
355
|
exports.decodeRelocationPendingTimerTickVector = decodeRelocationPendingTimerTickVector;
|
|
353
356
|
exports.encodeRelocationPendingTimerTickVector = encodeRelocationPendingTimerTickVector;
|
|
357
|
+
exports.decodeRelocationSessionBinding = decodeRelocationSessionBinding;
|
|
358
|
+
exports.encodeRelocationSessionBinding = encodeRelocationSessionBinding;
|
|
359
|
+
exports.decodeRelocationSessionBindingVector = decodeRelocationSessionBindingVector;
|
|
360
|
+
exports.encodeRelocationSessionBindingVector = encodeRelocationSessionBindingVector;
|
|
354
361
|
exports.decodeRelocationEnvelopeV1 = decodeRelocationEnvelopeV1;
|
|
355
362
|
exports.encodeRelocationEnvelopeV1 = encodeRelocationEnvelopeV1;
|
|
356
363
|
exports.decodeHelloCommand = decodeHelloCommand;
|
|
@@ -473,6 +480,9 @@ exports.validateRelocationStateCommandRuntimePredicates = validateRelocationStat
|
|
|
473
480
|
exports.decodeRelocationFailedCommand = decodeRelocationFailedCommand;
|
|
474
481
|
exports.encodeRelocationFailedCommand = encodeRelocationFailedCommand;
|
|
475
482
|
exports.validateRelocationFailedCommandRuntimePredicates = validateRelocationFailedCommandRuntimePredicates;
|
|
483
|
+
exports.decodeBoundSessionCloseCommand = decodeBoundSessionCloseCommand;
|
|
484
|
+
exports.encodeBoundSessionCloseCommand = encodeBoundSessionCloseCommand;
|
|
485
|
+
exports.validateBoundSessionCloseCommandRuntimePredicates = validateBoundSessionCloseCommandRuntimePredicates;
|
|
476
486
|
exports.decodeAuthorityPayloadV1DurableFormat = decodeAuthorityPayloadV1DurableFormat;
|
|
477
487
|
exports.encodeAuthorityPayloadV1DurableFormat = encodeAuthorityPayloadV1DurableFormat;
|
|
478
488
|
exports.decodeInstanceActivationRecoveryV1DurableFormat = decodeInstanceActivationRecoveryV1DurableFormat;
|
|
@@ -2717,6 +2727,32 @@ function writeSourceCleanupState(input, writer, context, enclosing, flags) {
|
|
|
2717
2727
|
}
|
|
2718
2728
|
function decodeSourceCleanupState(bytes, context) { const reader = new Reader(bytes); const value = readSourceCleanupState(reader, context, {}, 0); reader.done("source-cleanup-state"); return value; }
|
|
2719
2729
|
function encodeSourceCleanupState(value, context) { const writer = new Writer(); writeSourceCleanupState(value, writer, context, {}, 0); return writer.result(); }
|
|
2730
|
+
function enumWireSessionSealResult(value) {
|
|
2731
|
+
switch (value) {
|
|
2732
|
+
case "sealed": return 1;
|
|
2733
|
+
case "bindingAbsent": return 2;
|
|
2734
|
+
}
|
|
2735
|
+
}
|
|
2736
|
+
function readSessionSealResult(reader, context, enclosing, flags) {
|
|
2737
|
+
void context;
|
|
2738
|
+
void enclosing;
|
|
2739
|
+
void flags;
|
|
2740
|
+
const raw = reader.u(1);
|
|
2741
|
+
switch (Number(raw)) {
|
|
2742
|
+
case 1: return "sealed";
|
|
2743
|
+
case 2: return "bindingAbsent";
|
|
2744
|
+
default: fail("session-seal-result enum");
|
|
2745
|
+
}
|
|
2746
|
+
}
|
|
2747
|
+
function writeSessionSealResult(input, writer, context, enclosing, flags) {
|
|
2748
|
+
void context;
|
|
2749
|
+
void enclosing;
|
|
2750
|
+
void flags;
|
|
2751
|
+
const value = input;
|
|
2752
|
+
writer.u(numeric(enumWireSessionSealResult(value)), 1);
|
|
2753
|
+
}
|
|
2754
|
+
function decodeSessionSealResult(bytes, context) { const reader = new Reader(bytes); const value = readSessionSealResult(reader, context, {}, 0); reader.done("session-seal-result"); return value; }
|
|
2755
|
+
function encodeSessionSealResult(value, context) { const writer = new Writer(); writeSessionSealResult(value, writer, context, {}, 0); return writer.result(); }
|
|
2720
2756
|
function enumWireReplyRelayAckStatus(value) {
|
|
2721
2757
|
switch (value) {
|
|
2722
2758
|
case "terminalReceived": return 1;
|
|
@@ -8487,6 +8523,141 @@ function writeRelocationPendingTimerTickVector(input, writer, context, enclosing
|
|
|
8487
8523
|
}
|
|
8488
8524
|
function decodeRelocationPendingTimerTickVector(bytes, context) { const reader = new Reader(bytes); const value = readRelocationPendingTimerTickVector(reader, context, {}, 0); reader.done("relocation-pending-timer-tick-vector"); return value; }
|
|
8489
8525
|
function encodeRelocationPendingTimerTickVector(value, context) { const writer = new Writer(); writeRelocationPendingTimerTickVector(value, writer, context, {}, 0); return writer.result(); }
|
|
8526
|
+
function readRelocationSessionBinding(reader, context, enclosing, flags) {
|
|
8527
|
+
void context;
|
|
8528
|
+
void enclosing;
|
|
8529
|
+
void flags;
|
|
8530
|
+
const value = {};
|
|
8531
|
+
value["participantId"] = readNonzeroU64(reader, context, value, flags);
|
|
8532
|
+
value["sessionOwnerNodeRid"] = readRid(reader, context, value, flags);
|
|
8533
|
+
value["sessionOwnerNodeGeneration"] = readNonzeroU64(reader, context, value, flags);
|
|
8534
|
+
value["sessionOwnerId"] = readText8(reader, context, value, flags);
|
|
8535
|
+
value["sessionOwnerLeaseGeneration"] = readNonzeroU64(reader, context, value, flags);
|
|
8536
|
+
value["sessionRid"] = readRid(reader, context, value, flags);
|
|
8537
|
+
value["bindingGeneration"] = readNonzeroU64(reader, context, value, flags);
|
|
8538
|
+
return value;
|
|
8539
|
+
}
|
|
8540
|
+
function* readIncrementalRelocationSessionBinding(reader, context, enclosing, flags) {
|
|
8541
|
+
void context;
|
|
8542
|
+
void enclosing;
|
|
8543
|
+
void flags;
|
|
8544
|
+
const value = {};
|
|
8545
|
+
value["participantId"] = yield* readIncrementalNonzeroU64(reader, context, value, flags);
|
|
8546
|
+
value["sessionOwnerNodeRid"] = yield* readIncrementalRid(reader, context, value, flags);
|
|
8547
|
+
value["sessionOwnerNodeGeneration"] = yield* readIncrementalNonzeroU64(reader, context, value, flags);
|
|
8548
|
+
value["sessionOwnerId"] = yield* readIncrementalText8(reader, context, value, flags);
|
|
8549
|
+
value["sessionOwnerLeaseGeneration"] = yield* readIncrementalNonzeroU64(reader, context, value, flags);
|
|
8550
|
+
value["sessionRid"] = yield* readIncrementalRid(reader, context, value, flags);
|
|
8551
|
+
value["bindingGeneration"] = yield* readIncrementalNonzeroU64(reader, context, value, flags);
|
|
8552
|
+
return value;
|
|
8553
|
+
}
|
|
8554
|
+
function writeRelocationSessionBinding(input, writer, context, enclosing, flags) {
|
|
8555
|
+
void context;
|
|
8556
|
+
void enclosing;
|
|
8557
|
+
void flags;
|
|
8558
|
+
const value = input;
|
|
8559
|
+
if (value["participantId"] === undefined)
|
|
8560
|
+
fail("participantId required");
|
|
8561
|
+
writeNonzeroU64(numeric(value["participantId"]), writer, context, value, flags);
|
|
8562
|
+
if (value["sessionOwnerNodeRid"] === undefined)
|
|
8563
|
+
fail("sessionOwnerNodeRid required");
|
|
8564
|
+
writeRid(value["sessionOwnerNodeRid"], writer, context, value, flags);
|
|
8565
|
+
if (value["sessionOwnerNodeGeneration"] === undefined)
|
|
8566
|
+
fail("sessionOwnerNodeGeneration required");
|
|
8567
|
+
writeNonzeroU64(numeric(value["sessionOwnerNodeGeneration"]), writer, context, value, flags);
|
|
8568
|
+
if (value["sessionOwnerId"] === undefined)
|
|
8569
|
+
fail("sessionOwnerId required");
|
|
8570
|
+
writeText8(value["sessionOwnerId"], writer, context, value, flags);
|
|
8571
|
+
if (value["sessionOwnerLeaseGeneration"] === undefined)
|
|
8572
|
+
fail("sessionOwnerLeaseGeneration required");
|
|
8573
|
+
writeNonzeroU64(numeric(value["sessionOwnerLeaseGeneration"]), writer, context, value, flags);
|
|
8574
|
+
if (value["sessionRid"] === undefined)
|
|
8575
|
+
fail("sessionRid required");
|
|
8576
|
+
writeRid(value["sessionRid"], writer, context, value, flags);
|
|
8577
|
+
if (value["bindingGeneration"] === undefined)
|
|
8578
|
+
fail("bindingGeneration required");
|
|
8579
|
+
writeNonzeroU64(numeric(value["bindingGeneration"]), writer, context, value, flags);
|
|
8580
|
+
}
|
|
8581
|
+
function decodeRelocationSessionBinding(bytes, context) { const reader = new Reader(bytes); const value = readRelocationSessionBinding(reader, context, {}, 0); reader.done("relocation-session-binding"); return value; }
|
|
8582
|
+
function encodeRelocationSessionBinding(value, context) { const writer = new Writer(); writeRelocationSessionBinding(value, writer, context, {}, 0); return writer.result(); }
|
|
8583
|
+
function readRelocationSessionBindingVector(reader, context, enclosing, flags) {
|
|
8584
|
+
void context;
|
|
8585
|
+
void enclosing;
|
|
8586
|
+
void flags;
|
|
8587
|
+
const count = Number(readU32(reader, context, enclosing, flags));
|
|
8588
|
+
if (count > 1024)
|
|
8589
|
+
fail("relocation-session-binding-vector count");
|
|
8590
|
+
const value = Array.from({ length: count }, () => readRelocationSessionBinding(reader, context, enclosing, flags));
|
|
8591
|
+
try {
|
|
8592
|
+
for (let index = 1; index < value.length; ++index)
|
|
8593
|
+
if (compareResults([compareBigint(numeric(value[index - 1]["participantId"]), numeric(value[index]["participantId"]))]) >= 0)
|
|
8594
|
+
fail("relocation-session-binding-vector sorted");
|
|
8595
|
+
}
|
|
8596
|
+
catch (error) {
|
|
8597
|
+
if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError)
|
|
8598
|
+
throw error;
|
|
8599
|
+
if (error instanceof RangeError)
|
|
8600
|
+
capacityFail("relocation-session-binding-vector constraint capacity");
|
|
8601
|
+
throw error;
|
|
8602
|
+
}
|
|
8603
|
+
return value;
|
|
8604
|
+
}
|
|
8605
|
+
function* readIncrementalRelocationSessionBindingVector(reader, context, enclosing, flags) {
|
|
8606
|
+
void context;
|
|
8607
|
+
void enclosing;
|
|
8608
|
+
void flags;
|
|
8609
|
+
const count = Number(yield* readIncrementalU32(reader, context, enclosing, flags));
|
|
8610
|
+
if (count > 1024)
|
|
8611
|
+
fail("relocation-session-binding-vector count");
|
|
8612
|
+
const value = [];
|
|
8613
|
+
for (let index = 0; index < count; ++index) {
|
|
8614
|
+
const item = yield* readIncrementalRelocationSessionBinding(reader, context, enclosing, flags);
|
|
8615
|
+
try {
|
|
8616
|
+
value.push(item);
|
|
8617
|
+
}
|
|
8618
|
+
catch {
|
|
8619
|
+
capacityFail("relocation-session-binding-vector capacity");
|
|
8620
|
+
}
|
|
8621
|
+
}
|
|
8622
|
+
try {
|
|
8623
|
+
for (let index = 1; index < value.length; ++index)
|
|
8624
|
+
if (compareResults([compareBigint(numeric(value[index - 1]["participantId"]), numeric(value[index]["participantId"]))]) >= 0)
|
|
8625
|
+
fail("relocation-session-binding-vector sorted");
|
|
8626
|
+
}
|
|
8627
|
+
catch (error) {
|
|
8628
|
+
if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError)
|
|
8629
|
+
throw error;
|
|
8630
|
+
if (error instanceof RangeError)
|
|
8631
|
+
capacityFail("relocation-session-binding-vector constraint capacity");
|
|
8632
|
+
throw error;
|
|
8633
|
+
}
|
|
8634
|
+
return value;
|
|
8635
|
+
}
|
|
8636
|
+
function writeRelocationSessionBindingVector(input, writer, context, enclosing, flags) {
|
|
8637
|
+
void context;
|
|
8638
|
+
void enclosing;
|
|
8639
|
+
void flags;
|
|
8640
|
+
const value = input;
|
|
8641
|
+
if (!Array.isArray(value) || value.length > 1024)
|
|
8642
|
+
fail("relocation-session-binding-vector count");
|
|
8643
|
+
try {
|
|
8644
|
+
for (let index = 1; index < value.length; ++index)
|
|
8645
|
+
if (compareResults([compareBigint(numeric(value[index - 1]["participantId"]), numeric(value[index]["participantId"]))]) >= 0)
|
|
8646
|
+
fail("relocation-session-binding-vector sorted");
|
|
8647
|
+
}
|
|
8648
|
+
catch (error) {
|
|
8649
|
+
if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError)
|
|
8650
|
+
throw error;
|
|
8651
|
+
if (error instanceof RangeError)
|
|
8652
|
+
capacityFail("relocation-session-binding-vector constraint capacity");
|
|
8653
|
+
throw error;
|
|
8654
|
+
}
|
|
8655
|
+
writeU32(value.length, writer, context, enclosing, flags);
|
|
8656
|
+
for (const item of value)
|
|
8657
|
+
writeRelocationSessionBinding(item, writer, context, enclosing, flags);
|
|
8658
|
+
}
|
|
8659
|
+
function decodeRelocationSessionBindingVector(bytes, context) { const reader = new Reader(bytes); const value = readRelocationSessionBindingVector(reader, context, {}, 0); reader.done("relocation-session-binding-vector"); return value; }
|
|
8660
|
+
function encodeRelocationSessionBindingVector(value, context) { const writer = new Writer(); writeRelocationSessionBindingVector(value, writer, context, {}, 0); return writer.result(); }
|
|
8490
8661
|
function readRelocationEnvelopeV1(reader, context, enclosing, flags) {
|
|
8491
8662
|
void context;
|
|
8492
8663
|
void enclosing;
|
|
@@ -8499,6 +8670,7 @@ function readRelocationEnvelopeV1(reader, context, enclosing, flags) {
|
|
|
8499
8670
|
value["savedWork"] = readSavedWorkVector(reader, context, value, flags);
|
|
8500
8671
|
value["timerRegistrations"] = readRelocationTimerRegistrationVector(reader, context, value, flags);
|
|
8501
8672
|
value["pendingTimerTicks"] = readRelocationPendingTimerTickVector(reader, context, value, flags);
|
|
8673
|
+
value["sessionBindings"] = readRelocationSessionBindingVector(reader, context, value, flags);
|
|
8502
8674
|
return value;
|
|
8503
8675
|
}
|
|
8504
8676
|
function* readIncrementalRelocationEnvelopeV1(reader, context, enclosing, flags) {
|
|
@@ -8513,6 +8685,7 @@ function* readIncrementalRelocationEnvelopeV1(reader, context, enclosing, flags)
|
|
|
8513
8685
|
value["savedWork"] = yield* readIncrementalSavedWorkVector(reader, context, value, flags);
|
|
8514
8686
|
value["timerRegistrations"] = yield* readIncrementalRelocationTimerRegistrationVector(reader, context, value, flags);
|
|
8515
8687
|
value["pendingTimerTicks"] = yield* readIncrementalRelocationPendingTimerTickVector(reader, context, value, flags);
|
|
8688
|
+
value["sessionBindings"] = yield* readIncrementalRelocationSessionBindingVector(reader, context, value, flags);
|
|
8516
8689
|
return value;
|
|
8517
8690
|
}
|
|
8518
8691
|
function writeRelocationEnvelopeV1(input, writer, context, enclosing, flags) {
|
|
@@ -8541,6 +8714,9 @@ function writeRelocationEnvelopeV1(input, writer, context, enclosing, flags) {
|
|
|
8541
8714
|
if (value["pendingTimerTicks"] === undefined)
|
|
8542
8715
|
fail("pendingTimerTicks required");
|
|
8543
8716
|
writeRelocationPendingTimerTickVector(value["pendingTimerTicks"], writer, context, value, flags);
|
|
8717
|
+
if (value["sessionBindings"] === undefined)
|
|
8718
|
+
fail("sessionBindings required");
|
|
8719
|
+
writeRelocationSessionBindingVector(value["sessionBindings"], writer, context, value, flags);
|
|
8544
8720
|
}
|
|
8545
8721
|
function decodeRelocationEnvelopeV1(bytes, context) { const reader = new Reader(bytes); const value = readRelocationEnvelopeV1(reader, context, {}, 0); reader.done("relocation-envelope-v1"); return value; }
|
|
8546
8722
|
function encodeRelocationEnvelopeV1(value, context) { const writer = new Writer(); writeRelocationEnvelopeV1(value, writer, context, {}, 0); return writer.result(); }
|
|
@@ -9880,6 +10056,7 @@ function decodeRelocationPrepareCommand(frames, context) {
|
|
|
9880
10056
|
value["payloadChunkCount"] = readRelocationChunkCount(reader, context, value, flags);
|
|
9881
10057
|
value["payloadChecksumCrc32c"] = readU32(reader, context, value, flags);
|
|
9882
10058
|
value["applicationVersion"] = readApplicationVersion(reader, context, value, flags);
|
|
10059
|
+
value["deadlineUnixMs"] = readNonzeroU64(reader, context, value, flags);
|
|
9883
10060
|
reader.done("relocationPrepare");
|
|
9884
10061
|
let frameIndex = 1;
|
|
9885
10062
|
if (frameIndex !== frames.length)
|
|
@@ -9927,6 +10104,9 @@ function encodeRelocationPrepareCommand(value, context) {
|
|
|
9927
10104
|
if (value["applicationVersion"] === undefined)
|
|
9928
10105
|
fail("applicationVersion required");
|
|
9929
10106
|
writeApplicationVersion(numeric(value["applicationVersion"]), writer, context, value, value.flags);
|
|
10107
|
+
if (value["deadlineUnixMs"] === undefined)
|
|
10108
|
+
fail("deadlineUnixMs required");
|
|
10109
|
+
writeNonzeroU64(numeric(value["deadlineUnixMs"]), writer, context, value, value.flags);
|
|
9930
10110
|
const frames = [writer.result()];
|
|
9931
10111
|
return frames;
|
|
9932
10112
|
}
|
|
@@ -9951,6 +10131,8 @@ function decodeSessionRelocationSealCommand(frames, context) {
|
|
|
9951
10131
|
value["sessionOwnerLeaseGeneration"] = readNonzeroU64(reader, context, value, flags);
|
|
9952
10132
|
value["sessionRid"] = readRid(reader, context, value, flags);
|
|
9953
10133
|
value["bindingGeneration"] = readNonzeroU64(reader, context, value, flags);
|
|
10134
|
+
value["targetNodeRid"] = readRid(reader, context, value, flags);
|
|
10135
|
+
value["targetNodeGeneration"] = readNonzeroU64(reader, context, value, flags);
|
|
9954
10136
|
reader.done("sessionRelocationSeal");
|
|
9955
10137
|
let frameIndex = 1;
|
|
9956
10138
|
if (frameIndex !== frames.length)
|
|
@@ -9992,6 +10174,12 @@ function encodeSessionRelocationSealCommand(value, context) {
|
|
|
9992
10174
|
if (value["bindingGeneration"] === undefined)
|
|
9993
10175
|
fail("bindingGeneration required");
|
|
9994
10176
|
writeNonzeroU64(numeric(value["bindingGeneration"]), writer, context, value, value.flags);
|
|
10177
|
+
if (value["targetNodeRid"] === undefined)
|
|
10178
|
+
fail("targetNodeRid required");
|
|
10179
|
+
writeRid(value["targetNodeRid"], writer, context, value, value.flags);
|
|
10180
|
+
if (value["targetNodeGeneration"] === undefined)
|
|
10181
|
+
fail("targetNodeGeneration required");
|
|
10182
|
+
writeNonzeroU64(numeric(value["targetNodeGeneration"]), writer, context, value, value.flags);
|
|
9995
10183
|
const frames = [writer.result()];
|
|
9996
10184
|
return frames;
|
|
9997
10185
|
}
|
|
@@ -10015,6 +10203,7 @@ function decodeSessionRelocationSealedCommand(frames, context) {
|
|
|
10015
10203
|
value["sessionOwnerLeaseGeneration"] = readNonzeroU64(reader, context, value, flags);
|
|
10016
10204
|
value["sessionRid"] = readRid(reader, context, value, flags);
|
|
10017
10205
|
value["bindingGeneration"] = readNonzeroU64(reader, context, value, flags);
|
|
10206
|
+
value["sealResult"] = readSessionSealResult(reader, context, value, flags);
|
|
10018
10207
|
reader.done("sessionRelocationSealed");
|
|
10019
10208
|
let frameIndex = 1;
|
|
10020
10209
|
if (frameIndex !== frames.length)
|
|
@@ -10053,6 +10242,9 @@ function encodeSessionRelocationSealedCommand(value, context) {
|
|
|
10053
10242
|
if (value["bindingGeneration"] === undefined)
|
|
10054
10243
|
fail("bindingGeneration required");
|
|
10055
10244
|
writeNonzeroU64(numeric(value["bindingGeneration"]), writer, context, value, value.flags);
|
|
10245
|
+
if (value["sealResult"] === undefined)
|
|
10246
|
+
fail("sealResult required");
|
|
10247
|
+
writeSessionSealResult(value["sealResult"], writer, context, value, value.flags);
|
|
10056
10248
|
const frames = [writer.result()];
|
|
10057
10249
|
return frames;
|
|
10058
10250
|
}
|
|
@@ -10506,6 +10698,43 @@ function encodeRelocationFailedCommand(value, context) {
|
|
|
10506
10698
|
return frames;
|
|
10507
10699
|
}
|
|
10508
10700
|
function validateRelocationFailedCommandRuntimePredicates(value, context) { void value; void context; }
|
|
10701
|
+
function decodeBoundSessionCloseCommand(frames, context) {
|
|
10702
|
+
if (!frames.length)
|
|
10703
|
+
fail("boundSessionClose frames");
|
|
10704
|
+
const reader = new Reader(frames[0]);
|
|
10705
|
+
if (Number(reader.u(1)) !== 90 || Number(reader.u(1)) !== 77 || Number(reader.u(1)) !== 1 || Number(reader.u(1)) !== 54)
|
|
10706
|
+
fail("boundSessionClose header");
|
|
10707
|
+
const flags = Number(reader.u(1));
|
|
10708
|
+
if ((flags & ~0) !== 0 || (flags & 0) !== 0)
|
|
10709
|
+
fail("boundSessionClose flags");
|
|
10710
|
+
const value = { command: "boundSessionClose", flags };
|
|
10711
|
+
value["correlation"] = readNonzeroU64(reader, context, value, flags);
|
|
10712
|
+
value["actor"] = readActorRef(reader, context, value, flags);
|
|
10713
|
+
value["session"] = readRetiredBoundSessionRouteFence(reader, context, value, flags);
|
|
10714
|
+
reader.done("boundSessionClose");
|
|
10715
|
+
let frameIndex = 1;
|
|
10716
|
+
if (frameIndex !== frames.length)
|
|
10717
|
+
fail("boundSessionClose frames");
|
|
10718
|
+
return value;
|
|
10719
|
+
}
|
|
10720
|
+
function encodeBoundSessionCloseCommand(value, context) {
|
|
10721
|
+
if ((value.flags & ~0) !== 0 || (value.flags & 0) !== 0)
|
|
10722
|
+
fail("boundSessionClose flags");
|
|
10723
|
+
const writer = new Writer();
|
|
10724
|
+
writer.put([90, 77, 1, 54, value.flags]);
|
|
10725
|
+
if (value["correlation"] === undefined)
|
|
10726
|
+
fail("correlation required");
|
|
10727
|
+
writeNonzeroU64(numeric(value["correlation"]), writer, context, value, value.flags);
|
|
10728
|
+
if (value["actor"] === undefined)
|
|
10729
|
+
fail("actor required");
|
|
10730
|
+
writeActorRef(value["actor"], writer, context, value, value.flags);
|
|
10731
|
+
if (value["session"] === undefined)
|
|
10732
|
+
fail("session required");
|
|
10733
|
+
writeRetiredBoundSessionRouteFence(value["session"], writer, context, value, value.flags);
|
|
10734
|
+
const frames = [writer.result()];
|
|
10735
|
+
return frames;
|
|
10736
|
+
}
|
|
10737
|
+
function validateBoundSessionCloseCommandRuntimePredicates(value, context) { void value; void context; }
|
|
10509
10738
|
function decodeAuthorityPayloadV1DurableFormat(bytes, context) { if (bytes.length > 1048576)
|
|
10510
10739
|
fail("authority-payload-v1 maximum"); const reader = new Reader(bytes); if (Number(reader.u(1)) !== 90 || Number(reader.u(1)) !== 76 || Number(reader.u(1)) !== 65 || Number(reader.u(1)) !== 85 || Number(reader.u(1)) !== 1)
|
|
10511
10740
|
fail("authority-payload-v1 header"); const flags = readU16(reader, context, {}, 0); if (!same(flags, 0))
|
|
@@ -72,6 +72,15 @@ export interface RelocationEnvelopeV1 {
|
|
|
72
72
|
readonly scheduledAtUnixMilliseconds: bigint;
|
|
73
73
|
readonly skippedTicks: bigint;
|
|
74
74
|
}[];
|
|
75
|
+
readonly sessionBindings: readonly {
|
|
76
|
+
readonly participantId: bigint;
|
|
77
|
+
readonly sessionOwnerNodeRid: Uint8Array;
|
|
78
|
+
readonly sessionOwnerNodeGeneration: bigint;
|
|
79
|
+
readonly sessionOwnerId: string;
|
|
80
|
+
readonly sessionOwnerLeaseGeneration: bigint;
|
|
81
|
+
readonly sessionRid: Uint8Array;
|
|
82
|
+
readonly bindingGeneration: bigint;
|
|
83
|
+
}[];
|
|
75
84
|
}
|
|
76
85
|
export interface RelocationDataChunkV1 {
|
|
77
86
|
readonly order: number;
|
|
@@ -259,6 +268,7 @@ export interface RelocationPrepare40 {
|
|
|
259
268
|
readonly payloadChunkCount: number;
|
|
260
269
|
readonly payloadChecksumCrc32c: number;
|
|
261
270
|
readonly applicationVersion: bigint;
|
|
271
|
+
readonly deadlineUnixMs: bigint;
|
|
262
272
|
}
|
|
263
273
|
export interface SessionRelocationSeal42 {
|
|
264
274
|
readonly relocation: ServiceWireRelocationId;
|
|
@@ -271,8 +281,13 @@ export interface SessionRelocationSeal42 {
|
|
|
271
281
|
readonly sessionOwnerLeaseGeneration: bigint;
|
|
272
282
|
readonly sessionRid: Uint8Array;
|
|
273
283
|
readonly bindingGeneration: bigint;
|
|
284
|
+
readonly targetNodeRid: Uint8Array;
|
|
285
|
+
readonly targetNodeGeneration: bigint;
|
|
274
286
|
}
|
|
275
|
-
export type
|
|
287
|
+
export type ServiceWireSessionSealResult = "sealed" | "bindingAbsent";
|
|
288
|
+
export type SessionRelocationSealed43 = Omit<SessionRelocationSeal42, "senderRole" | "targetNodeRid" | "targetNodeGeneration"> & {
|
|
289
|
+
readonly sealResult: ServiceWireSessionSealResult;
|
|
290
|
+
};
|
|
276
291
|
export interface SessionRelocationRoute44 {
|
|
277
292
|
readonly relocation: ServiceWireRelocationId;
|
|
278
293
|
readonly coordinator: ServiceWireCoordinatorFence;
|
|
@@ -331,6 +331,17 @@ function encodeRelocationEnvelopeV1(value) { const out = []; if (value.relocatio
|
|
|
331
331
|
u64(out, p.scheduledIndex);
|
|
332
332
|
u64(out, p.scheduledAtUnixMilliseconds);
|
|
333
333
|
u64(out, p.skippedTicks);
|
|
334
|
+
} sorted(value.sessionBindings, (a, b) => a.participantId < b.participantId ? -1 : a.participantId > b.participantId ? 1 : 0, "sessionBindings"); if (value.sessionBindings.length > 1024)
|
|
335
|
+
throw new RangeError("bindings count"); u32(out, value.sessionBindings.length); for (const b of value.sessionBindings) {
|
|
336
|
+
if (b.participantId === 0n || b.sessionOwnerNodeGeneration === 0n || b.sessionOwnerLeaseGeneration === 0n || b.bindingGeneration === 0n)
|
|
337
|
+
throw new RangeError("binding");
|
|
338
|
+
u64(out, b.participantId);
|
|
339
|
+
rid(out, b.sessionOwnerNodeRid);
|
|
340
|
+
u64(out, b.sessionOwnerNodeGeneration);
|
|
341
|
+
text8(out, b.sessionOwnerId);
|
|
342
|
+
u64(out, b.sessionOwnerLeaseGeneration);
|
|
343
|
+
rid(out, b.sessionRid);
|
|
344
|
+
u64(out, b.bindingGeneration);
|
|
334
345
|
} if (out.length > 274877906944)
|
|
335
346
|
throw new RangeError("relocation logical bytes"); return Uint8Array.from(out); }
|
|
336
347
|
function decodeRelocationEnvelopeV1(chunks) { const n = chunks.reduce((s, c) => s + c.length, 0); if (n > 274877906944)
|
|
@@ -381,7 +392,9 @@ function decodeRelocationEnvelopeV1(chunks) { const n = chunks.reduce((s, c) =>
|
|
|
381
392
|
if (registeredTimerNames.get(participantId)?.has(timerName) !== true)
|
|
382
393
|
throw new RangeError("pending timer registration");
|
|
383
394
|
pendingTimerTicks.push({ participantId, order, timerName, deliveryIndex: nonzero64(bytes, at, "delivery"), scheduledIndex: nonzero64(bytes, at, "scheduled"), scheduledAtUnixMilliseconds: read64(bytes, at), skippedTicks: read64(bytes, at) });
|
|
384
|
-
}
|
|
395
|
+
} const sessionBindings = []; const bindingCount = read32(bytes, at); if (bindingCount > 1024)
|
|
396
|
+
throw new RangeError("bindings count"); for (let n = 0; n < bindingCount; n++)
|
|
397
|
+
sessionBindings.push({ participantId: nonzero64(bytes, at, "participant"), sessionOwnerNodeRid: readRid(bytes, at), sessionOwnerNodeGeneration: nonzero64(bytes, at, "session node"), sessionOwnerId: readText8(bytes, at), sessionOwnerLeaseGeneration: nonzero64(bytes, at, "session lease"), sessionRid: readRid(bytes, at), bindingGeneration: nonzero64(bytes, at, "binding") }); sorted(sessionBindings, (a, b) => a.participantId < b.participantId ? -1 : a.participantId > b.participantId ? 1 : 0, "sessionBindings"); exactEnd(at, bytes.length, "relocation envelope"); sorted(applicationStates, (a, b) => a.participantId < b.participantId ? -1 : a.participantId > b.participantId ? 1 : 0, "applicationStates"); sorted(savedWork, (a, b) => a.participantId === b.participantId ? (a.order < b.order ? -1 : a.order > b.order ? 1 : 0) : (a.participantId < b.participantId ? -1 : 1), "savedWork"); sorted(timerRegistrations, (a, b) => a.participantId === b.participantId ? compareUtf8(a.name, b.name) : a.participantId < b.participantId ? -1 : 1, "timerRegistrations"); sorted(pendingTimerTicks, (a, b) => a.participantId === b.participantId ? (a.order < b.order ? -1 : a.order > b.order ? 1 : 0) : (a.participantId < b.participantId ? -1 : 1), "pendingTimerTicks"); return { relocationHigh, relocationLow, object, applicationVersion, applicationStates, savedWork, timerRegistrations, pendingTimerTicks, sessionBindings }; }
|
|
385
398
|
function crc32c(bytes) { let crc = 0xffffffff; for (const octet of bytes) {
|
|
386
399
|
crc ^= octet;
|
|
387
400
|
for (let bit = 0; bit < 8; bit++)
|
|
@@ -459,6 +472,20 @@ function decodeActorDestroy27(bytes) { const at = { value: 0 }; if (bytes.length
|
|
|
459
472
|
throw new RangeError("actorDestroy header"); const correlation = read64(bytes, at); if (correlation === 0n)
|
|
460
473
|
throw new RangeError("correlation"); const actor = readFence(bytes, at); if (at.value !== bytes.length)
|
|
461
474
|
throw new RangeError("actorDestroy trailing"); return { correlation, actor }; }
|
|
475
|
+
function b3WriteSealResult(o, v) { switch (v) {
|
|
476
|
+
case "sealed":
|
|
477
|
+
o.push(1);
|
|
478
|
+
return;
|
|
479
|
+
case "bindingAbsent":
|
|
480
|
+
o.push(2);
|
|
481
|
+
return;
|
|
482
|
+
default: throw new RangeError("sealResult");
|
|
483
|
+
} }
|
|
484
|
+
function b3ReadSealResult(bytes, at) { switch (read8(bytes, at)) {
|
|
485
|
+
case 1: return "sealed";
|
|
486
|
+
case 2: return "bindingAbsent";
|
|
487
|
+
default: throw new RangeError("sealResult");
|
|
488
|
+
} }
|
|
462
489
|
function b3Header(id) { return [90, 77, 1, id, 0]; }
|
|
463
490
|
function b3ReadHeader(bytes, id, name) { const at = { value: 0 }; if (bytes.length < 5 || bytes[at.value++] !== 90 || bytes[at.value++] !== 77 || bytes[at.value++] !== 1 || bytes[at.value++] !== id || bytes[at.value++] !== 0)
|
|
464
491
|
throw new RangeError(name + " header"); return at; }
|
|
@@ -584,10 +611,11 @@ function decodeRelocationState52(bytes) { const at = b3ReadHeader(bytes, 52, "re
|
|
|
584
611
|
function encodeRelocationPrepare40(v) { const o = b3Header(40); b3WriteId(o, v.relocation, "relocation"); if (v.targetAttemptGeneration === 0n || v.sourceNodeGeneration === 0n)
|
|
585
612
|
throw new RangeError("prepare"); u64(o, v.targetAttemptGeneration); b3WriteCoordinator(o, v.coordinator); b3WriteTarget(o, v.target); b3WriteRole(o, v.initiatorRole); if (v.initiatorRole !== "source")
|
|
586
613
|
throw new RangeError("initiator role"); writeRelocationObject(o, v.object); rid(o, v.sourceNodeRid); u64(o, v.sourceNodeGeneration); if (v.payloadTotalLength < 0n || v.payloadTotalLength > 274877906944n || v.payloadChunkCount > 4096 || v.applicationVersion < 0n || v.applicationVersion > 9223372036854775807n)
|
|
587
|
-
throw new RangeError("prepare bounds"); u64(o, v.payloadTotalLength); u32(o, v.payloadChunkCount); u32(o, v.payloadChecksumCrc32c); u64(o, v.applicationVersion);
|
|
614
|
+
throw new RangeError("prepare bounds"); u64(o, v.payloadTotalLength); u32(o, v.payloadChunkCount); u32(o, v.payloadChecksumCrc32c); u64(o, v.applicationVersion); if (v.deadlineUnixMs === 0n)
|
|
615
|
+
throw new RangeError("deadline"); u64(o, v.deadlineUnixMs); return Uint8Array.from(o); }
|
|
588
616
|
function decodeRelocationPrepare40(bytes) { const at = b3ReadHeader(bytes, 40, "relocationPrepare"), relocation = b3ReadId(bytes, at, "relocation"), targetAttemptGeneration = nonzero64(bytes, at, "target attempt"), coordinator = b3ReadCoordinator(bytes, at), target = b3ReadTarget(bytes, at), initiatorRole = b3ReadRole(bytes, at); if (initiatorRole !== "source")
|
|
589
|
-
throw new RangeError("initiator role"); const object = readRelocationObject(bytes, at), sourceNodeRid = readRid(bytes, at), sourceNodeGeneration = nonzero64(bytes, at, "source node"), payloadTotalLength = read64(bytes, at), payloadChunkCount = read32(bytes, at), payloadChecksumCrc32c = read32(bytes, at), applicationVersion = read64(bytes, at); if (payloadTotalLength > 274877906944n || payloadChunkCount > 4096 || applicationVersion > 9223372036854775807n)
|
|
590
|
-
throw new RangeError("prepare bounds"); b3Finish(at, bytes, "relocationPrepare"); return { relocation, targetAttemptGeneration, coordinator, target, initiatorRole, object, sourceNodeRid, sourceNodeGeneration, payloadTotalLength, payloadChunkCount, payloadChecksumCrc32c, applicationVersion }; }
|
|
617
|
+
throw new RangeError("initiator role"); const object = readRelocationObject(bytes, at), sourceNodeRid = readRid(bytes, at), sourceNodeGeneration = nonzero64(bytes, at, "source node"), payloadTotalLength = read64(bytes, at), payloadChunkCount = read32(bytes, at), payloadChecksumCrc32c = read32(bytes, at), applicationVersion = read64(bytes, at), deadlineUnixMs = nonzero64(bytes, at, "deadline"); if (payloadTotalLength > 274877906944n || payloadChunkCount > 4096 || applicationVersion > 9223372036854775807n)
|
|
618
|
+
throw new RangeError("prepare bounds"); b3Finish(at, bytes, "relocationPrepare"); return { relocation, targetAttemptGeneration, coordinator, target, initiatorRole, object, sourceNodeRid, sourceNodeGeneration, payloadTotalLength, payloadChunkCount, payloadChecksumCrc32c, applicationVersion, deadlineUnixMs }; }
|
|
591
619
|
function b3WriteSealBase(o, v, includeRole) { b3WriteId(o, v.relocation, "relocation"); b3WriteCoordinator(o, v.coordinator); if (includeRole) {
|
|
592
620
|
const role = v.senderRole;
|
|
593
621
|
b3WriteRole(o, role);
|
|
@@ -599,10 +627,11 @@ function b3ReadSealBase(bytes, at, includeRole) { const relocation = b3ReadId(by
|
|
|
599
627
|
if (senderRole !== "source")
|
|
600
628
|
throw new RangeError("sender role");
|
|
601
629
|
} const actor = readFence(bytes, at), session = b3ReadSession(bytes, at); return senderRole === undefined ? { relocation, coordinator, actor, ...session } : { relocation, coordinator, senderRole, actor, ...session }; }
|
|
602
|
-
function encodeSessionRelocationSeal42(v) { const o = b3Header(42); b3WriteSealBase(o, v, true);
|
|
603
|
-
|
|
604
|
-
function
|
|
605
|
-
function
|
|
630
|
+
function encodeSessionRelocationSeal42(v) { const o = b3Header(42); b3WriteSealBase(o, v, true); rid(o, v.targetNodeRid); if (v.targetNodeGeneration === 0n)
|
|
631
|
+
throw new RangeError("target node"); u64(o, v.targetNodeGeneration); return Uint8Array.from(o); }
|
|
632
|
+
function decodeSessionRelocationSeal42(bytes) { const at = b3ReadHeader(bytes, 42, "sessionRelocationSeal"), v = b3ReadSealBase(bytes, at, true); const targetNodeRid = readRid(bytes, at), targetNodeGeneration = nonzero64(bytes, at, "target node"); b3Finish(at, bytes, "sessionRelocationSeal"); return { ...v, targetNodeRid, targetNodeGeneration }; }
|
|
633
|
+
function encodeSessionRelocationSealed43(v) { const o = b3Header(43); b3WriteSealBase(o, v, false); b3WriteSealResult(o, v.sealResult); return Uint8Array.from(o); }
|
|
634
|
+
function decodeSessionRelocationSealed43(bytes) { const at = b3ReadHeader(bytes, 43, "sessionRelocationSealed"), v = { ...b3ReadSealBase(bytes, at, false), sealResult: b3ReadSealResult(bytes, at) }; b3Finish(at, bytes, "sessionRelocationSealed"); return v; }
|
|
606
635
|
function encodeSessionRelocationRoute44(v) { const o = b3Header(44); b3WriteId(o, v.relocation, "relocation"); b3WriteCoordinator(o, v.coordinator); b3WriteRole(o, v.senderRole); if ((v.route.action === "commit" && v.senderRole !== "target") || (v.route.action === "abort" && v.senderRole !== "source"))
|
|
607
636
|
throw new RangeError("route sender"); b3WriteActorRef(o, v.actor); b3WriteSession(o, v); b3WriteRoute(o, v.route); return Uint8Array.from(o); }
|
|
608
637
|
function decodeSessionRelocationRoute44(bytes) { const at = b3ReadHeader(bytes, 44, "sessionRelocationRoute"), relocation = b3ReadId(bytes, at, "relocation"), coordinator = b3ReadCoordinator(bytes, at), senderRole = b3ReadRole(bytes, at), actor = b3ReadActorRef(bytes, at), session = b3ReadSession(bytes, at), route = b3ReadRoute(bytes, at); if ((route.action === "commit" && senderRole !== "target") || (route.action === "abort" && senderRole !== "source"))
|
|
@@ -22,7 +22,7 @@ export interface ZLinkParkedActorArrival {
|
|
|
22
22
|
readonly reject: (reason: unknown) => void;
|
|
23
23
|
}
|
|
24
24
|
export type ZLinkActorJoinIngressRoute = 'parked' | 'not-found';
|
|
25
|
-
export type ZLinkFormalRemoteActorAdmissionState = 'provisional' | 'admitting' | 'admitted' | 'rejected' | 'committed' | 'aborted' | 'failed';
|
|
25
|
+
export type ZLinkFormalRemoteActorAdmissionState = 'provisional' | 'admitting' | 'admitted' | 'restoring' | 'rejected' | 'committed' | 'aborted' | 'failed';
|
|
26
26
|
export interface ZLinkFormalRemoteActorAdmission {
|
|
27
27
|
readonly actorId: string;
|
|
28
28
|
readonly actorType: string;
|
|
@@ -56,7 +56,7 @@ export interface ZLinkFormalRemoteActorAdmissionRecord {
|
|
|
56
56
|
readonly resultTask: Promise<ZLinkFormalRemoteActorAdmissionResult>;
|
|
57
57
|
}
|
|
58
58
|
interface ZLinkFormalRemoteActorAdmissionEntry extends ZLinkFormalRemoteActorAdmissionRecord {
|
|
59
|
-
|
|
59
|
+
timer: ReturnType<typeof setTimeout>;
|
|
60
60
|
readonly resolveResult: (result: ZLinkFormalRemoteActorAdmissionResult) => void;
|
|
61
61
|
admission: ZLinkFormalRemoteActorAdmission;
|
|
62
62
|
state: ZLinkFormalRemoteActorAdmissionState;
|
|
@@ -70,6 +70,11 @@ export declare class ZLinkFormalRemoteActorAdmissionRegistry {
|
|
|
70
70
|
private readonly admissions;
|
|
71
71
|
private readonly byObject;
|
|
72
72
|
get(transferId: string): ZLinkFormalRemoteActorAdmissionEntry | undefined;
|
|
73
|
+
/** PREPARE transfers prepared resources to the target attempt until its terminal. */
|
|
74
|
+
beginRestore(transferId: string): void;
|
|
75
|
+
/** Retains successful commit replay; unsuccessful attempts release their resources now. */
|
|
76
|
+
finishRestore(transferId: string): void;
|
|
77
|
+
private scheduleExpiry;
|
|
73
78
|
begin(input: ZLinkFormalRemoteActorAdmission): {
|
|
74
79
|
readonly record: ZLinkFormalRemoteActorAdmissionEntry;
|
|
75
80
|
readonly created: boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ZLinkFormalRemoteActorAdmissionRegistry = void 0;
|
|
4
|
+
const routing_id_1 = require("../routing-id");
|
|
4
5
|
const ADMISSION_RETENTION_MS = 30_000;
|
|
5
6
|
/** Identifies the object one admission attempt belongs to. */
|
|
6
7
|
function objectKey(actorId, objectGeneration) {
|
|
@@ -17,6 +18,34 @@ class ZLinkFormalRemoteActorAdmissionRegistry {
|
|
|
17
18
|
get(transferId) {
|
|
18
19
|
return this.admissions.get(transferId);
|
|
19
20
|
}
|
|
21
|
+
/** PREPARE transfers prepared resources to the target attempt until its terminal. */
|
|
22
|
+
beginRestore(transferId) {
|
|
23
|
+
const entry = this.admissions.get(transferId);
|
|
24
|
+
if (entry === undefined || (entry.state !== 'admitted' && entry.state !== 'restoring')) {
|
|
25
|
+
throw new Error(`Remote actor admission '${transferId}' is not ready to restore.`);
|
|
26
|
+
}
|
|
27
|
+
clearTimeout(entry.timer);
|
|
28
|
+
entry.state = 'restoring';
|
|
29
|
+
}
|
|
30
|
+
/** Retains successful commit replay; unsuccessful attempts release their resources now. */
|
|
31
|
+
finishRestore(transferId) {
|
|
32
|
+
const entry = this.admissions.get(transferId);
|
|
33
|
+
if (entry === undefined)
|
|
34
|
+
return;
|
|
35
|
+
if (entry.state === 'committed') {
|
|
36
|
+
clearTimeout(entry.timer);
|
|
37
|
+
entry.timer = this.scheduleExpiry(transferId);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
this.abort(transferId);
|
|
41
|
+
this.delete(transferId);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
scheduleExpiry(transferId) {
|
|
45
|
+
const timer = setTimeout(() => this.delete(transferId), ADMISSION_RETENTION_MS);
|
|
46
|
+
timer.unref();
|
|
47
|
+
return timer;
|
|
48
|
+
}
|
|
20
49
|
begin(input) {
|
|
21
50
|
const existing = this.admissions.get(input.transferId);
|
|
22
51
|
if (existing !== undefined) {
|
|
@@ -71,10 +100,7 @@ class ZLinkFormalRemoteActorAdmissionRegistry {
|
|
|
71
100
|
const resultTask = new Promise((resolve) => {
|
|
72
101
|
resolveResult = resolve;
|
|
73
102
|
});
|
|
74
|
-
const timer =
|
|
75
|
-
this.delete(input.transferId);
|
|
76
|
-
}, ADMISSION_RETENTION_MS);
|
|
77
|
-
timer.unref();
|
|
103
|
+
const timer = this.scheduleExpiry(input.transferId);
|
|
78
104
|
const entry = {
|
|
79
105
|
admission: input,
|
|
80
106
|
state,
|
|
@@ -186,7 +212,7 @@ class ZLinkFormalRemoteActorAdmissionRegistry {
|
|
|
186
212
|
const entry = this.admissions.get(transferId);
|
|
187
213
|
if (entry === undefined)
|
|
188
214
|
return;
|
|
189
|
-
if (entry.state !== 'admitted' && entry.state !== 'committed') {
|
|
215
|
+
if (entry.state !== 'admitted' && entry.state !== 'restoring' && entry.state !== 'committed') {
|
|
190
216
|
throw new Error(`Remote actor admission '${transferId}' is not ready to commit.`);
|
|
191
217
|
}
|
|
192
218
|
entry.state = 'committed';
|
|
@@ -195,7 +221,7 @@ class ZLinkFormalRemoteActorAdmissionRegistry {
|
|
|
195
221
|
attachDeferredJoinCompletion(transferId, root) {
|
|
196
222
|
const entry = this.admissions.get(transferId);
|
|
197
223
|
if (entry === undefined ||
|
|
198
|
-
entry.state !== 'admitted' ||
|
|
224
|
+
(entry.state !== 'admitted' && entry.state !== 'restoring') ||
|
|
199
225
|
entry.result === undefined ||
|
|
200
226
|
'error' in entry.result ||
|
|
201
227
|
!entry.result.accepted) {
|
|
@@ -227,7 +253,7 @@ class ZLinkFormalRemoteActorAdmissionRegistry {
|
|
|
227
253
|
*/
|
|
228
254
|
delete(transferId) {
|
|
229
255
|
const pending = this.admissions.get(transferId);
|
|
230
|
-
if (pending === undefined)
|
|
256
|
+
if (pending === undefined || pending.state === 'restoring')
|
|
231
257
|
return;
|
|
232
258
|
clearTimeout(pending.timer);
|
|
233
259
|
this.admissions.delete(transferId);
|
|
@@ -240,18 +266,7 @@ class ZLinkFormalRemoteActorAdmissionRegistry {
|
|
|
240
266
|
}
|
|
241
267
|
exports.ZLinkFormalRemoteActorAdmissionRegistry = ZLinkFormalRemoteActorAdmissionRegistry;
|
|
242
268
|
function sameAdmission(left, right) {
|
|
243
|
-
return
|
|
244
|
-
left.actorType === right.actorType &&
|
|
245
|
-
String(left.spotId) === String(right.spotId) &&
|
|
246
|
-
left.targetSpotGeneration === right.targetSpotGeneration &&
|
|
247
|
-
left.expectedMembershipEpoch === right.expectedMembershipEpoch &&
|
|
248
|
-
left.requestFingerprint === right.requestFingerprint &&
|
|
249
|
-
sameOperationId(left.completionOperationId, right.completionOperationId) &&
|
|
250
|
-
String(left.sourceSpotId ?? '') === String(right.sourceSpotId ?? '') &&
|
|
251
|
-
String(left.sourceActorNodeRid ?? '') === String(right.sourceActorNodeRid ?? '') &&
|
|
252
|
-
left.actorRef.actorId === right.actorRef.actorId &&
|
|
253
|
-
String(left.actorRef.nodeRid) === String(right.actorRef.nodeRid) &&
|
|
254
|
-
left.actorRef.objectGeneration === right.actorRef.objectGeneration);
|
|
269
|
+
return left.actorType === right.actorType && sameProvisionalAdmission(left, right);
|
|
255
270
|
}
|
|
256
271
|
function sameProvisionalAdmission(left, right) {
|
|
257
272
|
return (left.actorId === right.actorId &&
|
|
@@ -261,9 +276,9 @@ function sameProvisionalAdmission(left, right) {
|
|
|
261
276
|
left.requestFingerprint === right.requestFingerprint &&
|
|
262
277
|
sameOperationId(left.completionOperationId, right.completionOperationId) &&
|
|
263
278
|
String(left.sourceSpotId ?? '') === String(right.sourceSpotId ?? '') &&
|
|
264
|
-
|
|
279
|
+
(0, routing_id_1.routingIdsEqual)(left.sourceActorNodeRid, right.sourceActorNodeRid) &&
|
|
265
280
|
left.actorRef.actorId === right.actorRef.actorId &&
|
|
266
|
-
|
|
281
|
+
(0, routing_id_1.routingIdsEqual)(left.actorRef.nodeRid, right.actorRef.nodeRid) &&
|
|
267
282
|
left.actorRef.objectGeneration === right.actorRef.objectGeneration);
|
|
268
283
|
}
|
|
269
284
|
function sameOperationId(left, right) {
|