Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

ProviderRuntimeIngestion.ts

41 lines1.4 KB

1/**
2 * ProviderRuntimeIngestionService - Provider runtime ingestion service interface.
3 *
4 * Owns background workers that consume provider runtime streams and emit
5 * orchestration commands/events.
6 *
7 * @module ProviderRuntimeIngestionService
8 */
9import * as Context from "effect/Context";
10import type * as Effect from "effect/Effect";
11import type * as Scope from "effect/Scope";
12​
13/**
14 * ProviderRuntimeIngestionShape - Service API for runtime ingestion lifecycle.
15 */
16export interface ProviderRuntimeIngestionShape {
17 /**
18 * Start ingesting provider runtime events into orchestration commands.
19 *
20 * The returned effect must be run in a scope so all worker fibers can be
21 * finalized on shutdown.
22 *
23 * Uses an internal queue and continues after non-interrupt failures by
24 * logging warnings.
25 */
26 readonly start: () => Effect.Effect<void, never, Scope.Scope>;
27​
28 /**
29 * Resolves when the internal processing queue is empty and idle.
30 * Intended for test use to replace timing-sensitive sleeps.
31 */
32 readonly drain: Effect.Effect<void>;
34​
35/**
36 * ProviderRuntimeIngestionService - Service tag for runtime ingestion workers.
37 */
38export class ProviderRuntimeIngestionService extends Context.Service<
39 ProviderRuntimeIngestionService,
40 ProviderRuntimeIngestionShape
41>()("t3/orchestration/Services/ProviderRuntimeIngestion/ProviderRuntimeIngestionService") {}