Open History to see the last commit
1/**
2 * CheckpointReactor - Checkpoint reaction service interface.
3 *
4 * Owns background workers that react to orchestration checkpoint lifecycle
5 * events and apply checkpoint side effects.
6 *
7 * @module CheckpointReactor
8 */
9import { ServiceMap } from "effect";
10import type { Effect, Scope } from "effect";
11
12/**
13 * CheckpointReactorShape - Service API for checkpoint reactor lifecycle.
14 */
15export interface CheckpointReactorShape {
16 /**
17 * Start the checkpoint reactor.
18 *
19 * The returned effect must be run in a scope so all worker fibers can be
20 * finalized on shutdown.
21 *
22 * Consumes both orchestration-domain and provider-runtime events via an
23 * internal queue.
24 */
25 readonly start: Effect.Effect<void, never, Scope.Scope>;
26
27 /**
28 * Resolves when the internal processing queue is empty and idle.
29 * Intended for test use to replace timing-sensitive sleeps.
30 */
31 readonly drain: Effect.Effect<void>;
32}
33
34/**
35 * CheckpointReactor - Service tag for checkpoint reactor workers.
36 */
37export class CheckpointReactor extends ServiceMap.Service<
38 CheckpointReactor,
39 CheckpointReactorShape
40>()("t3/orchestration/Services/CheckpointReactor") {}