40 lines · 1.4 KB · TypeScript
RawDownload
/** * ThreadDeletionReactor - Thread deletion cleanup reactor service interface. * * Owns background workers that react to thread deletion domain events and * perform best-effort runtime cleanup for provider sessions and terminals. * * @module ThreadDeletionReactor */import * as Context from "effect/Context";import type * as Effect from "effect/Effect";import type * as Scope from "effect/Scope"; /** * ThreadDeletionReactorShape - Service API for thread deletion cleanup. */export interface ThreadDeletionReactorShape {  /**   * Start reacting to thread.deleted orchestration domain events.   *   * The returned effect must be run in a scope so all worker fibers can be   * finalized on shutdown.   */  readonly start: () => Effect.Effect<void, never, Scope.Scope>;   /**   * Resolves once every thread.deleted at or before the supplied event   * sequence has been handed to the worker and the worker is empty and idle.   * A successful thread.create sequence is the fence callers use before the   * new incarnation can own runtime resources.   */  readonly drainThrough: (sequence: number) => Effect.Effect<void>;} /** * ThreadDeletionReactor - Service tag for thread deletion cleanup workers. */export class ThreadDeletionReactor extends Context.Service<  ThreadDeletionReactor,  ThreadDeletionReactorShape>()("t3/orchestration/Services/ThreadDeletionReactor") {}