@zlink-systems/framework 0.29.1 → 0.30.1
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/ZLinkMessageMetadata.js +11 -5
- package/dist/contracts/Configuration/Builders.d.ts +1 -2
- package/dist/contracts/Configuration/Configs.d.ts +0 -5
- package/dist/contracts/Configuration/RegistrationBuilders.js +6 -4
- package/dist/contracts/Configuration/RegistrationTypes.d.ts +1 -6
- package/dist/contracts/Configuration/RegistrationValidators.js +4 -4
- package/dist/contracts/Configuration/index.d.ts +1 -1
- 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/Spots/Contracts.d.ts +2 -1
- package/dist/internal.d.ts +1 -0
- package/dist/internal.js +3 -1
- package/dist/nest-integration.d.ts +1 -1
- package/dist/nest-integration.js +2 -1
- package/dist/runtime/actors/actor-client.d.ts +1 -1
- package/dist/runtime/actors/actor-client.js +14 -12
- package/dist/runtime/actors/actor-handoff.d.ts +3 -2
- package/dist/runtime/actors/actor-handoff.js +15 -7
- package/dist/runtime/actors/actor-join-relocation.d.ts +1 -0
- package/dist/runtime/actors/actor-local-native-join.js +9 -12
- package/dist/runtime/actors/actor-remote-wire.js +15 -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/index.d.ts +2 -1
- package/dist/runtime/actors/index.js +18 -6
- package/dist/runtime/actors/spot-actor-dispatch.js +2 -2
- package/dist/runtime/admission.d.ts +1 -1
- package/dist/runtime/admission.js +15 -5
- package/dist/runtime/application-jobs/application-ingress-record-owner.d.ts +9 -9
- package/dist/runtime/application-jobs/application-ingress-record-owner.js +45 -23
- package/dist/runtime/application-jobs/application-job-queue-scope.d.ts +5 -2
- package/dist/runtime/application-jobs/application-job-queue-scope.js +41 -21
- package/dist/runtime/application-jobs/contracts.d.ts +15 -2
- package/dist/runtime/backend/contracts/index.d.ts +27 -27
- package/dist/runtime/backend/mesh-completion-table.d.ts +15 -5
- package/dist/runtime/backend/mesh-completion-table.js +160 -50
- package/dist/runtime/backend/mesh-dispatch-pump.d.ts +3 -0
- package/dist/runtime/backend/mesh-dispatch-pump.js +53 -36
- package/dist/runtime/backend/node/node-backend-adapter-factory.js +6 -1
- package/dist/runtime/backend/node/node-backend-adapter-support.d.ts +3 -3
- package/dist/runtime/backend/node/node-backend-adapter-support.js +33 -31
- 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-mesh-backend-adapter.d.ts +1 -9
- package/dist/runtime/backend/node/node-mesh-backend-adapter.js +1 -1
- package/dist/runtime/backend/node/node-raw-binding-port.js +50 -25
- package/dist/runtime/backend/node/node-raw-mesh-backend.d.ts +22 -16
- package/dist/runtime/backend/node/node-raw-mesh-backend.js +133 -149
- package/dist/runtime/backend/node/node-socket-backend-adapter.js +15 -10
- package/dist/runtime/backend/raw-binding-port.d.ts +10 -3
- 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 +1 -0
- package/dist/runtime/channels/channel-clients.js +58 -21
- package/dist/runtime/channels/channel-dispatch-pipeline.d.ts +3 -2
- package/dist/runtime/channels/channel-dispatch-pipeline.js +20 -11
- 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 +1 -1
- package/dist/runtime/channels/channel-dispatchers.js +27 -26
- 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 +1 -0
- package/dist/runtime/channels/channel-envelope.js +83 -8
- 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-receive-loops.js +3 -3
- package/dist/runtime/channels/channel-runtime-lifecycle.js +2 -1
- package/dist/runtime/channels/channel-runtime-manager.d.ts +6 -6
- package/dist/runtime/channels/channel-runtime-manager.js +12 -12
- package/dist/runtime/channels/channel-socket-registry.d.ts +10 -3
- package/dist/runtime/channels/channel-socket-registry.js +59 -82
- package/dist/runtime/channels/channel-transports.d.ts +18 -15
- package/dist/runtime/channels/channel-transports.js +48 -31
- 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/message-flow.d.ts +1 -0
- package/dist/runtime/diagnostics/message-flow.js +3 -3
- package/dist/runtime/execution/serial-execution-queue.d.ts +1 -0
- package/dist/runtime/execution/serial-execution-queue.js +1 -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/raw-service-mesh-runtime.d.ts +37 -6
- package/dist/runtime/foundation/raw-service-mesh-runtime.js +473 -220
- package/dist/runtime/foundation/service-liveness-registry.d.ts +20 -8
- package/dist/runtime/foundation/service-liveness-registry.js +57 -44
- package/dist/runtime/foundation/service-mailbox.d.ts +3 -0
- package/dist/runtime/foundation/service-mailbox.js +2 -1
- package/dist/runtime/foundation/service-relocation-object-owner.d.ts +1 -0
- package/dist/runtime/foundation/service-relocation-object-owner.js +1 -0
- package/dist/runtime/foundation/service-relocation-runtime.d.ts +2 -0
- package/dist/runtime/foundation/service-relocation-runtime.js +13 -1
- package/dist/runtime/foundation/service-runtime-contracts.d.ts +2 -0
- package/dist/runtime/foundation/service-stateful-runtime.d.ts +10 -9
- package/dist/runtime/foundation/service-stateful-runtime.js +78 -126
- package/dist/runtime/foundation/service-stateful-wire-codec.d.ts +5 -7
- package/dist/runtime/foundation/service-stateful-wire-codec.js +43 -61
- package/dist/runtime/foundation/service-topology-registry.d.ts +16 -4
- package/dist/runtime/foundation/service-topology-registry.js +69 -30
- package/dist/runtime/foundation/service-wire-m6a-codec.d.ts +3 -3
- package/dist/runtime/foundation/service-wire-m6a-codec.js +36 -38
- 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.js +7 -7
- package/dist/runtime/host/actor-runtime-options-factory.js +2 -2
- package/dist/runtime/host/application-job-queue.d.ts +28 -9
- package/dist/runtime/host/application-job-queue.js +214 -50
- package/dist/runtime/host/entry-actor-runtime.d.ts +1 -0
- package/dist/runtime/host/entry-actor-runtime.js +4 -1
- package/dist/runtime/host/index.d.ts +7 -1
- package/dist/runtime/host/index.js +154 -126
- package/dist/runtime/host/instance-activation-authority.d.ts +2 -1
- package/dist/runtime/host/instance-activation-authority.js +89 -25
- package/dist/runtime/host/remote-bound-session-relay.js +2 -18
- package/dist/runtime/host/route-mesh-runtime.js +1 -1
- 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 +6 -8
- package/dist/runtime/host/service-relocation-host-runtime.js +215 -243
- package/dist/runtime/host/spot-address-transport.d.ts +1 -0
- package/dist/runtime/host/spot-address-transport.js +28 -14
- package/dist/runtime/host/spot-runtime-options-factory.js +3 -2
- package/dist/runtime/host/user-spot-creation-coordinator.d.ts +1 -0
- package/dist/runtime/host/user-spot-creation-coordinator.js +1 -0
- 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/domain-store-contract.d.ts +2 -2
- package/dist/runtime/locations/in-memory-authority-store.d.ts +4 -2
- package/dist/runtime/locations/in-memory-authority-store.js +80 -8
- package/dist/runtime/locations/in-memory-location-store.d.ts +2 -2
- package/dist/runtime/locations/in-memory-location-store.js +19 -3
- package/dist/runtime/locations/internal-location-contracts.d.ts +3 -0
- 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 +3 -2
- package/dist/runtime/locations/location-store-repository.js +165 -22
- package/dist/runtime/locations/resolvers.d.ts +2 -1
- package/dist/runtime/locations/resolvers.js +10 -1
- package/dist/runtime/locations/runtime.d.ts +1 -1
- package/dist/runtime/locations/runtime.js +24 -23
- 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/request-result.d.ts +2 -0
- package/dist/runtime/messaging/request-result.js +54 -0
- package/dist/runtime/messaging/submission-result.d.ts +2 -1
- package/dist/runtime/messaging/submission-result.js +7 -4
- package/dist/runtime/protocol/service_wire_codec.generated.d.ts +15 -0
- package/dist/runtime/protocol/service_wire_codec.generated.js +144 -0
- package/dist/runtime/protocol/service_wire_pilot_codec.generated.d.ts +9 -0
- package/dist/runtime/protocol/service_wire_pilot_codec.generated.js +14 -1
- package/dist/runtime/spots/formal-remote-actor-admission-registry.d.ts +9 -2
- package/dist/runtime/spots/formal-remote-actor-admission-registry.js +33 -19
- package/dist/runtime/spots/index.d.ts +7 -3
- package/dist/runtime/spots/index.js +23 -16
- package/dist/runtime/spots/spot-activation.d.ts +3 -1
- package/dist/runtime/spots/spot-activation.js +21 -12
- package/dist/runtime/spots/spot-actor-admission-coordinator.d.ts +2 -1
- package/dist/runtime/spots/spot-actor-admission-coordinator.js +11 -10
- package/dist/runtime/spots/spot-actor-packet-dispatch.d.ts +4 -1
- package/dist/runtime/spots/spot-actor-packet-dispatch.js +7 -5
- package/dist/runtime/spots/spot-actor-packet-drain.js +2 -0
- package/dist/runtime/spots/spot-actor-packet-relay-dispatch.js +1 -0
- package/dist/runtime/spots/spot-entry-activation.js +9 -3
- package/dist/runtime/spots/spot-handler-registry.d.ts +3 -1
- package/dist/runtime/spots/spot-handler-registry.js +18 -8
- package/dist/runtime/spots/spot-node-autoconnect.js +4 -3
- package/dist/runtime/spots/spot-node-runtime-manager.d.ts +2 -1
- package/dist/runtime/spots/spot-node-runtime-manager.js +4 -11
- package/dist/runtime/spots/spot-outbound.d.ts +3 -0
- package/dist/runtime/spots/spot-outbound.js +24 -15
- 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-routing-internal.d.ts +6 -0
- package/dist/runtime/spots/spot-runtime-ports.d.ts +3 -1
- package/dist/runtime/spots/spot-subscription-dispatch.js +0 -3
- package/dist/runtime/spots/spot-timer.js +1 -0
- package/dist/runtime/streams/stream-session-runtime.d.ts +1 -1
- package/dist/runtime/streams/stream-session-runtime.js +14 -28
- 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/ZLinkMessageMetadata.ts +13 -8
- package/src/contracts/Configuration/Builders.ts +1 -2
- package/src/contracts/Configuration/Configs.ts +0 -6
- package/src/contracts/Configuration/RegistrationBuilders.ts +8 -12
- package/src/contracts/Configuration/RegistrationTypes.ts +1 -6
- package/src/contracts/Configuration/RegistrationValidators.ts +9 -10
- package/src/contracts/Configuration/index.ts +1 -6
- package/src/contracts/Handlers/Attributes.ts +14 -21
- package/src/contracts/Handlers/JsonContract.ts +8 -216
- package/src/contracts/Spots/Contracts.ts +2 -1
- package/src/internal.ts +1 -0
- package/src/nest-integration.ts +1 -0
- package/src/runtime/actors/actor-client.ts +40 -16
- package/src/runtime/actors/actor-handoff.ts +22 -8
- package/src/runtime/actors/actor-join-relocation.ts +1 -0
- package/src/runtime/actors/actor-local-native-join.ts +17 -26
- package/src/runtime/actors/actor-remote-wire.ts +17 -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/index.ts +19 -5
- package/src/runtime/actors/spot-actor-dispatch.ts +4 -2
- package/src/runtime/admission.ts +18 -5
- package/src/runtime/application-jobs/application-ingress-record-owner.ts +53 -27
- package/src/runtime/application-jobs/application-job-queue-scope.ts +56 -22
- package/src/runtime/application-jobs/contracts.ts +28 -2
- package/src/runtime/backend/contracts/index.ts +63 -32
- package/src/runtime/backend/mesh-completion-table.ts +175 -59
- package/src/runtime/backend/mesh-dispatch-pump.ts +59 -32
- package/src/runtime/backend/node/node-backend-adapter-factory.ts +12 -5
- package/src/runtime/backend/node/node-backend-adapter-support.ts +42 -31
- package/src/runtime/backend/node/node-dealer-channel-client-transport.ts +12 -2
- package/src/runtime/backend/node/node-mesh-backend-adapter.ts +3 -10
- package/src/runtime/backend/node/node-raw-binding-port.ts +73 -37
- package/src/runtime/backend/node/node-raw-mesh-backend.ts +209 -176
- package/src/runtime/backend/node/node-socket-backend-adapter.ts +32 -13
- package/src/runtime/backend/raw-binding-port.ts +18 -3
- 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 +90 -41
- package/src/runtime/channels/channel-dispatch-pipeline.ts +69 -34
- package/src/runtime/channels/channel-dispatch-services.ts +69 -1
- package/src/runtime/channels/channel-dispatchers.ts +29 -27
- package/src/runtime/channels/channel-envelope-inspection.ts +2 -16
- package/src/runtime/channels/channel-envelope.ts +133 -8
- package/src/runtime/channels/channel-outbound-operations.ts +22 -8
- package/src/runtime/channels/channel-receive-loops.ts +3 -3
- package/src/runtime/channels/channel-runtime-lifecycle.ts +7 -1
- package/src/runtime/channels/channel-runtime-manager.ts +29 -12
- package/src/runtime/channels/channel-socket-registry.ts +84 -130
- package/src/runtime/channels/channel-transports.ts +128 -60
- 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/message-flow.ts +1 -1
- package/src/runtime/execution/serial-execution-queue.ts +2 -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/raw-service-mesh-runtime.ts +642 -253
- package/src/runtime/foundation/service-liveness-registry.ts +68 -59
- package/src/runtime/foundation/service-mailbox.ts +7 -1
- package/src/runtime/foundation/service-relocation-object-owner.ts +2 -0
- package/src/runtime/foundation/service-relocation-runtime.ts +18 -1
- package/src/runtime/foundation/service-runtime-contracts.ts +7 -1
- package/src/runtime/foundation/service-stateful-runtime.ts +128 -160
- package/src/runtime/foundation/service-stateful-wire-codec.ts +55 -84
- package/src/runtime/foundation/service-topology-registry.ts +103 -42
- package/src/runtime/foundation/service-wire-m6a-codec.ts +57 -38
- package/src/runtime/handlers/handler-instance-scope.ts +67 -16
- package/src/runtime/host/actor-packet-relay.ts +7 -0
- package/src/runtime/host/actor-runtime-options-factory.ts +14 -2
- package/src/runtime/host/application-job-queue.ts +249 -48
- package/src/runtime/host/entry-actor-runtime.ts +5 -0
- package/src/runtime/host/index.ts +224 -160
- package/src/runtime/host/instance-activation-authority.ts +132 -27
- package/src/runtime/host/remote-bound-session-relay.ts +2 -23
- package/src/runtime/host/route-mesh-runtime.ts +1 -1
- package/src/runtime/host/service-relocation-control.ts +11 -5
- package/src/runtime/host/service-relocation-host-runtime.ts +317 -291
- package/src/runtime/host/spot-address-transport.ts +49 -24
- package/src/runtime/host/spot-runtime-options-factory.ts +4 -0
- package/src/runtime/host/user-spot-creation-coordinator.ts +8 -0
- package/src/runtime/locations/actor-location-claims.ts +52 -30
- package/src/runtime/locations/domain-store-contract.ts +6 -2
- package/src/runtime/locations/in-memory-authority-store.ts +113 -9
- package/src/runtime/locations/in-memory-location-store.ts +25 -3
- package/src/runtime/locations/internal-location-contracts.ts +4 -0
- package/src/runtime/locations/lifecycle.ts +8 -26
- package/src/runtime/locations/location-store-repository.ts +220 -15
- package/src/runtime/locations/resolvers.ts +25 -2
- package/src/runtime/locations/runtime.ts +28 -24
- package/src/runtime/messaging/framework-json-v1.ts +5 -325
- package/src/runtime/messaging/packet-name.ts +5 -25
- package/src/runtime/messaging/request-result.ts +58 -0
- package/src/runtime/messaging/submission-result.ts +7 -3
- package/src/runtime/protocol/service_wire_codec.generated.ts +131 -1
- package/src/runtime/protocol/service_wire_pilot_codec.generated.ts +4 -4
- package/src/runtime/spots/formal-remote-actor-admission-registry.ts +45 -23
- package/src/runtime/spots/index.ts +30 -2
- package/src/runtime/spots/spot-activation.ts +33 -10
- package/src/runtime/spots/spot-actor-admission-coordinator.ts +13 -0
- package/src/runtime/spots/spot-actor-packet-dispatch.ts +10 -0
- package/src/runtime/spots/spot-actor-packet-drain.ts +2 -0
- package/src/runtime/spots/spot-actor-packet-relay-dispatch.ts +1 -0
- package/src/runtime/spots/spot-entry-activation.ts +12 -2
- package/src/runtime/spots/spot-handler-registry.ts +41 -8
- package/src/runtime/spots/spot-node-autoconnect.ts +6 -2
- package/src/runtime/spots/spot-node-runtime-manager.ts +7 -12
- package/src/runtime/spots/spot-outbound.ts +36 -16
- package/src/runtime/spots/spot-routed-spot-packet-dispatch.ts +2 -1
- package/src/runtime/spots/spot-routing-internal.ts +14 -0
- package/src/runtime/spots/spot-runtime-ports.ts +3 -0
- package/src/runtime/spots/spot-subscription-dispatch.ts +0 -3
- package/src/runtime/spots/spot-timer.ts +5 -1
- package/src/runtime/streams/stream-session-runtime.ts +13 -30
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
ZLinkDispatchMessageKind,
|
|
11
11
|
ZLinkRuntimeMessageFlowOutcome as ZLinkMessageFlowOutcome
|
|
12
12
|
} from '../../contracts/Dispatch/ZLinkDispatchOptions';
|
|
13
|
-
import {
|
|
13
|
+
import { requestDurableService } from './durable-service-request';
|
|
14
14
|
import { shouldCompactBackingArray } from '../admission';
|
|
15
15
|
import { RequestResult, SubmitResult, isZLinkBackendResultError } from '../backend/runtime-values';
|
|
16
16
|
import type { ZLinkDispatchErrorReporter } from '../channels/dispatch-error-reporter';
|
|
@@ -90,6 +90,7 @@ import {
|
|
|
90
90
|
type ServiceBoundSessionActorAuthority,
|
|
91
91
|
type ServiceDirectSpotRouteFence,
|
|
92
92
|
type ServiceInstanceActivationTarget,
|
|
93
|
+
type ServiceInstanceColdActivationTarget,
|
|
93
94
|
type ServiceInstanceRouteFence,
|
|
94
95
|
type ServiceMessageFollowRoute,
|
|
95
96
|
type ServiceRetiredBoundSessionRouteFence,
|
|
@@ -111,7 +112,6 @@ import {
|
|
|
111
112
|
encodeApplicationPayload,
|
|
112
113
|
type ServiceApplicationPayload
|
|
113
114
|
} from './service-wire-m6a-codec';
|
|
114
|
-
const STATEFUL_OPERATION_RETRY_TICK_MS = 20;
|
|
115
115
|
|
|
116
116
|
const MAX_NODE_TIMER_DELAY_MS = 2_147_483_647;
|
|
117
117
|
|
|
@@ -313,7 +313,12 @@ export interface ServiceInstanceActivationAuthority {
|
|
|
313
313
|
* operation completes; the binding callback itself never blocks.
|
|
314
314
|
*/
|
|
315
315
|
export interface ServiceAsyncInstanceActivationAuthority {
|
|
316
|
-
read(
|
|
316
|
+
read(
|
|
317
|
+
target: ServiceInstanceActivationTarget,
|
|
318
|
+
instanceIntent?: true,
|
|
319
|
+
activation?: ServiceInstanceActivationRecoveryEnvelope,
|
|
320
|
+
acceptsLocal?: (route: ServiceInstanceRouteFence) => boolean
|
|
321
|
+
): Promise<ServiceInstanceAuthorityRead>;
|
|
317
322
|
reserve(
|
|
318
323
|
activation: Omit<ServiceInstanceActivationRecoveryEnvelope, 'targetMeshName'>,
|
|
319
324
|
signal?: AbortSignal
|
|
@@ -448,7 +453,7 @@ export class ServiceStatefulRuntime {
|
|
|
448
453
|
);
|
|
449
454
|
this.registry = new ServiceStatefulRegistry(nodeRid, nodeGeneration);
|
|
450
455
|
this.registry.createEntrySpot(nodeRid);
|
|
451
|
-
raw.setServiceIngress((record) => this.ingress(record));
|
|
456
|
+
raw.setServiceIngress((record) => this.ingress(record), acceptsStatefulIngress);
|
|
452
457
|
}
|
|
453
458
|
|
|
454
459
|
setMailboxDropHandler(
|
|
@@ -883,7 +888,7 @@ export class ServiceStatefulRuntime {
|
|
|
883
888
|
const record = {
|
|
884
889
|
kind: 'instanceSpot' as const,
|
|
885
890
|
activation: 'missing' as const,
|
|
886
|
-
target,
|
|
891
|
+
target: { ...target, targetMeshName: envelope.targetMeshName },
|
|
887
892
|
sourceNodeGeneration: envelope.sourceNodeGeneration,
|
|
888
893
|
sourceNodeRid: envelope.sourceNodeRid,
|
|
889
894
|
...(envelope.sourceSpotId === undefined ? {} : { sourceSpotId: envelope.sourceSpotId }),
|
|
@@ -902,7 +907,7 @@ export class ServiceStatefulRuntime {
|
|
|
902
907
|
sourceRoutingId: envelope.sourceNodeRid,
|
|
903
908
|
parts: [
|
|
904
909
|
encodeInstanceSpotActivationHeader(
|
|
905
|
-
target,
|
|
910
|
+
record.target,
|
|
906
911
|
envelope.sourceNodeGeneration,
|
|
907
912
|
envelope.sourceNodeRid,
|
|
908
913
|
envelope.sourceSpotId,
|
|
@@ -1320,7 +1325,8 @@ export class ServiceStatefulRuntime {
|
|
|
1320
1325
|
sourceSpotId: string,
|
|
1321
1326
|
requested: ServiceDirectSpotRouteFence,
|
|
1322
1327
|
payload: ServiceApplicationPayload,
|
|
1323
|
-
timeoutMs: number
|
|
1328
|
+
timeoutMs: number,
|
|
1329
|
+
onAdmitted?: () => void
|
|
1324
1330
|
): ServiceStatefulPendingOperation {
|
|
1325
1331
|
const pending = this.operations.register(timeoutMs);
|
|
1326
1332
|
const target = this.acceptSpotAuthority(requested);
|
|
@@ -1340,7 +1346,9 @@ export class ServiceStatefulRuntime {
|
|
|
1340
1346
|
target.targetNodeRid,
|
|
1341
1347
|
[header, encodeApplicationPayload(payload)],
|
|
1342
1348
|
timeoutMs,
|
|
1343
|
-
'spotRequest'
|
|
1349
|
+
'spotRequest',
|
|
1350
|
+
undefined,
|
|
1351
|
+
onAdmitted
|
|
1344
1352
|
);
|
|
1345
1353
|
return pending;
|
|
1346
1354
|
}
|
|
@@ -1378,7 +1386,8 @@ export class ServiceStatefulRuntime {
|
|
|
1378
1386
|
payload: ServiceApplicationPayload,
|
|
1379
1387
|
timeoutMs: number,
|
|
1380
1388
|
sourceActor?: ServiceActorRef,
|
|
1381
|
-
boundSession?: { readonly sessionRid: string; readonly bindingGeneration: bigint }
|
|
1389
|
+
boundSession?: { readonly sessionRid: string; readonly bindingGeneration: bigint },
|
|
1390
|
+
onAdmitted?: () => void
|
|
1382
1391
|
): ServiceStatefulPendingOperation {
|
|
1383
1392
|
const pending = this.operations.register(timeoutMs);
|
|
1384
1393
|
const route = this.tryActorFence(target);
|
|
@@ -1407,7 +1416,9 @@ export class ServiceStatefulRuntime {
|
|
|
1407
1416
|
target.nodeRid,
|
|
1408
1417
|
[header, encodeApplicationPayload(payload)],
|
|
1409
1418
|
timeoutMs,
|
|
1410
|
-
'actorRequest'
|
|
1419
|
+
'actorRequest',
|
|
1420
|
+
undefined,
|
|
1421
|
+
onAdmitted
|
|
1411
1422
|
);
|
|
1412
1423
|
return pending;
|
|
1413
1424
|
}
|
|
@@ -1442,7 +1453,7 @@ export class ServiceStatefulRuntime {
|
|
|
1442
1453
|
}
|
|
1443
1454
|
|
|
1444
1455
|
async sendToMissingInstanceSpot(
|
|
1445
|
-
target:
|
|
1456
|
+
target: ServiceInstanceColdActivationTarget,
|
|
1446
1457
|
payload: ServiceApplicationPayload,
|
|
1447
1458
|
deadlineUnixMs: bigint,
|
|
1448
1459
|
sourceSpotId?: string,
|
|
@@ -1458,7 +1469,7 @@ export class ServiceStatefulRuntime {
|
|
|
1458
1469
|
}
|
|
1459
1470
|
|
|
1460
1471
|
async sendToMissingInstanceSpotFrame(
|
|
1461
|
-
target:
|
|
1472
|
+
target: ServiceInstanceColdActivationTarget,
|
|
1462
1473
|
payloadFrame: Buffer,
|
|
1463
1474
|
deadlineUnixMs: bigint,
|
|
1464
1475
|
sourceSpotId?: string,
|
|
@@ -1493,7 +1504,8 @@ export class ServiceStatefulRuntime {
|
|
|
1493
1504
|
timeoutMs: number,
|
|
1494
1505
|
sourceSpotId?: string,
|
|
1495
1506
|
metadataFrame?: Uint8Array,
|
|
1496
|
-
instanceIntent = false
|
|
1507
|
+
instanceIntent = false,
|
|
1508
|
+
onAdmitted?: () => void
|
|
1497
1509
|
): ServiceStatefulPendingOperation {
|
|
1498
1510
|
const pending = this.operations.register(timeoutMs);
|
|
1499
1511
|
this.submitRequest(
|
|
@@ -1517,13 +1529,15 @@ export class ServiceStatefulRuntime {
|
|
|
1517
1529
|
metadataFrame
|
|
1518
1530
|
),
|
|
1519
1531
|
timeoutMs,
|
|
1520
|
-
'instanceSpotRequest'
|
|
1532
|
+
'instanceSpotRequest',
|
|
1533
|
+
undefined,
|
|
1534
|
+
onAdmitted
|
|
1521
1535
|
);
|
|
1522
1536
|
return pending;
|
|
1523
1537
|
}
|
|
1524
1538
|
|
|
1525
1539
|
requestToMissingInstanceSpot(
|
|
1526
|
-
target:
|
|
1540
|
+
target: ServiceInstanceColdActivationTarget,
|
|
1527
1541
|
payload: ServiceApplicationPayload,
|
|
1528
1542
|
timeoutMs: number,
|
|
1529
1543
|
sourceSpotId?: string,
|
|
@@ -1541,11 +1555,12 @@ export class ServiceStatefulRuntime {
|
|
|
1541
1555
|
}
|
|
1542
1556
|
|
|
1543
1557
|
requestToMissingInstanceSpotFrame(
|
|
1544
|
-
target:
|
|
1558
|
+
target: ServiceInstanceColdActivationTarget,
|
|
1545
1559
|
payloadFrame: Buffer,
|
|
1546
1560
|
deadlineUnixMs: bigint,
|
|
1547
1561
|
sourceSpotId?: string,
|
|
1548
|
-
metadataFrame?: Uint8Array
|
|
1562
|
+
metadataFrame?: Uint8Array,
|
|
1563
|
+
onAdmitted?: () => void
|
|
1549
1564
|
): ServiceStatefulPendingOperation {
|
|
1550
1565
|
const timeoutMs = remainingDeadlineMs(deadlineUnixMs);
|
|
1551
1566
|
const pending = this.operations.register(timeoutMs);
|
|
@@ -1570,7 +1585,9 @@ export class ServiceStatefulRuntime {
|
|
|
1570
1585
|
metadataFrame
|
|
1571
1586
|
),
|
|
1572
1587
|
timeoutMs,
|
|
1573
|
-
'instanceSpotRequest'
|
|
1588
|
+
'instanceSpotRequest',
|
|
1589
|
+
undefined,
|
|
1590
|
+
onAdmitted
|
|
1574
1591
|
);
|
|
1575
1592
|
return pending;
|
|
1576
1593
|
}
|
|
@@ -2023,29 +2040,6 @@ export class ServiceStatefulRuntime {
|
|
|
2023
2040
|
private async ingress(
|
|
2024
2041
|
record: RawServiceIngressRecord
|
|
2025
2042
|
): Promise<RawServicePumpResult | undefined> {
|
|
2026
|
-
// These frozen relocation controls overlap the legacy stateful command
|
|
2027
|
-
// number range (30-34). They are bare infrastructure records and must
|
|
2028
|
-
// fall through to RawServiceMeshRuntime's relocation ingress instead of
|
|
2029
|
-
// being decoded as stateful actor/spot work.
|
|
2030
|
-
if (
|
|
2031
|
-
record.command === M6bServiceWireCommand.relocationReady ||
|
|
2032
|
-
record.command === M6bServiceWireCommand.relocationData ||
|
|
2033
|
-
record.command === M6bServiceWireCommand.replyRelay ||
|
|
2034
|
-
record.command === M6bServiceWireCommand.relocationCutover
|
|
2035
|
-
) {
|
|
2036
|
-
return undefined;
|
|
2037
|
-
}
|
|
2038
|
-
if (
|
|
2039
|
-
record.command < M6bServiceWireCommand.spotSend ||
|
|
2040
|
-
(record.command > M6bServiceWireCommand.instanceSpot &&
|
|
2041
|
-
record.command !== M6bServiceWireCommand.userSpotCreate &&
|
|
2042
|
-
record.command !== M6bServiceWireCommand.userSpotClose &&
|
|
2043
|
-
record.command !== M6bServiceWireCommand.actorCreate &&
|
|
2044
|
-
record.command !== M6bServiceWireCommand.messageFollow &&
|
|
2045
|
-
record.command !== M6bServiceWireCommand.boundSessionReplaced)
|
|
2046
|
-
) {
|
|
2047
|
-
return undefined;
|
|
2048
|
-
}
|
|
2049
2043
|
let decoded: ServiceStatefulWireRecord;
|
|
2050
2044
|
let canonicalActorJoin: ActorJoin28 | undefined;
|
|
2051
2045
|
try {
|
|
@@ -2365,6 +2359,7 @@ export class ServiceStatefulRuntime {
|
|
|
2365
2359
|
localReply,
|
|
2366
2360
|
metadataFrame
|
|
2367
2361
|
).finally(() => ownedIngress.applicationJobOwner?.close());
|
|
2362
|
+
ingress.onAdmitted?.();
|
|
2368
2363
|
return 'infrastructure';
|
|
2369
2364
|
}
|
|
2370
2365
|
if (
|
|
@@ -2378,6 +2373,7 @@ export class ServiceStatefulRuntime {
|
|
|
2378
2373
|
payloadFrame,
|
|
2379
2374
|
metadataFrame
|
|
2380
2375
|
).finally(() => ownedIngress.applicationJobOwner?.close());
|
|
2376
|
+
ingress.onAdmitted?.();
|
|
2381
2377
|
return 'infrastructure';
|
|
2382
2378
|
}
|
|
2383
2379
|
const spot = this.requireInstanceActivation(ingress, record);
|
|
@@ -2941,6 +2937,24 @@ export class ServiceStatefulRuntime {
|
|
|
2941
2937
|
return activation.spot;
|
|
2942
2938
|
}
|
|
2943
2939
|
|
|
2940
|
+
private localReadyInstance(
|
|
2941
|
+
target: ServiceInstanceActivationTarget,
|
|
2942
|
+
route: ServiceInstanceRouteFence
|
|
2943
|
+
): ServiceSpotState | undefined {
|
|
2944
|
+
const local = this.registry.spot(target.targetSpotId);
|
|
2945
|
+
if (
|
|
2946
|
+
local !== undefined &&
|
|
2947
|
+
(local.kind !== 'instance' || local.stableType !== target.stableType)
|
|
2948
|
+
) {
|
|
2949
|
+
throw new ServiceStaleGenerationError('spot', target.targetSpotId);
|
|
2950
|
+
}
|
|
2951
|
+
return local !== undefined &&
|
|
2952
|
+
local.state === 'ready' &&
|
|
2953
|
+
routeMatchesLocal(route, local, this.nodeRid, this.nodeGeneration)
|
|
2954
|
+
? local
|
|
2955
|
+
: undefined;
|
|
2956
|
+
}
|
|
2957
|
+
|
|
2944
2958
|
private activateMissingInstanceAsync(
|
|
2945
2959
|
record: Extract<
|
|
2946
2960
|
ServiceStatefulWireRecord,
|
|
@@ -2961,7 +2975,20 @@ export class ServiceStatefulRuntime {
|
|
|
2961
2975
|
...activation,
|
|
2962
2976
|
stableType: record.target.stableType
|
|
2963
2977
|
}));
|
|
2964
|
-
const operation = ready.then((value) => {
|
|
2978
|
+
const operation = ready.then(async (value) => {
|
|
2979
|
+
if (pending !== undefined) {
|
|
2980
|
+
await this.asyncInstanceAuthority?.read(
|
|
2981
|
+
record.target,
|
|
2982
|
+
undefined,
|
|
2983
|
+
{
|
|
2984
|
+
...record,
|
|
2985
|
+
targetMeshName: record.target.targetMeshName,
|
|
2986
|
+
...(metadataFrame === undefined ? {} : { metadataFrame }),
|
|
2987
|
+
applicationPayloadFrame: payloadFrame
|
|
2988
|
+
},
|
|
2989
|
+
(route) => this.localReadyInstance(record.target, route) !== undefined
|
|
2990
|
+
);
|
|
2991
|
+
}
|
|
2965
2992
|
if (value.stableType !== record.target.stableType) {
|
|
2966
2993
|
throw new ZLinkFrameworkException(
|
|
2967
2994
|
ZLinkFrameworkErrorKind.TypeMismatch,
|
|
@@ -3010,8 +3037,19 @@ export class ServiceStatefulRuntime {
|
|
|
3010
3037
|
throw new Error('Async Instance activation authority is not registered.');
|
|
3011
3038
|
}
|
|
3012
3039
|
|
|
3040
|
+
const activationRequest = {
|
|
3041
|
+
...record,
|
|
3042
|
+
targetMeshName: record.target.targetMeshName,
|
|
3043
|
+
...(metadataFrame === undefined ? {} : { metadataFrame }),
|
|
3044
|
+
applicationPayloadFrame: payloadFrame
|
|
3045
|
+
};
|
|
3046
|
+
const current = await authority.read(
|
|
3047
|
+
target,
|
|
3048
|
+
true,
|
|
3049
|
+
activationRequest,
|
|
3050
|
+
(route) => this.localReadyInstance(target, route) !== undefined
|
|
3051
|
+
);
|
|
3013
3052
|
const local = this.registry.spot(target.targetSpotId);
|
|
3014
|
-
const current = await authority.read(target);
|
|
3015
3053
|
if (
|
|
3016
3054
|
current.kind === 'creating' &&
|
|
3017
3055
|
current.authority?.allocation.state === 'active' &&
|
|
@@ -3061,17 +3099,9 @@ export class ServiceStatefulRuntime {
|
|
|
3061
3099
|
if (current.route.targetNodeGeneration !== this.nodeGeneration) {
|
|
3062
3100
|
throw new ServiceStaleGenerationError('spot', target.targetSpotId);
|
|
3063
3101
|
}
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
) {
|
|
3068
|
-
throw new ServiceStaleGenerationError('spot', target.targetSpotId);
|
|
3069
|
-
}
|
|
3070
|
-
if (
|
|
3071
|
-
local !== undefined &&
|
|
3072
|
-
routeMatchesLocal(current.route, local, this.nodeRid, this.nodeGeneration)
|
|
3073
|
-
) {
|
|
3074
|
-
return { spot: local, route: current.route };
|
|
3102
|
+
const readyLocal = this.localReadyInstance(target, current.route);
|
|
3103
|
+
if (readyLocal !== undefined) {
|
|
3104
|
+
return { spot: readyLocal, route: current.route };
|
|
3075
3105
|
}
|
|
3076
3106
|
return await this.reconcileReadyInstanceProjection(target, current.route, authority);
|
|
3077
3107
|
}
|
|
@@ -3113,21 +3143,7 @@ export class ServiceStatefulRuntime {
|
|
|
3113
3143
|
const deadline = operationDeadline(record.deadlineUnixMs);
|
|
3114
3144
|
let reserved: ServiceInstanceAuthorityReserve;
|
|
3115
3145
|
try {
|
|
3116
|
-
reserved = await authority.reserve(
|
|
3117
|
-
{
|
|
3118
|
-
target,
|
|
3119
|
-
sourceNodeRid: record.sourceNodeRid,
|
|
3120
|
-
sourceNodeGeneration: record.sourceNodeGeneration,
|
|
3121
|
-
...(record.sourceSpotId === undefined ? {} : { sourceSpotId: record.sourceSpotId }),
|
|
3122
|
-
operationKind: record.operationKind,
|
|
3123
|
-
operation: record.operation,
|
|
3124
|
-
...(record.replyRouteId === undefined ? {} : { replyRouteId: record.replyRouteId }),
|
|
3125
|
-
deadlineUnixMs: record.deadlineUnixMs,
|
|
3126
|
-
...(metadataFrame === undefined ? {} : { metadataFrame }),
|
|
3127
|
-
applicationPayloadFrame: payloadFrame
|
|
3128
|
-
},
|
|
3129
|
-
deadline.signal
|
|
3130
|
-
);
|
|
3146
|
+
reserved = await authority.reserve(activationRequest, deadline.signal);
|
|
3131
3147
|
} finally {
|
|
3132
3148
|
deadline.close();
|
|
3133
3149
|
}
|
|
@@ -3795,7 +3811,10 @@ export class ServiceStatefulRuntime {
|
|
|
3795
3811
|
stateful,
|
|
3796
3812
|
applicationJob
|
|
3797
3813
|
});
|
|
3798
|
-
if (accepted)
|
|
3814
|
+
if (accepted) {
|
|
3815
|
+
ingress.onAdmitted?.();
|
|
3816
|
+
return domain;
|
|
3817
|
+
}
|
|
3799
3818
|
applicationJob.close();
|
|
3800
3819
|
if (stateful.reply !== undefined) {
|
|
3801
3820
|
const result = failure(
|
|
@@ -4186,64 +4205,15 @@ export class ServiceStatefulRuntime {
|
|
|
4186
4205
|
operationKind: 'userSpotCreate' | 'userSpotClose' | 'actorCreate' | 'streamBind' | 'actorJoin',
|
|
4187
4206
|
deadlineMs: number
|
|
4188
4207
|
): Promise<readonly Buffer[]> {
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
true
|
|
4197
|
-
)
|
|
4198
|
-
);
|
|
4199
|
-
}
|
|
4200
|
-
});
|
|
4201
|
-
let wasAdmitted = false;
|
|
4202
|
-
try {
|
|
4203
|
-
// Only durable lifecycle operations replay these frozen frames. Received
|
|
4204
|
-
// envelopes leave this loop before decoding, including failure terminals.
|
|
4205
|
-
for (;;) {
|
|
4206
|
-
this.requireOpen();
|
|
4207
|
-
stop.signal.throwIfAborted();
|
|
4208
|
-
const remainingMs = Math.ceil(deadlineMs - performance.now());
|
|
4209
|
-
if (remainingMs <= 0) throw durableOperationExhausted(operationKind, wasAdmitted);
|
|
4210
|
-
try {
|
|
4211
|
-
return await awaitWithAbort(
|
|
4212
|
-
targetNodeRid === this.nodeRid
|
|
4213
|
-
? this.requestLocalInfrastructure(parts[0]!, correlation, remainingMs)
|
|
4214
|
-
: this.raw.requestService(targetNodeRid, parts, remainingMs),
|
|
4215
|
-
stop.signal
|
|
4216
|
-
);
|
|
4217
|
-
} catch (error) {
|
|
4218
|
-
stop.signal.throwIfAborted();
|
|
4219
|
-
if (!durableRequestCanReplay(error)) throw error;
|
|
4220
|
-
if (durableRequestWasAdmitted(error)) wasAdmitted = true;
|
|
4221
|
-
const retryDelayMs = Math.min(
|
|
4222
|
-
STATEFUL_OPERATION_RETRY_TICK_MS,
|
|
4223
|
-
deadlineMs - performance.now()
|
|
4224
|
-
);
|
|
4225
|
-
if (retryDelayMs <= 0) {
|
|
4226
|
-
throw durableOperationExhausted(operationKind, wasAdmitted, error);
|
|
4227
|
-
}
|
|
4228
|
-
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
4229
|
-
try {
|
|
4230
|
-
await awaitWithAbort(
|
|
4231
|
-
new Promise<void>((resolve) => {
|
|
4232
|
-
timer = setTimeout(resolve, retryDelayMs);
|
|
4233
|
-
}),
|
|
4234
|
-
stop.signal
|
|
4235
|
-
);
|
|
4236
|
-
} finally {
|
|
4237
|
-
if (timer !== undefined) clearTimeout(timer);
|
|
4238
|
-
}
|
|
4239
|
-
}
|
|
4240
|
-
}
|
|
4241
|
-
} catch (error) {
|
|
4242
|
-
stop.signal.throwIfAborted();
|
|
4243
|
-
throw error;
|
|
4244
|
-
} finally {
|
|
4245
|
-
unobserve();
|
|
4208
|
+
this.requireOpen();
|
|
4209
|
+
if (targetNodeRid === this.nodeRid) {
|
|
4210
|
+
return this.requestLocalInfrastructure(
|
|
4211
|
+
parts[0]!,
|
|
4212
|
+
correlation,
|
|
4213
|
+
Math.ceil(deadlineMs - performance.now())
|
|
4214
|
+
);
|
|
4246
4215
|
}
|
|
4216
|
+
return requestDurableService(this.raw, targetNodeRid, parts, deadlineMs, operationKind);
|
|
4247
4217
|
}
|
|
4248
4218
|
|
|
4249
4219
|
private requestLocalInfrastructure(
|
|
@@ -4367,7 +4337,8 @@ export class ServiceStatefulRuntime {
|
|
|
4367
4337
|
| 'streamBind'
|
|
4368
4338
|
| 'streamUnbind'
|
|
4369
4339
|
| 'instanceSpotRequest',
|
|
4370
|
-
actor?: ServiceActorRef
|
|
4340
|
+
actor?: ServiceActorRef,
|
|
4341
|
+
onAdmitted?: () => void
|
|
4371
4342
|
): void {
|
|
4372
4343
|
if (targetNodeRid === this.nodeRid) {
|
|
4373
4344
|
const deadlineUnixMs = BigInt(Date.now() + Math.max(0, timeoutMs));
|
|
@@ -4385,6 +4356,7 @@ export class ServiceStatefulRuntime {
|
|
|
4385
4356
|
flags: parts[0]![SERVICE_WIRE_FLAGS_OFFSET]!,
|
|
4386
4357
|
sourceRoutingId: this.nodeRid,
|
|
4387
4358
|
requestSequence: pending.id,
|
|
4359
|
+
onAdmitted,
|
|
4388
4360
|
parts,
|
|
4389
4361
|
applicationJobOwner
|
|
4390
4362
|
};
|
|
@@ -4403,7 +4375,7 @@ export class ServiceStatefulRuntime {
|
|
|
4403
4375
|
})().catch((error) => this.operations.reply(pending.id, failure(error)));
|
|
4404
4376
|
return;
|
|
4405
4377
|
}
|
|
4406
|
-
void this.raw.requestService(targetNodeRid, parts, timeoutMs).then(
|
|
4378
|
+
void this.raw.requestService(targetNodeRid, parts, timeoutMs, onAdmitted).then(
|
|
4407
4379
|
(reply) => this.completeRemoteReply(pending, targetNodeRid, operationKind, actor, reply),
|
|
4408
4380
|
(error) => this.operations.fail(pending.id, error)
|
|
4409
4381
|
);
|
|
@@ -5388,37 +5360,6 @@ function operationReplayExpired(replayExpiresAtMs: number): boolean {
|
|
|
5388
5360
|
return performance.now() > replayExpiresAtMs;
|
|
5389
5361
|
}
|
|
5390
5362
|
|
|
5391
|
-
function durableRequestWasAdmitted(error: unknown): boolean {
|
|
5392
|
-
// Request NotConnected includes Core handover of an admitted request. The
|
|
5393
|
-
// submit/request phase, rather than the result number, owns this distinction.
|
|
5394
|
-
return isZLinkBackendResultError(error) && error.operation === 'request';
|
|
5395
|
-
}
|
|
5396
|
-
|
|
5397
|
-
function durableOperationExhausted(
|
|
5398
|
-
operationKind: 'userSpotCreate' | 'userSpotClose' | 'actorCreate' | 'streamBind' | 'actorJoin',
|
|
5399
|
-
wasAdmitted: boolean,
|
|
5400
|
-
cause?: unknown
|
|
5401
|
-
): ZLinkFrameworkException {
|
|
5402
|
-
return createInternalFrameworkException(
|
|
5403
|
-
wasAdmitted
|
|
5404
|
-
? ZLinkFrameworkInternalErrorKind.DeadlineExceeded
|
|
5405
|
-
: ZLinkFrameworkInternalErrorKind.RouteNotConnected,
|
|
5406
|
-
`${operationKind} exhausted its end-to-end deadline.`,
|
|
5407
|
-
true,
|
|
5408
|
-
cause
|
|
5409
|
-
);
|
|
5410
|
-
}
|
|
5411
|
-
|
|
5412
|
-
function durableRequestCanReplay(error: unknown): boolean {
|
|
5413
|
-
if (!isZLinkBackendResultError(error)) return false;
|
|
5414
|
-
return error.operation === 'request'
|
|
5415
|
-
? error.result === RequestResult.NotConnected || error.result === RequestResult.TimedOut
|
|
5416
|
-
: error.result === SubmitResult.NotConnected ||
|
|
5417
|
-
error.result === SubmitResult.NotFound ||
|
|
5418
|
-
error.result === SubmitResult.NotAdmitted ||
|
|
5419
|
-
error.result === SubmitResult.Backpressured;
|
|
5420
|
-
}
|
|
5421
|
-
|
|
5422
5363
|
function remainingDeadlineMs(deadlineUnixMs: bigint): number {
|
|
5423
5364
|
const remainingMs = deadlineUnixMs - BigInt(Date.now());
|
|
5424
5365
|
if (remainingMs <= 0n) {
|
|
@@ -5911,3 +5852,30 @@ export function statefulMailboxData(
|
|
|
5911
5852
|
): ServiceStatefulMailboxData | undefined {
|
|
5912
5853
|
return record.stateful as ServiceStatefulMailboxData | undefined;
|
|
5913
5854
|
}
|
|
5855
|
+
|
|
5856
|
+
function acceptsStatefulIngress(command: number): boolean {
|
|
5857
|
+
// These frozen relocation controls overlap the legacy stateful command
|
|
5858
|
+
// number range (30-34). They are bare infrastructure records and must
|
|
5859
|
+
// fall through to RawServiceMeshRuntime's relocation ingress instead of
|
|
5860
|
+
// being decoded as stateful actor/spot work.
|
|
5861
|
+
if (
|
|
5862
|
+
command === M6bServiceWireCommand.relocationReady ||
|
|
5863
|
+
command === M6bServiceWireCommand.relocationData ||
|
|
5864
|
+
command === M6bServiceWireCommand.replyRelay ||
|
|
5865
|
+
command === M6bServiceWireCommand.relocationCutover
|
|
5866
|
+
) {
|
|
5867
|
+
return false;
|
|
5868
|
+
}
|
|
5869
|
+
if (
|
|
5870
|
+
command < M6bServiceWireCommand.spotSend ||
|
|
5871
|
+
(command > M6bServiceWireCommand.instanceSpot &&
|
|
5872
|
+
command !== M6bServiceWireCommand.userSpotCreate &&
|
|
5873
|
+
command !== M6bServiceWireCommand.userSpotClose &&
|
|
5874
|
+
command !== M6bServiceWireCommand.actorCreate &&
|
|
5875
|
+
command !== M6bServiceWireCommand.messageFollow &&
|
|
5876
|
+
command !== M6bServiceWireCommand.boundSessionReplaced)
|
|
5877
|
+
) {
|
|
5878
|
+
return false;
|
|
5879
|
+
}
|
|
5880
|
+
return true;
|
|
5881
|
+
}
|