@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
|
@@ -19,13 +19,13 @@ export interface ZLinkActorRoutedJoinTransport {
|
|
|
19
19
|
targetNodeRid: string,
|
|
20
20
|
packetName: string | undefined,
|
|
21
21
|
message: unknown
|
|
22
|
-
): Promise<ZLinkSubmitResult>;
|
|
22
|
+
): ZLinkSubmitResult | Promise<ZLinkSubmitResult>;
|
|
23
23
|
submitInfrastructure?(
|
|
24
24
|
routerChannelId: string,
|
|
25
25
|
targetNodeRid: string,
|
|
26
26
|
packetName: string | undefined,
|
|
27
27
|
message: unknown
|
|
28
|
-
): Promise<ZLinkSubmitResult>;
|
|
28
|
+
): ZLinkSubmitResult | Promise<ZLinkSubmitResult>;
|
|
29
29
|
sendToSpot(
|
|
30
30
|
spotRouteTarget: ZLinkSpotRouteTarget,
|
|
31
31
|
message: unknown,
|
|
@@ -34,7 +34,11 @@ export interface ZLinkActorRoutedJoinTransport {
|
|
|
34
34
|
requestRawToSpot?(
|
|
35
35
|
spotRouteTarget: ZLinkSpotRouteTarget,
|
|
36
36
|
request: Message,
|
|
37
|
-
options: {
|
|
37
|
+
options: {
|
|
38
|
+
readonly timeoutMs?: number;
|
|
39
|
+
readonly signal?: AbortSignal;
|
|
40
|
+
readonly onAdmitted?: () => void;
|
|
41
|
+
}
|
|
38
42
|
): Promise<readonly Message[]>;
|
|
39
43
|
requestToSpot<TReply = unknown>(
|
|
40
44
|
spotRouteTarget: ZLinkSpotRouteTarget,
|
|
@@ -43,6 +47,7 @@ export interface ZLinkActorRoutedJoinTransport {
|
|
|
43
47
|
readonly packetName?: string;
|
|
44
48
|
readonly timeoutMs?: number;
|
|
45
49
|
readonly signal?: AbortSignal;
|
|
50
|
+
readonly onAdmitted?: () => void;
|
|
46
51
|
}
|
|
47
52
|
): Promise<TReply>;
|
|
48
53
|
requestFromSpotToSpot?<TReply = unknown>(
|
|
@@ -53,12 +58,17 @@ export interface ZLinkActorRoutedJoinTransport {
|
|
|
53
58
|
readonly packetName?: string;
|
|
54
59
|
readonly timeoutMs?: number;
|
|
55
60
|
readonly signal?: AbortSignal;
|
|
61
|
+
readonly onAdmitted?: () => void;
|
|
56
62
|
}
|
|
57
63
|
): Promise<TReply>;
|
|
58
64
|
requestRawFromSpotToSpot?(
|
|
59
65
|
sourceSpot: ZLinkBackendSpot,
|
|
60
66
|
spotRouteTarget: ZLinkSpotRouteTarget,
|
|
61
67
|
request: Message,
|
|
62
|
-
options: {
|
|
68
|
+
options: {
|
|
69
|
+
readonly timeoutMs?: number;
|
|
70
|
+
readonly signal?: AbortSignal;
|
|
71
|
+
readonly onAdmitted?: () => void;
|
|
72
|
+
}
|
|
63
73
|
): Promise<readonly Message[]>;
|
|
64
74
|
}
|
|
@@ -7,7 +7,11 @@ export async function tryRequestRoutedJson(
|
|
|
7
7
|
transport: ZLinkActorRoutedJoinTransport,
|
|
8
8
|
target: ZLinkSpotRouteTarget,
|
|
9
9
|
payload: unknown,
|
|
10
|
-
options: {
|
|
10
|
+
options: {
|
|
11
|
+
readonly timeoutMs?: number;
|
|
12
|
+
readonly signal?: AbortSignal;
|
|
13
|
+
readonly onAdmitted?: () => void;
|
|
14
|
+
}
|
|
11
15
|
): Promise<boolean> {
|
|
12
16
|
const request = transport.requestRawToSpot;
|
|
13
17
|
if (request === undefined) return false;
|
|
@@ -24,7 +28,11 @@ export async function requestRoutedJsonReply<T>(
|
|
|
24
28
|
transport: ZLinkActorRoutedJoinTransport,
|
|
25
29
|
target: ZLinkSpotRouteTarget,
|
|
26
30
|
payload: unknown,
|
|
27
|
-
options: {
|
|
31
|
+
options: {
|
|
32
|
+
readonly timeoutMs?: number;
|
|
33
|
+
readonly signal?: AbortSignal;
|
|
34
|
+
readonly onAdmitted?: () => void;
|
|
35
|
+
},
|
|
28
36
|
unavailableMessage: string,
|
|
29
37
|
decode: (replyParts: readonly Message[]) => T
|
|
30
38
|
): Promise<T> {
|
|
@@ -191,7 +191,7 @@ export class DefaultZLinkActorManager implements ZLinkActorManager {
|
|
|
191
191
|
const actorRef = this.actorRefForState(state);
|
|
192
192
|
return {
|
|
193
193
|
spotId: spotId,
|
|
194
|
-
objectGeneration: state.
|
|
194
|
+
objectGeneration: state.spotGeneration ?? 0n,
|
|
195
195
|
meshName: this.actorMeshNames.get(actorId) ?? '',
|
|
196
196
|
nodeRid: actorRef.nodeRid
|
|
197
197
|
};
|
|
@@ -467,7 +467,8 @@ export class DefaultZLinkActorManager implements ZLinkActorManager {
|
|
|
467
467
|
await registry.restore(transfer.adapterKey, actor, transfer.state, signal);
|
|
468
468
|
}
|
|
469
469
|
state.setLocationGeneration(authorityOwnerGeneration);
|
|
470
|
-
if (spotId !== undefined)
|
|
470
|
+
if (spotId !== undefined)
|
|
471
|
+
state.setJoinedSpot(spotId, undefined, membershipEpoch, spotGeneration);
|
|
471
472
|
return actor;
|
|
472
473
|
} catch (error) {
|
|
473
474
|
if (nativeRef !== undefined) node.discardRelocatedActor?.(nativeRef);
|
|
@@ -486,17 +487,30 @@ export class DefaultZLinkActorManager implements ZLinkActorManager {
|
|
|
486
487
|
}
|
|
487
488
|
|
|
488
489
|
async abortRelocationActor(actorId: string): Promise<void> {
|
|
489
|
-
await this.
|
|
490
|
+
await this.releaseLocalActor(actorId);
|
|
490
491
|
}
|
|
491
492
|
|
|
492
493
|
async completeRelocationSource(
|
|
493
494
|
actorId: string,
|
|
494
495
|
sourceActorRef?: ZLinkBackendActorRef
|
|
495
496
|
): Promise<void> {
|
|
496
|
-
await this.
|
|
497
|
+
await this.releaseLocalActor(actorId, sourceActorRef);
|
|
497
498
|
}
|
|
498
499
|
|
|
499
|
-
|
|
500
|
+
async releaseSpotActorMembers(meshName: string, spotId?: RoutingId): Promise<void> {
|
|
501
|
+
const results = await Promise.allSettled(
|
|
502
|
+
[...this.states.values()]
|
|
503
|
+
.filter((state) => state.meshName === meshName && state.spotId === spotId)
|
|
504
|
+
.map((state) => this.releaseLocalActor(state.actorId))
|
|
505
|
+
);
|
|
506
|
+
const errors = results
|
|
507
|
+
.filter((result): result is PromiseRejectedResult => result.status === 'rejected')
|
|
508
|
+
.map((result) => result.reason);
|
|
509
|
+
if (errors.length === 1) throw errors[0];
|
|
510
|
+
if (errors.length > 1) throw new AggregateError(errors, 'Actor member cleanup failed.');
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
private async releaseLocalActor(
|
|
500
514
|
actorId: string,
|
|
501
515
|
exactNativeActorRef?: ZLinkBackendActorRef
|
|
502
516
|
): Promise<void> {
|
|
@@ -49,7 +49,8 @@ export class ZLinkSpotActorHandlerRegistryRuntime implements ZLinkActorHandlerRe
|
|
|
49
49
|
);
|
|
50
50
|
const resolvedPacketName = packetName ?? metadata?.packetName;
|
|
51
51
|
if (metadata === undefined || resolvedPacketName === undefined) {
|
|
52
|
-
throw
|
|
52
|
+
throw createInternalFrameworkException(
|
|
53
|
+
ZLinkFrameworkInternalErrorKind.InvalidOperation,
|
|
53
54
|
`Actor packet handler '${handlerType.name}' must declare a packet name.`
|
|
54
55
|
);
|
|
55
56
|
}
|
|
@@ -68,7 +69,8 @@ export class ZLinkSpotActorHandlerRegistryRuntime implements ZLinkActorHandlerRe
|
|
|
68
69
|
addPacket(descriptor: ZLinkActorPacketDescriptor): this {
|
|
69
70
|
const key = packetKey(descriptor.kind, descriptor.actorType, descriptor.packetName);
|
|
70
71
|
if (this.packets.has(key)) {
|
|
71
|
-
throw
|
|
72
|
+
throw createInternalFrameworkException(
|
|
73
|
+
ZLinkFrameworkInternalErrorKind.InvalidOperation,
|
|
72
74
|
`Actor packet '${descriptor.packetName}' for '${descriptor.actorType.name}' is already registered.`
|
|
73
75
|
);
|
|
74
76
|
}
|
package/src/runtime/admission.ts
CHANGED
|
@@ -86,12 +86,25 @@ export class ZLinkRuntimeAdmissionGate {
|
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
run<T>(meshName: string, operation: string, work: () => T | Promise<T>): Promise<T> {
|
|
90
|
+
let claim: ZLinkApplicationWorkClaim | undefined;
|
|
91
91
|
try {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
claim.close
|
|
92
|
+
claim = this.claim(meshName, operation);
|
|
93
|
+
const result = work();
|
|
94
|
+
const close = claim.close;
|
|
95
|
+
return Promise.resolve(result).then(
|
|
96
|
+
(value) => {
|
|
97
|
+
close();
|
|
98
|
+
return value;
|
|
99
|
+
},
|
|
100
|
+
(error) => {
|
|
101
|
+
close();
|
|
102
|
+
throw error;
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
} catch (error) {
|
|
106
|
+
claim?.close();
|
|
107
|
+
return Promise.reject(error);
|
|
95
108
|
}
|
|
96
109
|
}
|
|
97
110
|
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
ApplicationJobOrigin,
|
|
3
|
+
ApplicationJobPermitPort,
|
|
4
|
+
ApplicationJobQueuePort
|
|
5
|
+
} from './contracts';
|
|
2
6
|
|
|
3
7
|
export type ApplicationJobRecordDomain = 'application' | 'infrastructure';
|
|
4
8
|
|
|
@@ -12,7 +16,7 @@ export interface IngressRecordPort {
|
|
|
12
16
|
* ordinary Framework-owned ingress record closes after the last child terminal.
|
|
13
17
|
*/
|
|
14
18
|
export class ApplicationIngressRecordOwner {
|
|
15
|
-
private
|
|
19
|
+
private stop?: AbortController;
|
|
16
20
|
private closed = false;
|
|
17
21
|
|
|
18
22
|
private constructor(private readonly shared: SharedIngressRecordState) {}
|
|
@@ -42,17 +46,34 @@ export class ApplicationIngressRecordOwner {
|
|
|
42
46
|
return job;
|
|
43
47
|
}
|
|
44
48
|
|
|
45
|
-
|
|
49
|
+
acquire(
|
|
46
50
|
domain: ApplicationJobRecordDomain,
|
|
47
51
|
signal?: AbortSignal
|
|
48
|
-
): Promise<ApplicationJobRecordLease> {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
): ApplicationJobRecordLease | Promise<ApplicationJobRecordLease> {
|
|
53
|
+
try {
|
|
54
|
+
this.requireOpen();
|
|
55
|
+
const initial = this.shared.takeInitialPermit(domain);
|
|
56
|
+
if (initial !== undefined) return initial;
|
|
57
|
+
} catch (error) {
|
|
58
|
+
return Promise.reject(error);
|
|
59
|
+
}
|
|
52
60
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
61
|
+
return this.acquireAdditional(domain, signal);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
private async acquireAdditional(
|
|
65
|
+
domain: ApplicationJobRecordDomain,
|
|
66
|
+
signal?: AbortSignal
|
|
67
|
+
): Promise<ApplicationJobRecordLease> {
|
|
68
|
+
const stop = (this.stop ??= new AbortController());
|
|
69
|
+
const waitSignal = signal === undefined ? stop.signal : AbortSignal.any([stop.signal, signal]);
|
|
70
|
+
let permit: ApplicationJobPermitPort;
|
|
71
|
+
try {
|
|
72
|
+
permit = await this.shared.acquirePermit(waitSignal);
|
|
73
|
+
} catch (error) {
|
|
74
|
+
if (error === ownerClosedError) throw ownerClosedError();
|
|
75
|
+
throw error;
|
|
76
|
+
}
|
|
56
77
|
if (this.closed) {
|
|
57
78
|
permit.releaseAfterInternalProcessing();
|
|
58
79
|
throw ownerClosedError();
|
|
@@ -63,7 +84,8 @@ export class ApplicationIngressRecordOwner {
|
|
|
63
84
|
close(): void {
|
|
64
85
|
if (this.closed) return;
|
|
65
86
|
this.closed = true;
|
|
66
|
-
this.
|
|
87
|
+
// The queue forwards this reason; only a rejected acquisition constructs the error.
|
|
88
|
+
this.stop?.abort(ownerClosedError);
|
|
67
89
|
this.shared.releaseOwner();
|
|
68
90
|
}
|
|
69
91
|
|
|
@@ -75,16 +97,18 @@ export class ApplicationIngressRecordOwner {
|
|
|
75
97
|
/** Queue-permit child of one shared raw ingress record. */
|
|
76
98
|
export class ApplicationJobRecordLease implements ApplicationJobPermitPort {
|
|
77
99
|
private ingressClosed = false;
|
|
78
|
-
private permitReleased = false;
|
|
79
100
|
private processingTerminal = false;
|
|
80
|
-
|
|
81
|
-
private jobReleased = false;
|
|
101
|
+
detachedForHandlerTurn = false;
|
|
82
102
|
|
|
83
103
|
constructor(
|
|
84
104
|
private readonly shared: SharedIngressRecordState,
|
|
85
|
-
private
|
|
105
|
+
private permit: ApplicationJobPermitPort | undefined
|
|
86
106
|
) {}
|
|
87
107
|
|
|
108
|
+
get origin(): ApplicationJobOrigin {
|
|
109
|
+
return this.shared.origin;
|
|
110
|
+
}
|
|
111
|
+
|
|
88
112
|
markApplicationQueued(): void {
|
|
89
113
|
// The owner classifies and marks the child atomically when it is created;
|
|
90
114
|
// downstream dispatch must not mutate queue accounting a second time.
|
|
@@ -95,12 +119,12 @@ export class ApplicationJobRecordLease implements ApplicationJobPermitPort {
|
|
|
95
119
|
}
|
|
96
120
|
|
|
97
121
|
releaseBeforeHandler(): void {
|
|
98
|
-
this.
|
|
122
|
+
this.permit?.releaseBeforeHandler();
|
|
99
123
|
}
|
|
100
124
|
|
|
101
125
|
releaseAfterInternalProcessing(): void {
|
|
102
126
|
this.processingTerminal = true;
|
|
103
|
-
this.
|
|
127
|
+
this.permit?.releaseAfterInternalProcessing();
|
|
104
128
|
this.releaseJobIfTerminal();
|
|
105
129
|
}
|
|
106
130
|
|
|
@@ -114,16 +138,15 @@ export class ApplicationJobRecordLease implements ApplicationJobPermitPort {
|
|
|
114
138
|
this.releaseJobIfTerminal();
|
|
115
139
|
}
|
|
116
140
|
|
|
117
|
-
private releasePermit(release: () => void): void {
|
|
118
|
-
if (this.permitReleased) return;
|
|
119
|
-
this.permitReleased = true;
|
|
120
|
-
release();
|
|
121
|
-
}
|
|
122
|
-
|
|
123
141
|
private releaseJobIfTerminal(): void {
|
|
124
|
-
|
|
125
|
-
this.
|
|
126
|
-
this.
|
|
142
|
+
const permit = this.permit;
|
|
143
|
+
if (permit === undefined || !this.ingressClosed || !this.processingTerminal) return;
|
|
144
|
+
this.permit = undefined;
|
|
145
|
+
try {
|
|
146
|
+
this.shared.releaseJob();
|
|
147
|
+
} finally {
|
|
148
|
+
permit.releaseStorage?.();
|
|
149
|
+
}
|
|
127
150
|
}
|
|
128
151
|
}
|
|
129
152
|
|
|
@@ -132,12 +155,14 @@ class SharedIngressRecordState {
|
|
|
132
155
|
private jobCount = 0;
|
|
133
156
|
private initialPermit?: ApplicationJobPermitPort;
|
|
134
157
|
private recordClosed = false;
|
|
158
|
+
readonly origin: ApplicationJobOrigin;
|
|
135
159
|
|
|
136
160
|
constructor(
|
|
137
161
|
private readonly queue: ApplicationJobQueuePort,
|
|
138
162
|
initialPermit: ApplicationJobPermitPort,
|
|
139
163
|
private readonly record: IngressRecordPort
|
|
140
164
|
) {
|
|
165
|
+
this.origin = initialPermit.origin;
|
|
141
166
|
this.initialPermit = initialPermit;
|
|
142
167
|
}
|
|
143
168
|
|
|
@@ -160,7 +185,7 @@ class SharedIngressRecordState {
|
|
|
160
185
|
}
|
|
161
186
|
|
|
162
187
|
acquirePermit(signal: AbortSignal): Promise<ApplicationJobPermitPort> {
|
|
163
|
-
return this.queue.acquire(signal);
|
|
188
|
+
return this.queue.acquire(signal, this.origin);
|
|
164
189
|
}
|
|
165
190
|
|
|
166
191
|
createJob(
|
|
@@ -193,6 +218,7 @@ class SharedIngressRecordState {
|
|
|
193
218
|
try {
|
|
194
219
|
this.initialPermit?.releaseAfterInternalProcessing();
|
|
195
220
|
} finally {
|
|
221
|
+
this.initialPermit?.releaseStorage?.();
|
|
196
222
|
this.initialPermit = undefined;
|
|
197
223
|
this.record.close();
|
|
198
224
|
}
|
|
@@ -1,40 +1,70 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
2
|
|
|
3
|
-
import type { ApplicationJobPermitPort } from './contracts';
|
|
3
|
+
import type { ApplicationJobOrigin, ApplicationJobPermitPort } from './contracts';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const applicationJobPermitScope = new AsyncLocalStorage<ApplicationJobPermitPort | undefined>();
|
|
6
|
+
|
|
7
|
+
function releasePermitTurn(): void {
|
|
8
|
+
const permit = applicationJobPermitScope.getStore();
|
|
9
|
+
if (permit !== undefined && !permit.detachedForHandlerTurn)
|
|
10
|
+
permit.releaseAfterInternalProcessing();
|
|
8
11
|
}
|
|
9
12
|
|
|
10
|
-
|
|
13
|
+
function releasePermitSuccess<TResult>(value: TResult): TResult {
|
|
14
|
+
releasePermitTurn();
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function releasePermitFailure(error: unknown): never {
|
|
19
|
+
releasePermitTurn();
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
11
22
|
|
|
12
23
|
/**
|
|
13
24
|
* Carries the host-owned queue permit through internal async dispatch without
|
|
14
25
|
* leaking capacity ownership into public handler contracts.
|
|
15
26
|
*/
|
|
16
|
-
export
|
|
27
|
+
export function runWithApplicationJobPermit<TResult>(
|
|
28
|
+
permit: ApplicationJobPermitPort,
|
|
29
|
+
callback: () => Promise<TResult>
|
|
30
|
+
): Promise<TResult>;
|
|
31
|
+
export function runWithApplicationJobPermit<TResult, TFirst = undefined, TSecond = undefined>(
|
|
17
32
|
permit: ApplicationJobPermitPort,
|
|
18
|
-
callback: () => Promise<TResult> | TResult
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
33
|
+
callback: (first: TFirst, second: TSecond) => Promise<TResult> | TResult,
|
|
34
|
+
first?: TFirst,
|
|
35
|
+
second?: TSecond
|
|
36
|
+
): TResult | Promise<TResult>;
|
|
37
|
+
export function runWithApplicationJobPermit<TResult, TFirst, TSecond>(
|
|
38
|
+
permit: ApplicationJobPermitPort,
|
|
39
|
+
callback: (first: TFirst, second: TSecond) => Promise<TResult> | TResult,
|
|
40
|
+
first?: TFirst,
|
|
41
|
+
second?: TSecond
|
|
42
|
+
): TResult | Promise<TResult> {
|
|
43
|
+
const previous = applicationJobPermitScope.getStore();
|
|
44
|
+
applicationJobPermitScope.enterWith(permit);
|
|
45
|
+
try {
|
|
46
|
+
const result = callback(first as TFirst, second as TSecond);
|
|
47
|
+
if (result !== null && (typeof result === 'object' || typeof result === 'function')) {
|
|
48
|
+
return Promise.resolve(result).then(releasePermitSuccess, releasePermitFailure);
|
|
26
49
|
}
|
|
27
|
-
|
|
50
|
+
releasePermitTurn();
|
|
51
|
+
return result;
|
|
52
|
+
} catch (error) {
|
|
53
|
+
releasePermitTurn();
|
|
54
|
+
return Promise.reject(error);
|
|
55
|
+
} finally {
|
|
56
|
+
applicationJobPermitScope.enterWith(previous);
|
|
57
|
+
}
|
|
28
58
|
}
|
|
29
59
|
|
|
30
60
|
/** Releases the current job permit immediately before the first user callback. */
|
|
31
61
|
export function releaseApplicationJobPermitBeforeHandler(): void {
|
|
32
|
-
applicationJobPermitScope.getStore()?.
|
|
62
|
+
applicationJobPermitScope.getStore()?.releaseBeforeHandler();
|
|
33
63
|
}
|
|
34
64
|
|
|
35
65
|
/** @internal Returns an ingress permit after a durable queue takes record ownership. */
|
|
36
66
|
export function releaseApplicationJobPermitForDurableHandoff(): void {
|
|
37
|
-
applicationJobPermitScope.getStore()?.
|
|
67
|
+
applicationJobPermitScope.getStore()?.releaseAfterInternalProcessing();
|
|
38
68
|
}
|
|
39
69
|
|
|
40
70
|
/** True while dispatch already owns the host-wide application job permit. */
|
|
@@ -42,6 +72,11 @@ export function hasApplicationJobPermit(): boolean {
|
|
|
42
72
|
return applicationJobPermitScope.getStore() !== undefined;
|
|
43
73
|
}
|
|
44
74
|
|
|
75
|
+
/** Keeps the ingress origin when a durable record later reacquires its permit. */
|
|
76
|
+
export function currentApplicationJobOrigin(): ApplicationJobOrigin {
|
|
77
|
+
return applicationJobPermitScope.getStore()!.origin;
|
|
78
|
+
}
|
|
79
|
+
|
|
45
80
|
/** Re-enters the captured permit scope when a serial executor runs later. */
|
|
46
81
|
export function bindApplicationJobPermit<TResult, TArgument>(
|
|
47
82
|
callback: (argument?: TArgument) => Promise<TResult> | TResult
|
|
@@ -56,9 +91,8 @@ export function bindApplicationJobPermit<TResult, TArgument>(
|
|
|
56
91
|
* detached owner must release it at handler entry or at a pre-start terminal.
|
|
57
92
|
*/
|
|
58
93
|
export function detachApplicationJobPermit(): ApplicationJobPermitPort | undefined {
|
|
59
|
-
const
|
|
60
|
-
if (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return scope.permit;
|
|
94
|
+
const permit = applicationJobPermitScope.getStore();
|
|
95
|
+
if (permit === undefined) return undefined;
|
|
96
|
+
permit.detachForHandlerTurn();
|
|
97
|
+
return permit;
|
|
64
98
|
}
|
|
@@ -1,13 +1,39 @@
|
|
|
1
|
+
export type ApplicationJobOrigin = 'local' | 'remote';
|
|
2
|
+
|
|
1
3
|
export interface ApplicationJobPermitPort {
|
|
4
|
+
readonly origin: ApplicationJobOrigin;
|
|
5
|
+
readonly detachedForHandlerTurn: boolean;
|
|
2
6
|
markApplicationQueued(): void;
|
|
3
7
|
/** Transfers ingress-record cleanup to a detached exact-target handler turn. */
|
|
4
|
-
detachForHandlerTurn
|
|
8
|
+
detachForHandlerTurn(): void;
|
|
5
9
|
releaseBeforeHandler(): void;
|
|
6
10
|
releaseAfterInternalProcessing(): void;
|
|
11
|
+
/** Returns reusable reservation storage only after its ingress lifetime ends. */
|
|
12
|
+
releaseStorage?(): void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ApplicationJobReceiveRotationPort {
|
|
16
|
+
reserve(): void;
|
|
17
|
+
take(): ApplicationJobPermitPort | undefined;
|
|
18
|
+
releaseUnused(): void;
|
|
7
19
|
}
|
|
8
20
|
|
|
9
21
|
export interface ApplicationJobQueuePort {
|
|
10
|
-
|
|
22
|
+
createReceiveRotation(
|
|
23
|
+
capacity: number,
|
|
24
|
+
origin: ApplicationJobOrigin
|
|
25
|
+
): ApplicationJobReceiveRotationPort;
|
|
26
|
+
acquire(
|
|
27
|
+
signal: AbortSignal | undefined,
|
|
28
|
+
origin: ApplicationJobOrigin
|
|
29
|
+
): Promise<ApplicationJobPermitPort>;
|
|
30
|
+
/** Returns a grant now, or registers one FIFO waiter that later calls resume. */
|
|
31
|
+
acquireOrResume(
|
|
32
|
+
resume: (permit: ApplicationJobPermitPort) => void,
|
|
33
|
+
reject: (reason: unknown) => void,
|
|
34
|
+
signal: AbortSignal | undefined,
|
|
35
|
+
origin: ApplicationJobOrigin
|
|
36
|
+
): ApplicationJobPermitPort | undefined;
|
|
11
37
|
registerReceiveFlowTarget?(
|
|
12
38
|
identity: object,
|
|
13
39
|
applyState: (state: 'running' | 'paused') => void,
|