@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
|
@@ -1332,6 +1332,27 @@ function writeSourceCleanupState(input: SourceCleanupState, writer: Writer, cont
|
|
|
1332
1332
|
export function decodeSourceCleanupState(bytes: Uint8Array, context: ServiceWireDecoderContext): SourceCleanupState { const reader = new Reader(bytes); const value = readSourceCleanupState(reader, context, {}, 0); reader.done("source-cleanup-state"); return value; }
|
|
1333
1333
|
export function encodeSourceCleanupState(value: SourceCleanupState, context: ServiceWireDecoderContext): Uint8Array { const writer = new Writer(); writeSourceCleanupState(value, writer, context, {}, 0); return writer.result(); }
|
|
1334
1334
|
|
|
1335
|
+
export type SessionSealResult = "sealed" | "bindingAbsent";
|
|
1336
|
+
export function enumWireSessionSealResult(value: SessionSealResult): number { switch (value) {
|
|
1337
|
+
case "sealed": return 1;
|
|
1338
|
+
case "bindingAbsent": return 2;
|
|
1339
|
+
} }
|
|
1340
|
+
function readSessionSealResult(reader: Reader, context: ServiceWireDecoderContext, enclosing: any, flags: number): SessionSealResult {
|
|
1341
|
+
void context; void enclosing; void flags;
|
|
1342
|
+
const raw = reader.u(1); switch (Number(raw)) {
|
|
1343
|
+
case 1: return "sealed";
|
|
1344
|
+
case 2: return "bindingAbsent";
|
|
1345
|
+
default: fail("session-seal-result enum");
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
function writeSessionSealResult(input: SessionSealResult, writer: Writer, context: ServiceWireDecoderContext, enclosing: any, flags: number): void {
|
|
1350
|
+
void context; void enclosing; void flags; const value: any = input;
|
|
1351
|
+
writer.u(numeric(enumWireSessionSealResult(value)), 1);
|
|
1352
|
+
}
|
|
1353
|
+
export function decodeSessionSealResult(bytes: Uint8Array, context: ServiceWireDecoderContext): SessionSealResult { const reader = new Reader(bytes); const value = readSessionSealResult(reader, context, {}, 0); reader.done("session-seal-result"); return value; }
|
|
1354
|
+
export function encodeSessionSealResult(value: SessionSealResult, context: ServiceWireDecoderContext): Uint8Array { const writer = new Writer(); writeSessionSealResult(value, writer, context, {}, 0); return writer.result(); }
|
|
1355
|
+
|
|
1335
1356
|
export type ReplyRelayAckStatus = "terminalReceived" | "alreadyTerminal";
|
|
1336
1357
|
export function enumWireReplyRelayAckStatus(value: ReplyRelayAckStatus): number { switch (value) {
|
|
1337
1358
|
case "terminalReceived": return 1;
|
|
@@ -7584,7 +7605,127 @@ function writeRelocationPendingTimerTickVector(input: RelocationPendingTimerTick
|
|
|
7584
7605
|
export function decodeRelocationPendingTimerTickVector(bytes: Uint8Array, context: ServiceWireDecoderContext): RelocationPendingTimerTickVector { const reader = new Reader(bytes); const value = readRelocationPendingTimerTickVector(reader, context, {}, 0); reader.done("relocation-pending-timer-tick-vector"); return value; }
|
|
7585
7606
|
export function encodeRelocationPendingTimerTickVector(value: RelocationPendingTimerTickVector, context: ServiceWireDecoderContext): Uint8Array { const writer = new Writer(); writeRelocationPendingTimerTickVector(value, writer, context, {}, 0); return writer.result(); }
|
|
7586
7607
|
|
|
7587
|
-
export type
|
|
7608
|
+
export type RelocationSessionBinding = { readonly participantId: NonzeroU64; readonly sessionOwnerNodeRid: Rid; readonly sessionOwnerNodeGeneration: NonzeroU64; readonly sessionOwnerId: Text8; readonly sessionOwnerLeaseGeneration: NonzeroU64; readonly sessionRid: Rid; readonly bindingGeneration: NonzeroU64 };
|
|
7609
|
+
|
|
7610
|
+
function readRelocationSessionBinding(reader: Reader, context: ServiceWireDecoderContext, enclosing: any, flags: number): RelocationSessionBinding {
|
|
7611
|
+
void context; void enclosing; void flags;
|
|
7612
|
+
const value: any = {};
|
|
7613
|
+
value["participantId"] = readNonzeroU64(reader, context, value, flags);
|
|
7614
|
+
|
|
7615
|
+
|
|
7616
|
+
value["sessionOwnerNodeRid"] = readRid(reader, context, value, flags);
|
|
7617
|
+
|
|
7618
|
+
|
|
7619
|
+
value["sessionOwnerNodeGeneration"] = readNonzeroU64(reader, context, value, flags);
|
|
7620
|
+
|
|
7621
|
+
|
|
7622
|
+
value["sessionOwnerId"] = readText8(reader, context, value, flags);
|
|
7623
|
+
|
|
7624
|
+
|
|
7625
|
+
value["sessionOwnerLeaseGeneration"] = readNonzeroU64(reader, context, value, flags);
|
|
7626
|
+
|
|
7627
|
+
|
|
7628
|
+
value["sessionRid"] = readRid(reader, context, value, flags);
|
|
7629
|
+
|
|
7630
|
+
|
|
7631
|
+
value["bindingGeneration"] = readNonzeroU64(reader, context, value, flags);
|
|
7632
|
+
|
|
7633
|
+
|
|
7634
|
+
|
|
7635
|
+
|
|
7636
|
+
return value;
|
|
7637
|
+
}
|
|
7638
|
+
function* readIncrementalRelocationSessionBinding(reader: IncrementalInput, context: ServiceWireDecoderContext, enclosing: any, flags: number): Generator<void, RelocationSessionBinding, void> {
|
|
7639
|
+
void context; void enclosing; void flags;
|
|
7640
|
+
const value: any = {};
|
|
7641
|
+
value["participantId"] = yield* readIncrementalNonzeroU64(reader, context, value, flags);
|
|
7642
|
+
|
|
7643
|
+
|
|
7644
|
+
value["sessionOwnerNodeRid"] = yield* readIncrementalRid(reader, context, value, flags);
|
|
7645
|
+
|
|
7646
|
+
|
|
7647
|
+
value["sessionOwnerNodeGeneration"] = yield* readIncrementalNonzeroU64(reader, context, value, flags);
|
|
7648
|
+
|
|
7649
|
+
|
|
7650
|
+
value["sessionOwnerId"] = yield* readIncrementalText8(reader, context, value, flags);
|
|
7651
|
+
|
|
7652
|
+
|
|
7653
|
+
value["sessionOwnerLeaseGeneration"] = yield* readIncrementalNonzeroU64(reader, context, value, flags);
|
|
7654
|
+
|
|
7655
|
+
|
|
7656
|
+
value["sessionRid"] = yield* readIncrementalRid(reader, context, value, flags);
|
|
7657
|
+
|
|
7658
|
+
|
|
7659
|
+
value["bindingGeneration"] = yield* readIncrementalNonzeroU64(reader, context, value, flags);
|
|
7660
|
+
|
|
7661
|
+
|
|
7662
|
+
|
|
7663
|
+
|
|
7664
|
+
return value;
|
|
7665
|
+
}
|
|
7666
|
+
function writeRelocationSessionBinding(input: RelocationSessionBinding, writer: Writer, context: ServiceWireDecoderContext, enclosing: any, flags: number): void {
|
|
7667
|
+
void context; void enclosing; void flags; const value: any = input;
|
|
7668
|
+
|
|
7669
|
+
|
|
7670
|
+
if (value["participantId"] === undefined) fail("participantId required");
|
|
7671
|
+
|
|
7672
|
+
|
|
7673
|
+
writeNonzeroU64(numeric(value["participantId"]), writer, context, value, flags);
|
|
7674
|
+
if (value["sessionOwnerNodeRid"] === undefined) fail("sessionOwnerNodeRid required");
|
|
7675
|
+
|
|
7676
|
+
|
|
7677
|
+
writeRid(value["sessionOwnerNodeRid"], writer, context, value, flags);
|
|
7678
|
+
if (value["sessionOwnerNodeGeneration"] === undefined) fail("sessionOwnerNodeGeneration required");
|
|
7679
|
+
|
|
7680
|
+
|
|
7681
|
+
writeNonzeroU64(numeric(value["sessionOwnerNodeGeneration"]), writer, context, value, flags);
|
|
7682
|
+
if (value["sessionOwnerId"] === undefined) fail("sessionOwnerId required");
|
|
7683
|
+
|
|
7684
|
+
|
|
7685
|
+
writeText8(value["sessionOwnerId"], writer, context, value, flags);
|
|
7686
|
+
if (value["sessionOwnerLeaseGeneration"] === undefined) fail("sessionOwnerLeaseGeneration required");
|
|
7687
|
+
|
|
7688
|
+
|
|
7689
|
+
writeNonzeroU64(numeric(value["sessionOwnerLeaseGeneration"]), writer, context, value, flags);
|
|
7690
|
+
if (value["sessionRid"] === undefined) fail("sessionRid required");
|
|
7691
|
+
|
|
7692
|
+
|
|
7693
|
+
writeRid(value["sessionRid"], writer, context, value, flags);
|
|
7694
|
+
if (value["bindingGeneration"] === undefined) fail("bindingGeneration required");
|
|
7695
|
+
|
|
7696
|
+
|
|
7697
|
+
writeNonzeroU64(numeric(value["bindingGeneration"]), writer, context, value, flags);
|
|
7698
|
+
}
|
|
7699
|
+
export function decodeRelocationSessionBinding(bytes: Uint8Array, context: ServiceWireDecoderContext): RelocationSessionBinding { const reader = new Reader(bytes); const value = readRelocationSessionBinding(reader, context, {}, 0); reader.done("relocation-session-binding"); return value; }
|
|
7700
|
+
export function encodeRelocationSessionBinding(value: RelocationSessionBinding, context: ServiceWireDecoderContext): Uint8Array { const writer = new Writer(); writeRelocationSessionBinding(value, writer, context, {}, 0); return writer.result(); }
|
|
7701
|
+
|
|
7702
|
+
export type RelocationSessionBindingVector = readonly RelocationSessionBinding[];
|
|
7703
|
+
|
|
7704
|
+
function readRelocationSessionBindingVector(reader: Reader, context: ServiceWireDecoderContext, enclosing: any, flags: number): RelocationSessionBindingVector {
|
|
7705
|
+
void context; void enclosing; void flags;
|
|
7706
|
+
const count = Number(readU32(reader, context, enclosing, flags)); if (count > 1024) fail("relocation-session-binding-vector count"); const value: any = Array.from({ length: count }, () => readRelocationSessionBinding(reader, context, enclosing, flags));
|
|
7707
|
+
try { for (let index = 1; index < value.length; ++index) if (compareResults([compareBigint(numeric(value[index - 1]["participantId"]), numeric(value[index]["participantId"]))]) >= 0) fail("relocation-session-binding-vector sorted"); } catch (error) { if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError) throw error; if (error instanceof RangeError) capacityFail("relocation-session-binding-vector constraint capacity"); throw error; }
|
|
7708
|
+
|
|
7709
|
+
return value;
|
|
7710
|
+
}
|
|
7711
|
+
function* readIncrementalRelocationSessionBindingVector(reader: IncrementalInput, context: ServiceWireDecoderContext, enclosing: any, flags: number): Generator<void, RelocationSessionBindingVector, void> {
|
|
7712
|
+
void context; void enclosing; void flags;
|
|
7713
|
+
const count = Number(yield* readIncrementalU32(reader, context, enclosing, flags)); if (count > 1024) fail("relocation-session-binding-vector count"); const value: any[] = []; for (let index = 0; index < count; ++index) { const item = yield* readIncrementalRelocationSessionBinding(reader, context, enclosing, flags); try { value.push(item); } catch { capacityFail("relocation-session-binding-vector capacity"); } }
|
|
7714
|
+
try { for (let index = 1; index < value.length; ++index) if (compareResults([compareBigint(numeric(value[index - 1]["participantId"]), numeric(value[index]["participantId"]))]) >= 0) fail("relocation-session-binding-vector sorted"); } catch (error) { if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError) throw error; if (error instanceof RangeError) capacityFail("relocation-session-binding-vector constraint capacity"); throw error; }
|
|
7715
|
+
|
|
7716
|
+
return value;
|
|
7717
|
+
}
|
|
7718
|
+
function writeRelocationSessionBindingVector(input: RelocationSessionBindingVector, writer: Writer, context: ServiceWireDecoderContext, enclosing: any, flags: number): void {
|
|
7719
|
+
void context; void enclosing; void flags; const value: any = input;
|
|
7720
|
+
if (!Array.isArray(value) || value.length > 1024) fail("relocation-session-binding-vector count");
|
|
7721
|
+
try { for (let index = 1; index < value.length; ++index) if (compareResults([compareBigint(numeric(value[index - 1]["participantId"]), numeric(value[index]["participantId"]))]) >= 0) fail("relocation-session-binding-vector sorted"); } catch (error) { if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError) throw error; if (error instanceof RangeError) capacityFail("relocation-session-binding-vector constraint capacity"); throw error; }
|
|
7722
|
+
|
|
7723
|
+
writeU32(value.length, writer, context, enclosing, flags); for (const item of value) writeRelocationSessionBinding(item, writer, context, enclosing, flags);
|
|
7724
|
+
}
|
|
7725
|
+
export function decodeRelocationSessionBindingVector(bytes: Uint8Array, context: ServiceWireDecoderContext): RelocationSessionBindingVector { const reader = new Reader(bytes); const value = readRelocationSessionBindingVector(reader, context, {}, 0); reader.done("relocation-session-binding-vector"); return value; }
|
|
7726
|
+
export function encodeRelocationSessionBindingVector(value: RelocationSessionBindingVector, context: ServiceWireDecoderContext): Uint8Array { const writer = new Writer(); writeRelocationSessionBindingVector(value, writer, context, {}, 0); return writer.result(); }
|
|
7727
|
+
|
|
7728
|
+
export type RelocationEnvelopeV1 = { readonly relocation: RelocationId; readonly object: RelocationObjectIdentity; readonly applicationVersion: ApplicationVersion; readonly applicationStates: RelocationParticipantApplicationStateVector; readonly savedWork: SavedWorkVector; readonly timerRegistrations: RelocationTimerRegistrationVector; readonly pendingTimerTicks: RelocationPendingTimerTickVector; readonly sessionBindings: RelocationSessionBindingVector };
|
|
7588
7729
|
|
|
7589
7730
|
function readRelocationEnvelopeV1(reader: Reader, context: ServiceWireDecoderContext, enclosing: any, flags: number): RelocationEnvelopeV1 {
|
|
7590
7731
|
void context; void enclosing; void flags;
|
|
@@ -7610,6 +7751,9 @@ function readRelocationEnvelopeV1(reader: Reader, context: ServiceWireDecoderCon
|
|
|
7610
7751
|
value["pendingTimerTicks"] = readRelocationPendingTimerTickVector(reader, context, value, flags);
|
|
7611
7752
|
|
|
7612
7753
|
|
|
7754
|
+
value["sessionBindings"] = readRelocationSessionBindingVector(reader, context, value, flags);
|
|
7755
|
+
|
|
7756
|
+
|
|
7613
7757
|
|
|
7614
7758
|
|
|
7615
7759
|
return value;
|
|
@@ -7638,6 +7782,9 @@ function* readIncrementalRelocationEnvelopeV1(reader: IncrementalInput, context:
|
|
|
7638
7782
|
value["pendingTimerTicks"] = yield* readIncrementalRelocationPendingTimerTickVector(reader, context, value, flags);
|
|
7639
7783
|
|
|
7640
7784
|
|
|
7785
|
+
value["sessionBindings"] = yield* readIncrementalRelocationSessionBindingVector(reader, context, value, flags);
|
|
7786
|
+
|
|
7787
|
+
|
|
7641
7788
|
|
|
7642
7789
|
|
|
7643
7790
|
return value;
|
|
@@ -7674,6 +7821,10 @@ function writeRelocationEnvelopeV1(input: RelocationEnvelopeV1, writer: Writer,
|
|
|
7674
7821
|
|
|
7675
7822
|
|
|
7676
7823
|
writeRelocationPendingTimerTickVector(value["pendingTimerTicks"], writer, context, value, flags);
|
|
7824
|
+
if (value["sessionBindings"] === undefined) fail("sessionBindings required");
|
|
7825
|
+
|
|
7826
|
+
|
|
7827
|
+
writeRelocationSessionBindingVector(value["sessionBindings"], writer, context, value, flags);
|
|
7677
7828
|
}
|
|
7678
7829
|
export function decodeRelocationEnvelopeV1(bytes: Uint8Array, context: ServiceWireDecoderContext): RelocationEnvelopeV1 { const reader = new Reader(bytes); const value = readRelocationEnvelopeV1(reader, context, {}, 0); reader.done("relocation-envelope-v1"); return value; }
|
|
7679
7830
|
export function encodeRelocationEnvelopeV1(value: RelocationEnvelopeV1, context: ServiceWireDecoderContext): Uint8Array { const writer = new Writer(); writeRelocationEnvelopeV1(value, writer, context, {}, 0); return writer.result(); }
|
|
@@ -8705,7 +8856,7 @@ const frames: Uint8Array[] = [writer.result()];
|
|
|
8705
8856
|
return frames; }
|
|
8706
8857
|
export function validateInstanceSpotCommandRuntimePredicates(value: any, context: ServiceWireDecoderContext): void { void value; void context; }
|
|
8707
8858
|
|
|
8708
|
-
export type RelocationPrepareCommand = { readonly command: "relocationPrepare"; readonly flags: number; readonly relocation: RelocationId; readonly targetAttemptGeneration: NonzeroU64; readonly coordinator: RelocationCoordinatorFence; readonly target: RelocationTargetFence; readonly initiatorRole: RelocationRole; readonly object: RelocationObjectIdentity; readonly sourceNodeRid: Rid; readonly sourceNodeGeneration: NonzeroU64; readonly payloadTotalLength: RelocationLogicalLength; readonly payloadChunkCount: RelocationChunkCount; readonly payloadChecksumCrc32c: U32; readonly applicationVersion: ApplicationVersion; };
|
|
8859
|
+
export type RelocationPrepareCommand = { readonly command: "relocationPrepare"; readonly flags: number; readonly relocation: RelocationId; readonly targetAttemptGeneration: NonzeroU64; readonly coordinator: RelocationCoordinatorFence; readonly target: RelocationTargetFence; readonly initiatorRole: RelocationRole; readonly object: RelocationObjectIdentity; readonly sourceNodeRid: Rid; readonly sourceNodeGeneration: NonzeroU64; readonly payloadTotalLength: RelocationLogicalLength; readonly payloadChunkCount: RelocationChunkCount; readonly payloadChecksumCrc32c: U32; readonly applicationVersion: ApplicationVersion; readonly deadlineUnixMs: NonzeroU64; };
|
|
8709
8860
|
export function decodeRelocationPrepareCommand(frames: readonly Uint8Array[], context: ServiceWireDecoderContext): RelocationPrepareCommand { if (!frames.length) fail("relocationPrepare frames"); const reader = new Reader(frames[0]); if (Number(reader.u(1)) !== 90 || Number(reader.u(1)) !== 77 || Number(reader.u(1)) !== 1 || Number(reader.u(1)) !== 40) fail("relocationPrepare header"); const flags = Number(reader.u(1)); if ((flags & ~0) !== 0 || (flags & 0) !== 0) fail("relocationPrepare flags"); const value: any = { command: "relocationPrepare", flags };
|
|
8710
8861
|
value["relocation"] = readRelocationId(reader, context, value, flags);
|
|
8711
8862
|
|
|
@@ -8743,6 +8894,9 @@ export function decodeRelocationPrepareCommand(frames: readonly Uint8Array[], co
|
|
|
8743
8894
|
value["applicationVersion"] = readApplicationVersion(reader, context, value, flags);
|
|
8744
8895
|
|
|
8745
8896
|
|
|
8897
|
+
value["deadlineUnixMs"] = readNonzeroU64(reader, context, value, flags);
|
|
8898
|
+
|
|
8899
|
+
|
|
8746
8900
|
reader.done("relocationPrepare"); let frameIndex = 1;
|
|
8747
8901
|
|
|
8748
8902
|
if (frameIndex !== frames.length) fail("relocationPrepare frames");
|
|
@@ -8797,12 +8951,16 @@ export function encodeRelocationPrepareCommand(value: RelocationPrepareCommand,
|
|
|
8797
8951
|
|
|
8798
8952
|
|
|
8799
8953
|
writeApplicationVersion(numeric(value["applicationVersion"]), writer, context, value, value.flags);
|
|
8954
|
+
if (value["deadlineUnixMs"] === undefined) fail("deadlineUnixMs required");
|
|
8955
|
+
|
|
8956
|
+
|
|
8957
|
+
writeNonzeroU64(numeric(value["deadlineUnixMs"]), writer, context, value, value.flags);
|
|
8800
8958
|
const frames: Uint8Array[] = [writer.result()];
|
|
8801
8959
|
|
|
8802
8960
|
return frames; }
|
|
8803
8961
|
export function validateRelocationPrepareCommandRuntimePredicates(value: any, context: ServiceWireDecoderContext): void { void value; void context; }
|
|
8804
8962
|
|
|
8805
|
-
export type SessionRelocationSealCommand = { readonly command: "sessionRelocationSeal"; readonly flags: number; readonly relocation: RelocationId; readonly coordinator: RelocationCoordinatorFence; readonly senderRole: RelocationRole; readonly actor: ActorRouteFence; readonly sessionOwnerNodeRid: Rid; readonly sessionOwnerNodeGeneration: NonzeroU64; readonly sessionOwnerId: Text8; readonly sessionOwnerLeaseGeneration: NonzeroU64; readonly sessionRid: Rid; readonly bindingGeneration: NonzeroU64; };
|
|
8963
|
+
export type SessionRelocationSealCommand = { readonly command: "sessionRelocationSeal"; readonly flags: number; readonly relocation: RelocationId; readonly coordinator: RelocationCoordinatorFence; readonly senderRole: RelocationRole; readonly actor: ActorRouteFence; readonly sessionOwnerNodeRid: Rid; readonly sessionOwnerNodeGeneration: NonzeroU64; readonly sessionOwnerId: Text8; readonly sessionOwnerLeaseGeneration: NonzeroU64; readonly sessionRid: Rid; readonly bindingGeneration: NonzeroU64; readonly targetNodeRid: Rid; readonly targetNodeGeneration: NonzeroU64; };
|
|
8806
8964
|
export function decodeSessionRelocationSealCommand(frames: readonly Uint8Array[], context: ServiceWireDecoderContext): SessionRelocationSealCommand { if (!frames.length) fail("sessionRelocationSeal frames"); const reader = new Reader(frames[0]); if (Number(reader.u(1)) !== 90 || Number(reader.u(1)) !== 77 || Number(reader.u(1)) !== 1 || Number(reader.u(1)) !== 42) fail("sessionRelocationSeal header"); const flags = Number(reader.u(1)); if ((flags & ~0) !== 0 || (flags & 0) !== 0) fail("sessionRelocationSeal flags"); const value: any = { command: "sessionRelocationSeal", flags };
|
|
8807
8965
|
value["relocation"] = readRelocationId(reader, context, value, flags);
|
|
8808
8966
|
|
|
@@ -8834,6 +8992,12 @@ export function decodeSessionRelocationSealCommand(frames: readonly Uint8Array[]
|
|
|
8834
8992
|
value["bindingGeneration"] = readNonzeroU64(reader, context, value, flags);
|
|
8835
8993
|
|
|
8836
8994
|
|
|
8995
|
+
value["targetNodeRid"] = readRid(reader, context, value, flags);
|
|
8996
|
+
|
|
8997
|
+
|
|
8998
|
+
value["targetNodeGeneration"] = readNonzeroU64(reader, context, value, flags);
|
|
8999
|
+
|
|
9000
|
+
|
|
8837
9001
|
reader.done("sessionRelocationSeal"); let frameIndex = 1;
|
|
8838
9002
|
|
|
8839
9003
|
if (frameIndex !== frames.length) fail("sessionRelocationSeal frames");
|
|
@@ -8880,12 +9044,20 @@ export function encodeSessionRelocationSealCommand(value: SessionRelocationSealC
|
|
|
8880
9044
|
|
|
8881
9045
|
|
|
8882
9046
|
writeNonzeroU64(numeric(value["bindingGeneration"]), writer, context, value, value.flags);
|
|
9047
|
+
if (value["targetNodeRid"] === undefined) fail("targetNodeRid required");
|
|
9048
|
+
|
|
9049
|
+
|
|
9050
|
+
writeRid(value["targetNodeRid"], writer, context, value, value.flags);
|
|
9051
|
+
if (value["targetNodeGeneration"] === undefined) fail("targetNodeGeneration required");
|
|
9052
|
+
|
|
9053
|
+
|
|
9054
|
+
writeNonzeroU64(numeric(value["targetNodeGeneration"]), writer, context, value, value.flags);
|
|
8883
9055
|
const frames: Uint8Array[] = [writer.result()];
|
|
8884
9056
|
|
|
8885
9057
|
return frames; }
|
|
8886
9058
|
export function validateSessionRelocationSealCommandRuntimePredicates(value: any, context: ServiceWireDecoderContext): void { void value; void context; }
|
|
8887
9059
|
|
|
8888
|
-
export type SessionRelocationSealedCommand = { readonly command: "sessionRelocationSealed"; readonly flags: number; readonly relocation: RelocationId; readonly coordinator: RelocationCoordinatorFence; readonly actor: ActorRouteFence; readonly sessionOwnerNodeRid: Rid; readonly sessionOwnerNodeGeneration: NonzeroU64; readonly sessionOwnerId: Text8; readonly sessionOwnerLeaseGeneration: NonzeroU64; readonly sessionRid: Rid; readonly bindingGeneration: NonzeroU64; };
|
|
9060
|
+
export type SessionRelocationSealedCommand = { readonly command: "sessionRelocationSealed"; readonly flags: number; readonly relocation: RelocationId; readonly coordinator: RelocationCoordinatorFence; readonly actor: ActorRouteFence; readonly sessionOwnerNodeRid: Rid; readonly sessionOwnerNodeGeneration: NonzeroU64; readonly sessionOwnerId: Text8; readonly sessionOwnerLeaseGeneration: NonzeroU64; readonly sessionRid: Rid; readonly bindingGeneration: NonzeroU64; readonly sealResult: SessionSealResult; };
|
|
8889
9061
|
export function decodeSessionRelocationSealedCommand(frames: readonly Uint8Array[], context: ServiceWireDecoderContext): SessionRelocationSealedCommand { if (!frames.length) fail("sessionRelocationSealed frames"); const reader = new Reader(frames[0]); if (Number(reader.u(1)) !== 90 || Number(reader.u(1)) !== 77 || Number(reader.u(1)) !== 1 || Number(reader.u(1)) !== 43) fail("sessionRelocationSealed header"); const flags = Number(reader.u(1)); if ((flags & ~0) !== 0 || (flags & 0) !== 0) fail("sessionRelocationSealed flags"); const value: any = { command: "sessionRelocationSealed", flags };
|
|
8890
9062
|
value["relocation"] = readRelocationId(reader, context, value, flags);
|
|
8891
9063
|
|
|
@@ -8914,6 +9086,9 @@ export function decodeSessionRelocationSealedCommand(frames: readonly Uint8Array
|
|
|
8914
9086
|
value["bindingGeneration"] = readNonzeroU64(reader, context, value, flags);
|
|
8915
9087
|
|
|
8916
9088
|
|
|
9089
|
+
value["sealResult"] = readSessionSealResult(reader, context, value, flags);
|
|
9090
|
+
|
|
9091
|
+
|
|
8917
9092
|
reader.done("sessionRelocationSealed"); let frameIndex = 1;
|
|
8918
9093
|
|
|
8919
9094
|
if (frameIndex !== frames.length) fail("sessionRelocationSealed frames");
|
|
@@ -8956,6 +9131,10 @@ export function encodeSessionRelocationSealedCommand(value: SessionRelocationSea
|
|
|
8956
9131
|
|
|
8957
9132
|
|
|
8958
9133
|
writeNonzeroU64(numeric(value["bindingGeneration"]), writer, context, value, value.flags);
|
|
9134
|
+
if (value["sealResult"] === undefined) fail("sealResult required");
|
|
9135
|
+
|
|
9136
|
+
|
|
9137
|
+
writeSessionSealResult(value["sealResult"], writer, context, value, value.flags);
|
|
8959
9138
|
const frames: Uint8Array[] = [writer.result()];
|
|
8960
9139
|
|
|
8961
9140
|
return frames; }
|
|
@@ -9470,7 +9649,41 @@ const frames: Uint8Array[] = [writer.result()];
|
|
|
9470
9649
|
return frames; }
|
|
9471
9650
|
export function validateRelocationFailedCommandRuntimePredicates(value: any, context: ServiceWireDecoderContext): void { void value; void context; }
|
|
9472
9651
|
|
|
9473
|
-
export type
|
|
9652
|
+
export type BoundSessionCloseCommand = { readonly command: "boundSessionClose"; readonly flags: number; readonly correlation: NonzeroU64; readonly actor: ActorRef; readonly session: RetiredBoundSessionRouteFence; };
|
|
9653
|
+
export function decodeBoundSessionCloseCommand(frames: readonly Uint8Array[], context: ServiceWireDecoderContext): BoundSessionCloseCommand { if (!frames.length) fail("boundSessionClose frames"); const reader = new Reader(frames[0]); if (Number(reader.u(1)) !== 90 || Number(reader.u(1)) !== 77 || Number(reader.u(1)) !== 1 || Number(reader.u(1)) !== 54) fail("boundSessionClose header"); const flags = Number(reader.u(1)); if ((flags & ~0) !== 0 || (flags & 0) !== 0) fail("boundSessionClose flags"); const value: any = { command: "boundSessionClose", flags };
|
|
9654
|
+
value["correlation"] = readNonzeroU64(reader, context, value, flags);
|
|
9655
|
+
|
|
9656
|
+
|
|
9657
|
+
value["actor"] = readActorRef(reader, context, value, flags);
|
|
9658
|
+
|
|
9659
|
+
|
|
9660
|
+
value["session"] = readRetiredBoundSessionRouteFence(reader, context, value, flags);
|
|
9661
|
+
|
|
9662
|
+
|
|
9663
|
+
reader.done("boundSessionClose"); let frameIndex = 1;
|
|
9664
|
+
|
|
9665
|
+
if (frameIndex !== frames.length) fail("boundSessionClose frames");
|
|
9666
|
+
|
|
9667
|
+
return value; }
|
|
9668
|
+
export function encodeBoundSessionCloseCommand(value: BoundSessionCloseCommand, context: ServiceWireDecoderContext): readonly Uint8Array[] { if ((value.flags & ~0) !== 0 || (value.flags & 0) !== 0) fail("boundSessionClose flags"); const writer = new Writer(); writer.put([90,77, 1, 54, value.flags]);
|
|
9669
|
+
if (value["correlation"] === undefined) fail("correlation required");
|
|
9670
|
+
|
|
9671
|
+
|
|
9672
|
+
writeNonzeroU64(numeric(value["correlation"]), writer, context, value, value.flags);
|
|
9673
|
+
if (value["actor"] === undefined) fail("actor required");
|
|
9674
|
+
|
|
9675
|
+
|
|
9676
|
+
writeActorRef(value["actor"], writer, context, value, value.flags);
|
|
9677
|
+
if (value["session"] === undefined) fail("session required");
|
|
9678
|
+
|
|
9679
|
+
|
|
9680
|
+
writeRetiredBoundSessionRouteFence(value["session"], writer, context, value, value.flags);
|
|
9681
|
+
const frames: Uint8Array[] = [writer.result()];
|
|
9682
|
+
|
|
9683
|
+
return frames; }
|
|
9684
|
+
export function validateBoundSessionCloseCommandRuntimePredicates(value: any, context: ServiceWireDecoderContext): void { void value; void context; }
|
|
9685
|
+
|
|
9686
|
+
export type ServiceWireCommand = HelloCommand | AdmitCommand | RejectCommand | UpdateCommand | LivenessProbeCommand | LivenessAckCommand | NodeSendCommand | NodeRequestCommand | ChannelSendCommand | ChannelRequestCommand | ReplyCommand | SpotSendCommand | SpotRequestCommand | LogicalMulticastCommand | ActorSendCommand | ActorRequestCommand | ActorLookupCommand | ActorDestroyCommand | ActorJoinCommand | ActorLeftCommand | RelocationReadyCommand | RelocationDataCommand | ReplyRelayCommand | RelocationCutoverCommand | BoundSessionSendCommand | ActorJoinedCommand | BoundSessionBindCommand | InstanceSpotCommand | RelocationPrepareCommand | SessionRelocationSealCommand | SessionRelocationSealedCommand | SessionRelocationRouteCommand | ReplyRelayAckCommand | UserSpotCreateCommand | UserSpotCloseCommand | ActorCreateCommand | MessageFollowCommand | BoundSessionReplacedCommand | RelocationStateCommand | RelocationFailedCommand | BoundSessionCloseCommand;
|
|
9474
9687
|
|
|
9475
9688
|
export function decodeAuthorityPayloadV1DurableFormat(bytes: Uint8Array, context: ServiceWireDecoderContext): AuthorityPayloadV1 { if (bytes.length > 1048576) 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) fail("authority-payload-v1 header"); const flags = readU16(reader, context, {}, 0); if (!same(flags, 0)) fail("authority-payload-v1 flags"); const length = Number(readU32(reader, context, {}, 0)); const body = reader.take(length); const checksumOffset = reader.offset; const declared = Number(reader.u(4)); reader.done("authority-payload-v1"); if (crc32c(bytes.slice(0, checksumOffset)) !== declared) fail("authority-payload-v1 checksum"); return decodeAuthorityPayloadV1(body, context); }
|
|
9476
9689
|
export function encodeAuthorityPayloadV1DurableFormat(value: AuthorityPayloadV1, context: ServiceWireDecoderContext): Uint8Array { const body = encodeAuthorityPayloadV1(value, context); const writer = new Writer(); writer.put([90,76,65,85, 1]); writeU16(0, writer, context, {}, 0); writeU32(body.length, writer, context, {}, 0); writer.put(body); writer.u(BigInt(crc32c(writer.result())), 4); const bytes = writer.result(); if (bytes.length > 1048576) fail("authority-payload-v1 maximum"); return bytes; }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// <auto-generated> DO NOT EDIT. schema-sha256:
|
|
1
|
+
// <auto-generated> DO NOT EDIT. schema-sha256: 9ccb179e5231ac7a42bfa09ab1b5b9ea942ee17567e0db19023a6cba30c2e044
|
|
2
2
|
export interface ServiceWireRouteFence { readonly id: string; readonly generation: bigint; readonly targetNodeRid: Uint8Array; readonly targetNodeGeneration: bigint; readonly expectedAuthorityOwnerGeneration: bigint; readonly expectedOwnerLeaseGeneration: bigint; }
|
|
3
3
|
export interface ApplicationPayloadEnvelopeV1 { readonly packetName: string; readonly contentType: string; readonly payload: Uint8Array; }
|
|
4
4
|
export interface ActorJoin28 { readonly correlation: bigint; readonly actor: ServiceWireRouteFence; readonly entry: boolean; readonly targetSpot: ServiceWireRouteFence; readonly payload?: ApplicationPayloadEnvelopeV1; }
|
|
@@ -19,7 +19,7 @@ export interface ServiceWireRouteFence { readonly id: string; readonly generatio
|
|
|
19
19
|
export function encodeActorJoin28(value: ActorJoin28): readonly Uint8Array[] { const out=[90,77,1,28,0]; if(value.correlation===0n) throw new RangeError("correlation"); u64(out,value.correlation); fence(out,value.actor); out.push(value.entry?1:0); fence(out,value.targetSpot); return value.payload===undefined?[Uint8Array.from(out)]:[Uint8Array.from(out),encodePayload(value.payload)]; }
|
|
20
20
|
export function decodeActorJoin28(frames: readonly Uint8Array[]): ActorJoin28 { if(frames.length<1||frames.length>2)throw new RangeError("actorJoin frames");const bytes=frames[0]!; const at={value:0}; if(bytes.length<5 || bytes[at.value++]!==90 || bytes[at.value++]!==77 || bytes[at.value++]!==1 || bytes[at.value++]!==28 || bytes[at.value++]!==0) throw new RangeError("actorJoin header"); const correlation=read64(bytes,at); const actor=readFence(bytes,at); const entry=bytes[at.value++]; const targetSpot=readFence(bytes,at); if(correlation===0n || entry>1 || at.value!==bytes.length) throw new RangeError("actorJoin body"); const payload=frames.length===2?decodePayload(frames[1]!):undefined; return payload===undefined?{ correlation, actor, entry:entry===1, targetSpot }:{ correlation, actor, entry:entry===1, targetSpot,payload }; }
|
|
21
21
|
export type RelocationObjectIdentity = { readonly objectKind:"actor";readonly actorId:string;readonly objectGeneration:bigint;readonly expectedAuthorityOwnerGeneration:bigint; }|{ readonly objectKind:"userSpot";readonly spotId:string;readonly objectGeneration:bigint;readonly expectedAuthorityOwnerGeneration:bigint; }|{ readonly objectKind:"instanceSpot";readonly instanceType:string;readonly spotId:string;readonly objectGeneration:bigint; };
|
|
22
|
-
export interface RelocationEnvelopeV1 { readonly relocationHigh: bigint; readonly relocationLow: bigint; readonly object: RelocationObjectIdentity; readonly applicationVersion: bigint; readonly applicationStates: readonly { readonly participantId: bigint; readonly hasState: boolean; readonly payload: Uint8Array; }[]; readonly savedWork: readonly { readonly participantId: bigint; readonly order: bigint; readonly frozenRecord: Uint8Array; }[]; readonly timerRegistrations: readonly { readonly participantId: bigint; readonly name: string; readonly handlerType: string; readonly periodMilliseconds: bigint; readonly overrunPolicy: 1|2|3; readonly maxCatchUpTicks: bigint; readonly stopOnUnhandledException: boolean; readonly lastCompletedDeliveryIndex: bigint; readonly lastCompletedScheduledIndex: bigint; readonly nextScheduledAtUnixMilliseconds: bigint; }[]; readonly pendingTimerTicks: readonly { readonly participantId: bigint; readonly order: bigint; readonly timerName: string; readonly deliveryIndex: bigint; readonly scheduledIndex: bigint; readonly scheduledAtUnixMilliseconds: bigint; readonly skippedTicks: bigint; }[]; }
|
|
22
|
+
export interface RelocationEnvelopeV1 { readonly relocationHigh: bigint; readonly relocationLow: bigint; readonly object: RelocationObjectIdentity; readonly applicationVersion: bigint; readonly applicationStates: readonly { readonly participantId: bigint; readonly hasState: boolean; readonly payload: Uint8Array; }[]; readonly savedWork: readonly { readonly participantId: bigint; readonly order: bigint; readonly frozenRecord: Uint8Array; }[]; readonly timerRegistrations: readonly { readonly participantId: bigint; readonly name: string; readonly handlerType: string; readonly periodMilliseconds: bigint; readonly overrunPolicy: 1|2|3; readonly maxCatchUpTicks: bigint; readonly stopOnUnhandledException: boolean; readonly lastCompletedDeliveryIndex: bigint; readonly lastCompletedScheduledIndex: bigint; readonly nextScheduledAtUnixMilliseconds: bigint; }[]; readonly pendingTimerTicks: readonly { readonly participantId: bigint; readonly order: bigint; readonly timerName: string; readonly deliveryIndex: bigint; readonly scheduledIndex: bigint; readonly scheduledAtUnixMilliseconds: bigint; readonly skippedTicks: bigint; }[]; readonly sessionBindings: readonly {readonly participantId:bigint;readonly sessionOwnerNodeRid:Uint8Array;readonly sessionOwnerNodeGeneration:bigint;readonly sessionOwnerId:string;readonly sessionOwnerLeaseGeneration:bigint;readonly sessionRid:Uint8Array;readonly bindingGeneration:bigint;}[]; }
|
|
23
23
|
export interface RelocationDataChunkV1 { readonly order:number;readonly data:Uint8Array; }
|
|
24
24
|
export interface RelocationChunkEntryV1 { readonly order:number;readonly reference:string;readonly length:bigint;readonly checksumCrc32c:number; }
|
|
25
25
|
export interface RelocationManifestV1 { readonly logicalFormatVersion:1;readonly totalLength:bigint;readonly totalChecksumCrc32c:number;readonly inventoryDigestSha256:Uint8Array;readonly chunks:readonly RelocationChunkEntryV1[]; }
|
|
@@ -51,8 +51,8 @@ function skipFrozenRecord(bytes:Uint8Array,at:{value:number}):void{const kind=re
|
|
|
51
51
|
function compareUtf8(a:string,b:string):number{const x=text.encode(a),y=text.encode(b),n=Math.min(x.length,y.length);for(let i=0;i<n;i++)if(x[i]!==y[i])return x[i]!-y[i]!;return x.length-y.length;}
|
|
52
52
|
function writeRelocationObject(out:number[],value:RelocationObjectIdentity):void{const kind=value.objectKind==="actor"?1:value.objectKind==="userSpot"?2:3;out.push(kind);body16(out,b=>{if(value.objectKind==="actor"){text8(b,value.actorId);if(value.objectGeneration===0n||value.expectedAuthorityOwnerGeneration===0n)throw new RangeError("object");u64(b,value.objectGeneration);u64(b,value.expectedAuthorityOwnerGeneration);}else if(value.objectKind==="userSpot"){text8(b,value.spotId);if(value.objectGeneration===0n||value.expectedAuthorityOwnerGeneration===0n)throw new RangeError("object");u64(b,value.objectGeneration);u64(b,value.expectedAuthorityOwnerGeneration);}else{text8(b,value.instanceType);text8(b,value.spotId);if(value.objectGeneration===0n)throw new RangeError("object");u64(b,value.objectGeneration);}});}
|
|
53
53
|
function readRelocationObject(bytes:Uint8Array,at:{value:number}):RelocationObjectIdentity{const kind=read8(bytes,at),end=boundedEnd(bytes,at,read16(bytes,at),"relocation object");let value:RelocationObjectIdentity;if(kind===1)value={objectKind:"actor",actorId:readText8(bytes,at),objectGeneration:nonzero64(bytes,at,"object generation"),expectedAuthorityOwnerGeneration:nonzero64(bytes,at,"authority generation")};else if(kind===2)value={objectKind:"userSpot",spotId:readText8(bytes,at),objectGeneration:nonzero64(bytes,at,"object generation"),expectedAuthorityOwnerGeneration:nonzero64(bytes,at,"authority generation")};else if(kind===3)value={objectKind:"instanceSpot",instanceType:readText8(bytes,at),spotId:readText8(bytes,at),objectGeneration:nonzero64(bytes,at,"object generation")};else throw new RangeError("object kind");exactEnd(at,end,"relocation object");return value;}
|
|
54
|
-
export function encodeRelocationEnvelopeV1(value:RelocationEnvelopeV1):Uint8Array{const out:number[]=[];if(value.relocationHigh===0n&&value.relocationLow===0n)throw new RangeError("relocation");u64(out,value.relocationHigh);u64(out,value.relocationLow);writeRelocationObject(out,value.object);if(value.applicationVersion<0n||value.applicationVersion>9223372036854775807n)throw new RangeError("application version");u64(out,value.applicationVersion);sorted(value.applicationStates,(a,b)=>a.participantId<b.participantId?-1:a.participantId>b.participantId?1:0,"applicationStates");if(value.applicationStates.length===0)throw new RangeError("applicationStates");u32(out,value.applicationStates.length);for(const s of value.applicationStates){if(s.participantId===0n)throw new RangeError("participant");u64(out,s.participantId);out.push(s.hasState?1:0);body64(out,b=>{if(s.hasState)bytes64(b,s.payload);else if(s.payload.length!==0)throw new RangeError("absent state payload");});}sorted(value.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");u32(out,value.savedWork.length);for(const w of value.savedWork){if(w.participantId===0n||w.order===0n)throw new RangeError("saved work");const at={value:0};skipFrozenRecord(w.frozenRecord,at);exactEnd(at,w.frozenRecord.length,"frozen record");u64(out,w.participantId);u64(out,w.order);appendBytes(out,w.frozenRecord);}sorted(value.timerRegistrations,(a,b)=>a.participantId===b.participantId?compareUtf8(a.name,b.name):a.participantId<b.participantId?-1:1,"timerRegistrations");u32(out,value.timerRegistrations.length);for(const t of value.timerRegistrations){if(t.participantId===0n||t.periodMilliseconds===0n||t.maxCatchUpTicks===0n||t.overrunPolicy<1||t.overrunPolicy>3)throw new RangeError("timer");u64(out,t.participantId);text8(out,t.name);text8(out,t.handlerType);u64(out,t.periodMilliseconds);out.push(t.overrunPolicy);u64(out,t.maxCatchUpTicks);out.push(t.stopOnUnhandledException?1:0);u64(out,t.lastCompletedDeliveryIndex);u64(out,t.lastCompletedScheduledIndex);u64(out,t.nextScheduledAtUnixMilliseconds);}sorted(value.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");u32(out,value.pendingTimerTicks.length);for(const p of value.pendingTimerTicks){if(p.participantId===0n||p.order===0n||p.deliveryIndex===0n||p.scheduledIndex===0n)throw new RangeError("pending timer");u64(out,p.participantId);u64(out,p.order);text8(out,p.timerName);u64(out,p.deliveryIndex);u64(out,p.scheduledIndex);u64(out,p.scheduledAtUnixMilliseconds);u64(out,p.skippedTicks);}if(out.length>274877906944)throw new RangeError("relocation logical bytes");return Uint8Array.from(out);}
|
|
55
|
-
export function decodeRelocationEnvelopeV1(chunks:readonly Uint8Array[]):RelocationEnvelopeV1{const n=chunks.reduce((s,c)=>s+c.length,0);if(n>274877906944)throw new RangeError("relocation logical bytes");const bytes=new Uint8Array(n);let offset=0;for(const c of chunks){bytes.set(c,offset);offset+=c.length;}const at={value:0},relocationHigh=read64(bytes,at),relocationLow=read64(bytes,at);if(relocationHigh===0n&&relocationLow===0n)throw new RangeError("relocation");const object=readRelocationObject(bytes,at),applicationVersion=read64(bytes,at);if(applicationVersion>9223372036854775807n)throw new RangeError("application version");const applicationStates:RelocationEnvelopeV1["applicationStates"][number][]=[];const stateCount=read32(bytes,at);if(stateCount===0)throw new RangeError("applicationStates");for(let i=0,count=stateCount;i<count;i++){const participantId=nonzero64(bytes,at,"participant"),has=read8(bytes,at),end=boundedEnd(bytes,at,Number(read64(bytes,at)),"application state");if(has>1)throw new RangeError("application state");let payload=new Uint8Array();if(has===1)payload=take(bytes,at,Number(read64(bytes,at)),"state payload");exactEnd(at,end,"application state");applicationStates.push({participantId,hasState:has===1,payload});}const participants=new Set(applicationStates.map((s)=>s.participantId));const savedWork:RelocationEnvelopeV1["savedWork"][number][]=[];for(let i=0,count=read32(bytes,at);i<count;i++){const participantId=nonzero64(bytes,at,"participant");if(!participants.has(participantId))throw new RangeError("saved work participant");const order=nonzero64(bytes,at,"order"),start=at.value;skipFrozenRecord(bytes,at);savedWork.push({participantId,order,frozenRecord:bytes.slice(start,at.value)});}const timerRegistrations:RelocationEnvelopeV1["timerRegistrations"][number][]=[],registeredTimerNames=new Map<bigint,Set<string>>();for(let i=0,count=read32(bytes,at);i<count;i++){const participantId=nonzero64(bytes,at,"participant");if(!participants.has(participantId))throw new RangeError("timer participant");const name=readText8(bytes,at),handlerType=readText8(bytes,at),periodMilliseconds=nonzero64(bytes,at,"period"),overrunPolicy=read8(bytes,at);if(overrunPolicy<1||overrunPolicy>3)throw new RangeError("overrun policy");const maxCatchUpTicks=nonzero64(bytes,at,"catch-up"),stop=read8(bytes,at);if(stop>1)throw new RangeError("stop flag");let names=registeredTimerNames.get(participantId);if(names===undefined){names=new Set<string>();registeredTimerNames.set(participantId,names);}names.add(name);timerRegistrations.push({participantId,name,handlerType,periodMilliseconds,overrunPolicy:overrunPolicy as 1|2|3,maxCatchUpTicks,stopOnUnhandledException:stop===1,lastCompletedDeliveryIndex:read64(bytes,at),lastCompletedScheduledIndex:read64(bytes,at),nextScheduledAtUnixMilliseconds:read64(bytes,at)});}const pendingTimerTicks:RelocationEnvelopeV1["pendingTimerTicks"][number][]=[];for(let i=0,count=read32(bytes,at);i<count;i++){const participantId=nonzero64(bytes,at,"participant");if(!participants.has(participantId))throw new RangeError("pending timer participant");const order=nonzero64(bytes,at,"order"),timerName=readText8(bytes,at);if(registeredTimerNames.get(participantId)?.has(timerName)!==true)throw new RangeError("pending timer registration");pendingTimerTicks.push({participantId,order,timerName,deliveryIndex:nonzero64(bytes,at,"delivery"),scheduledIndex:nonzero64(bytes,at,"scheduled"),scheduledAtUnixMilliseconds:read64(bytes,at),skippedTicks:read64(bytes,at)});}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};}
|
|
54
|
+
export function encodeRelocationEnvelopeV1(value:RelocationEnvelopeV1):Uint8Array{const out:number[]=[];if(value.relocationHigh===0n&&value.relocationLow===0n)throw new RangeError("relocation");u64(out,value.relocationHigh);u64(out,value.relocationLow);writeRelocationObject(out,value.object);if(value.applicationVersion<0n||value.applicationVersion>9223372036854775807n)throw new RangeError("application version");u64(out,value.applicationVersion);sorted(value.applicationStates,(a,b)=>a.participantId<b.participantId?-1:a.participantId>b.participantId?1:0,"applicationStates");if(value.applicationStates.length===0)throw new RangeError("applicationStates");u32(out,value.applicationStates.length);for(const s of value.applicationStates){if(s.participantId===0n)throw new RangeError("participant");u64(out,s.participantId);out.push(s.hasState?1:0);body64(out,b=>{if(s.hasState)bytes64(b,s.payload);else if(s.payload.length!==0)throw new RangeError("absent state payload");});}sorted(value.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");u32(out,value.savedWork.length);for(const w of value.savedWork){if(w.participantId===0n||w.order===0n)throw new RangeError("saved work");const at={value:0};skipFrozenRecord(w.frozenRecord,at);exactEnd(at,w.frozenRecord.length,"frozen record");u64(out,w.participantId);u64(out,w.order);appendBytes(out,w.frozenRecord);}sorted(value.timerRegistrations,(a,b)=>a.participantId===b.participantId?compareUtf8(a.name,b.name):a.participantId<b.participantId?-1:1,"timerRegistrations");u32(out,value.timerRegistrations.length);for(const t of value.timerRegistrations){if(t.participantId===0n||t.periodMilliseconds===0n||t.maxCatchUpTicks===0n||t.overrunPolicy<1||t.overrunPolicy>3)throw new RangeError("timer");u64(out,t.participantId);text8(out,t.name);text8(out,t.handlerType);u64(out,t.periodMilliseconds);out.push(t.overrunPolicy);u64(out,t.maxCatchUpTicks);out.push(t.stopOnUnhandledException?1:0);u64(out,t.lastCompletedDeliveryIndex);u64(out,t.lastCompletedScheduledIndex);u64(out,t.nextScheduledAtUnixMilliseconds);}sorted(value.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");u32(out,value.pendingTimerTicks.length);for(const p of value.pendingTimerTicks){if(p.participantId===0n||p.order===0n||p.deliveryIndex===0n||p.scheduledIndex===0n)throw new RangeError("pending timer");u64(out,p.participantId);u64(out,p.order);text8(out,p.timerName);u64(out,p.deliveryIndex);u64(out,p.scheduledIndex);u64(out,p.scheduledAtUnixMilliseconds);u64(out,p.skippedTicks);}sorted(value.sessionBindings,(a,b)=>a.participantId<b.participantId?-1:a.participantId>b.participantId?1:0,"sessionBindings");if(value.sessionBindings.length>1024)throw new RangeError("bindings count");u32(out,value.sessionBindings.length);for(const b of value.sessionBindings){if(b.participantId===0n||b.sessionOwnerNodeGeneration===0n||b.sessionOwnerLeaseGeneration===0n||b.bindingGeneration===0n)throw new RangeError("binding");u64(out,b.participantId);rid(out,b.sessionOwnerNodeRid);u64(out,b.sessionOwnerNodeGeneration);text8(out,b.sessionOwnerId);u64(out,b.sessionOwnerLeaseGeneration);rid(out,b.sessionRid);u64(out,b.bindingGeneration);}if(out.length>274877906944)throw new RangeError("relocation logical bytes");return Uint8Array.from(out);}
|
|
55
|
+
export function decodeRelocationEnvelopeV1(chunks:readonly Uint8Array[]):RelocationEnvelopeV1{const n=chunks.reduce((s,c)=>s+c.length,0);if(n>274877906944)throw new RangeError("relocation logical bytes");const bytes=new Uint8Array(n);let offset=0;for(const c of chunks){bytes.set(c,offset);offset+=c.length;}const at={value:0},relocationHigh=read64(bytes,at),relocationLow=read64(bytes,at);if(relocationHigh===0n&&relocationLow===0n)throw new RangeError("relocation");const object=readRelocationObject(bytes,at),applicationVersion=read64(bytes,at);if(applicationVersion>9223372036854775807n)throw new RangeError("application version");const applicationStates:RelocationEnvelopeV1["applicationStates"][number][]=[];const stateCount=read32(bytes,at);if(stateCount===0)throw new RangeError("applicationStates");for(let i=0,count=stateCount;i<count;i++){const participantId=nonzero64(bytes,at,"participant"),has=read8(bytes,at),end=boundedEnd(bytes,at,Number(read64(bytes,at)),"application state");if(has>1)throw new RangeError("application state");let payload=new Uint8Array();if(has===1)payload=take(bytes,at,Number(read64(bytes,at)),"state payload");exactEnd(at,end,"application state");applicationStates.push({participantId,hasState:has===1,payload});}const participants=new Set(applicationStates.map((s)=>s.participantId));const savedWork:RelocationEnvelopeV1["savedWork"][number][]=[];for(let i=0,count=read32(bytes,at);i<count;i++){const participantId=nonzero64(bytes,at,"participant");if(!participants.has(participantId))throw new RangeError("saved work participant");const order=nonzero64(bytes,at,"order"),start=at.value;skipFrozenRecord(bytes,at);savedWork.push({participantId,order,frozenRecord:bytes.slice(start,at.value)});}const timerRegistrations:RelocationEnvelopeV1["timerRegistrations"][number][]=[],registeredTimerNames=new Map<bigint,Set<string>>();for(let i=0,count=read32(bytes,at);i<count;i++){const participantId=nonzero64(bytes,at,"participant");if(!participants.has(participantId))throw new RangeError("timer participant");const name=readText8(bytes,at),handlerType=readText8(bytes,at),periodMilliseconds=nonzero64(bytes,at,"period"),overrunPolicy=read8(bytes,at);if(overrunPolicy<1||overrunPolicy>3)throw new RangeError("overrun policy");const maxCatchUpTicks=nonzero64(bytes,at,"catch-up"),stop=read8(bytes,at);if(stop>1)throw new RangeError("stop flag");let names=registeredTimerNames.get(participantId);if(names===undefined){names=new Set<string>();registeredTimerNames.set(participantId,names);}names.add(name);timerRegistrations.push({participantId,name,handlerType,periodMilliseconds,overrunPolicy:overrunPolicy as 1|2|3,maxCatchUpTicks,stopOnUnhandledException:stop===1,lastCompletedDeliveryIndex:read64(bytes,at),lastCompletedScheduledIndex:read64(bytes,at),nextScheduledAtUnixMilliseconds:read64(bytes,at)});}const pendingTimerTicks:RelocationEnvelopeV1["pendingTimerTicks"][number][]=[];for(let i=0,count=read32(bytes,at);i<count;i++){const participantId=nonzero64(bytes,at,"participant");if(!participants.has(participantId))throw new RangeError("pending timer participant");const order=nonzero64(bytes,at,"order"),timerName=readText8(bytes,at);if(registeredTimerNames.get(participantId)?.has(timerName)!==true)throw new RangeError("pending timer registration");pendingTimerTicks.push({participantId,order,timerName,deliveryIndex:nonzero64(bytes,at,"delivery"),scheduledIndex:nonzero64(bytes,at,"scheduled"),scheduledAtUnixMilliseconds:read64(bytes,at),skippedTicks:read64(bytes,at)});}const sessionBindings:RelocationEnvelopeV1["sessionBindings"][number][]=[];const bindingCount=read32(bytes,at);if(bindingCount>1024)throw new RangeError("bindings count");for(let n=0;n<bindingCount;n++)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};}
|
|
56
56
|
function crc32c(bytes:Uint8Array):number{let crc=0xffffffff;for(const octet of bytes){crc^=octet;for(let bit=0;bit<8;bit++)crc=(crc>>>1)^((crc&1)!==0?0x82f63b78:0);}return(~crc)>>>0;}
|
|
57
57
|
function encodeDurable(magic:readonly number[],body:readonly number[],maximum:number):Uint8Array{const out=[...magic,1,0,0];u32(out,body.length);appendBytes(out,body);if(out.length+4>maximum)throw new RangeError("durable format bytes");u32(out,crc32c(Uint8Array.from(out)));return Uint8Array.from(out);}
|
|
58
58
|
function decodeDurable(bytes:Uint8Array,magic:readonly number[],maximum:number):Uint8Array{if(bytes.length>maximum||bytes.length<15||magic.some((v,i)=>bytes[i]!==v)||bytes[4]!==1||bytes[5]!==0||bytes[6]!==0)throw new RangeError("durable header");const at={value:7},length=read32(bytes,at),end=boundedEnd(bytes,at,length,"durable body");if(end+4!==bytes.length)throw new RangeError("durable length");const body=bytes.slice(at.value,end);at.value=end;const expected=read32(bytes,at);if(crc32c(bytes.slice(0,end))!==expected)throw new RangeError("durable checksum");return body;}
|
|
@@ -102,9 +102,12 @@ export interface ReplyRelayAck46 {readonly relocation:ServiceWireRelocationId;re
|
|
|
102
102
|
export interface RelocationReady30 {readonly relocation:ServiceWireRelocationId;readonly targetAttemptGeneration:bigint;readonly coordinator:ServiceWireCoordinatorFence;readonly target:ServiceWireTargetFence;readonly object:RelocationObjectIdentity;readonly senderRole:ServiceWireRelocationRole;}
|
|
103
103
|
export interface RelocationData31 {readonly relocation:ServiceWireRelocationId;readonly targetAttemptGeneration:bigint;readonly coordinator:ServiceWireCoordinatorFence;readonly senderRole:ServiceWireRelocationRole;readonly object:RelocationObjectIdentity;readonly record:Uint8Array;}
|
|
104
104
|
export interface RelocationCutover34 {readonly relocation:ServiceWireRelocationId;readonly targetAttemptGeneration:bigint;readonly coordinator:ServiceWireCoordinatorFence;readonly senderRole:ServiceWireRelocationRole;readonly object:RelocationObjectIdentity;readonly boundaryRecordCount:bigint;readonly boundaryChecksumCrc32c:number;}
|
|
105
|
-
export interface RelocationPrepare40 {readonly relocation:ServiceWireRelocationId;readonly targetAttemptGeneration:bigint;readonly coordinator:ServiceWireCoordinatorFence;readonly target:ServiceWireTargetFence;readonly initiatorRole:ServiceWireRelocationRole;readonly object:RelocationObjectIdentity;readonly sourceNodeRid:Uint8Array;readonly sourceNodeGeneration:bigint;readonly payloadTotalLength:bigint;readonly payloadChunkCount:number;readonly payloadChecksumCrc32c:number;readonly applicationVersion:bigint;}
|
|
106
|
-
export interface SessionRelocationSeal42 {readonly relocation:ServiceWireRelocationId;readonly coordinator:ServiceWireCoordinatorFence;readonly senderRole:ServiceWireRelocationRole;readonly actor:ServiceWireRouteFence;readonly sessionOwnerNodeRid:Uint8Array;readonly sessionOwnerNodeGeneration:bigint;readonly sessionOwnerId:string;readonly sessionOwnerLeaseGeneration:bigint;readonly sessionRid:Uint8Array;readonly bindingGeneration:bigint;}
|
|
107
|
-
export type
|
|
105
|
+
export interface RelocationPrepare40 {readonly relocation:ServiceWireRelocationId;readonly targetAttemptGeneration:bigint;readonly coordinator:ServiceWireCoordinatorFence;readonly target:ServiceWireTargetFence;readonly initiatorRole:ServiceWireRelocationRole;readonly object:RelocationObjectIdentity;readonly sourceNodeRid:Uint8Array;readonly sourceNodeGeneration:bigint;readonly payloadTotalLength:bigint;readonly payloadChunkCount:number;readonly payloadChecksumCrc32c:number;readonly applicationVersion:bigint;readonly deadlineUnixMs:bigint;}
|
|
106
|
+
export interface SessionRelocationSeal42 {readonly relocation:ServiceWireRelocationId;readonly coordinator:ServiceWireCoordinatorFence;readonly senderRole:ServiceWireRelocationRole;readonly actor:ServiceWireRouteFence;readonly sessionOwnerNodeRid:Uint8Array;readonly sessionOwnerNodeGeneration:bigint;readonly sessionOwnerId:string;readonly sessionOwnerLeaseGeneration:bigint;readonly sessionRid:Uint8Array;readonly bindingGeneration:bigint;readonly targetNodeRid:Uint8Array;readonly targetNodeGeneration:bigint;}
|
|
107
|
+
export type ServiceWireSessionSealResult="sealed"|"bindingAbsent";
|
|
108
|
+
export type SessionRelocationSealed43=Omit<SessionRelocationSeal42,"senderRole"|"targetNodeRid"|"targetNodeGeneration">&{readonly sealResult:ServiceWireSessionSealResult};
|
|
109
|
+
function b3WriteSealResult(o:number[],v:ServiceWireSessionSealResult):void{switch(v){case "sealed":o.push(1);return;case "bindingAbsent":o.push(2);return;default:throw new RangeError("sealResult");}}
|
|
110
|
+
function b3ReadSealResult(bytes:Uint8Array,at:{value:number}):ServiceWireSessionSealResult{switch(read8(bytes,at)){case 1:return "sealed";case 2:return "bindingAbsent";default:throw new RangeError("sealResult");}}
|
|
108
111
|
export interface SessionRelocationRoute44 {readonly relocation:ServiceWireRelocationId;readonly coordinator:ServiceWireCoordinatorFence;readonly senderRole:ServiceWireRelocationRole;readonly actor:ServiceWireActorRef;readonly sessionOwnerNodeRid:Uint8Array;readonly sessionOwnerNodeGeneration:bigint;readonly sessionOwnerId:string;readonly sessionOwnerLeaseGeneration:bigint;readonly sessionRid:Uint8Array;readonly bindingGeneration:bigint;readonly route:ServiceWireSessionRouteUpdate;}
|
|
109
112
|
export interface RelocationState52 {readonly relocation:ServiceWireRelocationId;readonly targetAttemptGeneration:bigint;readonly coordinator:ServiceWireCoordinatorFence;readonly senderRole:ServiceWireRelocationRole;readonly object:RelocationObjectIdentity;readonly chunkOrdinal:number;readonly chunkData:Uint8Array;}
|
|
110
113
|
export interface RelocationFailed53 {readonly relocation:ServiceWireRelocationId;readonly targetAttemptGeneration:bigint;readonly coordinator:ServiceWireCoordinatorFence;readonly target:ServiceWireTargetFence;readonly object:RelocationObjectIdentity;readonly senderRole:ServiceWireRelocationRole;readonly failureCode:number;}
|
|
@@ -151,14 +154,14 @@ export function encodeRelocationCutover34(v:RelocationCutover34):Uint8Array{cons
|
|
|
151
154
|
export function decodeRelocationCutover34(bytes:Uint8Array):RelocationCutover34{const at=b3ReadHeader(bytes,34,"relocationCutover"),v=b3ReadSourceBase(bytes,at),boundaryRecordCount=read64(bytes,at);if(boundaryRecordCount>9223372036854775807n)throw new RangeError("boundary count");const boundaryChecksumCrc32c=read32(bytes,at);b3Finish(at,bytes,"relocationCutover");return{...v,boundaryRecordCount,boundaryChecksumCrc32c};}
|
|
152
155
|
export function encodeRelocationState52(v:RelocationState52):Uint8Array{const o=b3Header(52);b3WriteSourceBase(o,v);if(v.chunkData.length>67108864)throw new RangeError("chunk data");u32(o,v.chunkOrdinal);u32(o,v.chunkData.length);appendBytes(o,v.chunkData);return Uint8Array.from(o);}
|
|
153
156
|
export function decodeRelocationState52(bytes:Uint8Array):RelocationState52{const at=b3ReadHeader(bytes,52,"relocationState"),v=b3ReadSourceBase(bytes,at),chunkOrdinal=read32(bytes,at),length=read32(bytes,at);if(length>67108864)throw new RangeError("chunk data");const chunkData=take(bytes,at,length,"chunk data");b3Finish(at,bytes,"relocationState");return{...v,chunkOrdinal,chunkData};}
|
|
154
|
-
export function encodeRelocationPrepare40(v:RelocationPrepare40):Uint8Array{const o=b3Header(40);b3WriteId(o,v.relocation,"relocation");if(v.targetAttemptGeneration===0n||v.sourceNodeGeneration===0n)throw new RangeError("prepare");u64(o,v.targetAttemptGeneration);b3WriteCoordinator(o,v.coordinator);b3WriteTarget(o,v.target);b3WriteRole(o,v.initiatorRole);if(v.initiatorRole!=="source")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)throw new RangeError("prepare bounds");u64(o,v.payloadTotalLength);u32(o,v.payloadChunkCount);u32(o,v.payloadChecksumCrc32c);u64(o,v.applicationVersion);return Uint8Array.from(o);}
|
|
155
|
-
export function decodeRelocationPrepare40(bytes:Uint8Array):RelocationPrepare40{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")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)throw new RangeError("prepare bounds");b3Finish(at,bytes,"relocationPrepare");return{relocation,targetAttemptGeneration,coordinator,target,initiatorRole,object,sourceNodeRid,sourceNodeGeneration,payloadTotalLength,payloadChunkCount,payloadChecksumCrc32c,applicationVersion};}
|
|
157
|
+
export function encodeRelocationPrepare40(v:RelocationPrepare40):Uint8Array{const o=b3Header(40);b3WriteId(o,v.relocation,"relocation");if(v.targetAttemptGeneration===0n||v.sourceNodeGeneration===0n)throw new RangeError("prepare");u64(o,v.targetAttemptGeneration);b3WriteCoordinator(o,v.coordinator);b3WriteTarget(o,v.target);b3WriteRole(o,v.initiatorRole);if(v.initiatorRole!=="source")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)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)throw new RangeError("deadline");u64(o,v.deadlineUnixMs);return Uint8Array.from(o);}
|
|
158
|
+
export function decodeRelocationPrepare40(bytes:Uint8Array):RelocationPrepare40{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")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)throw new RangeError("prepare bounds");b3Finish(at,bytes,"relocationPrepare");return{relocation,targetAttemptGeneration,coordinator,target,initiatorRole,object,sourceNodeRid,sourceNodeGeneration,payloadTotalLength,payloadChunkCount,payloadChecksumCrc32c,applicationVersion,deadlineUnixMs};}
|
|
156
159
|
function b3WriteSealBase(o:number[],v:SessionRelocationSeal42|SessionRelocationSealed43,includeRole:boolean):void{b3WriteId(o,v.relocation,"relocation");b3WriteCoordinator(o,v.coordinator);if(includeRole){const role=(v as SessionRelocationSeal42).senderRole;b3WriteRole(o,role);if(role!=="source")throw new RangeError("sender role");}fence(o,v.actor);b3WriteSession(o,v);}
|
|
157
160
|
function b3ReadSealBase(bytes:Uint8Array,at:{value:number},includeRole:boolean){const relocation=b3ReadId(bytes,at,"relocation"),coordinator=b3ReadCoordinator(bytes,at);let senderRole:ServiceWireRelocationRole|undefined;if(includeRole){senderRole=b3ReadRole(bytes,at);if(senderRole!=="source")throw new RangeError("sender role");}const actor=readFence(bytes,at),session=b3ReadSession(bytes,at);return senderRole===undefined?{relocation,coordinator,actor,...session}:{relocation,coordinator,senderRole,actor,...session};}
|
|
158
|
-
export function encodeSessionRelocationSeal42(v:SessionRelocationSeal42):Uint8Array{const o=b3Header(42);b3WriteSealBase(o,v,true);return Uint8Array.from(o);}
|
|
159
|
-
export function decodeSessionRelocationSeal42(bytes:Uint8Array):SessionRelocationSeal42{const at=b3ReadHeader(bytes,42,"sessionRelocationSeal"),v=b3ReadSealBase(bytes,at,true) as SessionRelocationSeal42;b3Finish(at,bytes,"sessionRelocationSeal");return
|
|
160
|
-
export function encodeSessionRelocationSealed43(v:SessionRelocationSealed43):Uint8Array{const o=b3Header(43);b3WriteSealBase(o,v,false);return Uint8Array.from(o);}
|
|
161
|
-
export function decodeSessionRelocationSealed43(bytes:Uint8Array):SessionRelocationSealed43{const at=b3ReadHeader(bytes,43,"sessionRelocationSealed"),v=b3ReadSealBase(bytes,at,false) as SessionRelocationSealed43;b3Finish(at,bytes,"sessionRelocationSealed");return v;}
|
|
161
|
+
export function encodeSessionRelocationSeal42(v:SessionRelocationSeal42):Uint8Array{const o=b3Header(42);b3WriteSealBase(o,v,true);rid(o,v.targetNodeRid);if(v.targetNodeGeneration===0n)throw new RangeError("target node");u64(o,v.targetNodeGeneration);return Uint8Array.from(o);}
|
|
162
|
+
export function decodeSessionRelocationSeal42(bytes:Uint8Array):SessionRelocationSeal42{const at=b3ReadHeader(bytes,42,"sessionRelocationSeal"),v=b3ReadSealBase(bytes,at,true) as SessionRelocationSeal42;const targetNodeRid=readRid(bytes,at),targetNodeGeneration=nonzero64(bytes,at,"target node");b3Finish(at,bytes,"sessionRelocationSeal");return{...v,targetNodeRid,targetNodeGeneration};}
|
|
163
|
+
export function encodeSessionRelocationSealed43(v:SessionRelocationSealed43):Uint8Array{const o=b3Header(43);b3WriteSealBase(o,v,false);b3WriteSealResult(o,v.sealResult);return Uint8Array.from(o);}
|
|
164
|
+
export function decodeSessionRelocationSealed43(bytes:Uint8Array):SessionRelocationSealed43{const at=b3ReadHeader(bytes,43,"sessionRelocationSealed"),v={...b3ReadSealBase(bytes,at,false),sealResult:b3ReadSealResult(bytes,at)} as SessionRelocationSealed43;b3Finish(at,bytes,"sessionRelocationSealed");return v;}
|
|
162
165
|
export function encodeSessionRelocationRoute44(v:SessionRelocationRoute44):Uint8Array{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"))throw new RangeError("route sender");b3WriteActorRef(o,v.actor);b3WriteSession(o,v);b3WriteRoute(o,v.route);return Uint8Array.from(o);}
|
|
163
166
|
export function decodeSessionRelocationRoute44(bytes:Uint8Array):SessionRelocationRoute44{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"))throw new RangeError("route sender");b3Finish(at,bytes,"sessionRelocationRoute");return{relocation,coordinator,senderRole,actor,...session,route};}
|
|
164
167
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { routingIdsEqual } from '../routing-id';
|
|
1
2
|
import type { ApplicationJobOrigin } from '../application-jobs/contracts';
|
|
2
3
|
import type { ActorRef, RoutingId, ZLinkActor, ZLinkActorJoinOperationId } from '../../contracts';
|
|
3
4
|
import type { ZLinkRemoteBoundSessionTarget } from '../actors/actor-runtime-state';
|
|
@@ -33,7 +34,14 @@ function objectKey(actorId: string, objectGeneration: bigint): string {
|
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
export type ZLinkFormalRemoteActorAdmissionState =
|
|
36
|
-
|
|
37
|
+
| 'provisional'
|
|
38
|
+
| 'admitting'
|
|
39
|
+
| 'admitted'
|
|
40
|
+
| 'restoring'
|
|
41
|
+
| 'rejected'
|
|
42
|
+
| 'committed'
|
|
43
|
+
| 'aborted'
|
|
44
|
+
| 'failed';
|
|
37
45
|
|
|
38
46
|
export interface ZLinkFormalRemoteActorAdmission {
|
|
39
47
|
readonly actorId: string;
|
|
@@ -78,7 +86,7 @@ export interface ZLinkFormalRemoteActorAdmissionRecord {
|
|
|
78
86
|
}
|
|
79
87
|
|
|
80
88
|
interface ZLinkFormalRemoteActorAdmissionEntry extends ZLinkFormalRemoteActorAdmissionRecord {
|
|
81
|
-
|
|
89
|
+
timer: ReturnType<typeof setTimeout>;
|
|
82
90
|
readonly resolveResult: (result: ZLinkFormalRemoteActorAdmissionResult) => void;
|
|
83
91
|
admission: ZLinkFormalRemoteActorAdmission;
|
|
84
92
|
state: ZLinkFormalRemoteActorAdmissionState;
|
|
@@ -107,6 +115,35 @@ export class ZLinkFormalRemoteActorAdmissionRegistry {
|
|
|
107
115
|
return this.admissions.get(transferId);
|
|
108
116
|
}
|
|
109
117
|
|
|
118
|
+
/** PREPARE transfers prepared resources to the target attempt until its terminal. */
|
|
119
|
+
beginRestore(transferId: string): void {
|
|
120
|
+
const entry = this.admissions.get(transferId);
|
|
121
|
+
if (entry === undefined || (entry.state !== 'admitted' && entry.state !== 'restoring')) {
|
|
122
|
+
throw new Error(`Remote actor admission '${transferId}' is not ready to restore.`);
|
|
123
|
+
}
|
|
124
|
+
clearTimeout(entry.timer);
|
|
125
|
+
entry.state = 'restoring';
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** Retains successful commit replay; unsuccessful attempts release their resources now. */
|
|
129
|
+
finishRestore(transferId: string): void {
|
|
130
|
+
const entry = this.admissions.get(transferId);
|
|
131
|
+
if (entry === undefined) return;
|
|
132
|
+
if (entry.state === 'committed') {
|
|
133
|
+
clearTimeout(entry.timer);
|
|
134
|
+
entry.timer = this.scheduleExpiry(transferId);
|
|
135
|
+
} else {
|
|
136
|
+
this.abort(transferId);
|
|
137
|
+
this.delete(transferId);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
private scheduleExpiry(transferId: string): ReturnType<typeof setTimeout> {
|
|
142
|
+
const timer = setTimeout(() => this.delete(transferId), ADMISSION_RETENTION_MS);
|
|
143
|
+
timer.unref();
|
|
144
|
+
return timer;
|
|
145
|
+
}
|
|
146
|
+
|
|
110
147
|
begin(input: ZLinkFormalRemoteActorAdmission): {
|
|
111
148
|
readonly record: ZLinkFormalRemoteActorAdmissionEntry;
|
|
112
149
|
readonly created: boolean;
|
|
@@ -182,10 +219,7 @@ export class ZLinkFormalRemoteActorAdmissionRegistry {
|
|
|
182
219
|
const resultTask = new Promise<ZLinkFormalRemoteActorAdmissionResult>((resolve) => {
|
|
183
220
|
resolveResult = resolve;
|
|
184
221
|
});
|
|
185
|
-
const timer =
|
|
186
|
-
this.delete(input.transferId);
|
|
187
|
-
}, ADMISSION_RETENTION_MS);
|
|
188
|
-
timer.unref();
|
|
222
|
+
const timer = this.scheduleExpiry(input.transferId);
|
|
189
223
|
const entry = {
|
|
190
224
|
admission: input,
|
|
191
225
|
state,
|
|
@@ -309,7 +343,7 @@ export class ZLinkFormalRemoteActorAdmissionRegistry {
|
|
|
309
343
|
markCommitted(transferId: string, actor: ZLinkActor): void {
|
|
310
344
|
const entry = this.admissions.get(transferId);
|
|
311
345
|
if (entry === undefined) return;
|
|
312
|
-
if (entry.state !== 'admitted' && entry.state !== 'committed') {
|
|
346
|
+
if (entry.state !== 'admitted' && entry.state !== 'restoring' && entry.state !== 'committed') {
|
|
313
347
|
throw new Error(`Remote actor admission '${transferId}' is not ready to commit.`);
|
|
314
348
|
}
|
|
315
349
|
entry.state = 'committed';
|
|
@@ -320,7 +354,7 @@ export class ZLinkFormalRemoteActorAdmissionRegistry {
|
|
|
320
354
|
const entry = this.admissions.get(transferId);
|
|
321
355
|
if (
|
|
322
356
|
entry === undefined ||
|
|
323
|
-
entry.state !== 'admitted' ||
|
|
357
|
+
(entry.state !== 'admitted' && entry.state !== 'restoring') ||
|
|
324
358
|
entry.result === undefined ||
|
|
325
359
|
'error' in entry.result ||
|
|
326
360
|
!entry.result.accepted
|
|
@@ -354,7 +388,7 @@ export class ZLinkFormalRemoteActorAdmissionRegistry {
|
|
|
354
388
|
*/
|
|
355
389
|
delete(transferId: string): void {
|
|
356
390
|
const pending = this.admissions.get(transferId);
|
|
357
|
-
if (pending === undefined) return;
|
|
391
|
+
if (pending === undefined || pending.state === 'restoring') return;
|
|
358
392
|
clearTimeout(pending.timer);
|
|
359
393
|
this.admissions.delete(transferId);
|
|
360
394
|
this.failParked(pending);
|
|
@@ -369,20 +403,7 @@ function sameAdmission(
|
|
|
369
403
|
left: ZLinkFormalRemoteActorAdmission,
|
|
370
404
|
right: ZLinkFormalRemoteActorAdmission
|
|
371
405
|
): boolean {
|
|
372
|
-
return (
|
|
373
|
-
left.actorId === right.actorId &&
|
|
374
|
-
left.actorType === right.actorType &&
|
|
375
|
-
String(left.spotId) === String(right.spotId) &&
|
|
376
|
-
left.targetSpotGeneration === right.targetSpotGeneration &&
|
|
377
|
-
left.expectedMembershipEpoch === right.expectedMembershipEpoch &&
|
|
378
|
-
left.requestFingerprint === right.requestFingerprint &&
|
|
379
|
-
sameOperationId(left.completionOperationId, right.completionOperationId) &&
|
|
380
|
-
String(left.sourceSpotId ?? '') === String(right.sourceSpotId ?? '') &&
|
|
381
|
-
String(left.sourceActorNodeRid ?? '') === String(right.sourceActorNodeRid ?? '') &&
|
|
382
|
-
left.actorRef.actorId === right.actorRef.actorId &&
|
|
383
|
-
String(left.actorRef.nodeRid) === String(right.actorRef.nodeRid) &&
|
|
384
|
-
left.actorRef.objectGeneration === right.actorRef.objectGeneration
|
|
385
|
-
);
|
|
406
|
+
return left.actorType === right.actorType && sameProvisionalAdmission(left, right);
|
|
386
407
|
}
|
|
387
408
|
|
|
388
409
|
function sameProvisionalAdmission(
|
|
@@ -397,9 +418,9 @@ function sameProvisionalAdmission(
|
|
|
397
418
|
left.requestFingerprint === right.requestFingerprint &&
|
|
398
419
|
sameOperationId(left.completionOperationId, right.completionOperationId) &&
|
|
399
420
|
String(left.sourceSpotId ?? '') === String(right.sourceSpotId ?? '') &&
|
|
400
|
-
|
|
421
|
+
routingIdsEqual(left.sourceActorNodeRid, right.sourceActorNodeRid) &&
|
|
401
422
|
left.actorRef.actorId === right.actorRef.actorId &&
|
|
402
|
-
|
|
423
|
+
routingIdsEqual(left.actorRef.nodeRid, right.actorRef.nodeRid) &&
|
|
403
424
|
left.actorRef.objectGeneration === right.actorRef.objectGeneration
|
|
404
425
|
);
|
|
405
426
|
}
|