42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
/**
|
|
* ProviderCommandReactor - Provider command reaction service interface.
|
|
*
|
|
* Owns background workers that react to orchestration intent events and
|
|
* dispatch provider-side command execution.
|
|
*
|
|
* @module ProviderCommandReactor
|
|
*/
|
|
import * as Context from "effect/Context";
|
|
import type * as Effect from "effect/Effect";
|
|
import type * as Scope from "effect/Scope";
|
|
|
|
/**
|
|
* ProviderCommandReactorShape - Service API for provider command reactors.
|
|
*/
|
|
export interface ProviderCommandReactorShape {
|
|
/**
|
|
* Start reacting to provider-intent orchestration domain events.
|
|
*
|
|
* The returned effect must be run in a scope so all worker fibers can be
|
|
* finalized on shutdown.
|
|
*
|
|
* Filters orchestration domain events to provider-intent types before
|
|
* processing.
|
|
*/
|
|
readonly start: () => Effect.Effect<void, never, Scope.Scope>;
|
|
|
|
/**
|
|
* Resolves when the internal processing queue is empty and idle.
|
|
* Intended for test use to replace timing-sensitive sleeps.
|
|
*/
|
|
readonly drain: Effect.Effect<void>;
|
|
}
|
|
|
|
/**
|
|
* ProviderCommandReactor - Service tag for provider command reaction workers.
|
|
*/
|
|
export class ProviderCommandReactor extends Context.Service<
|
|
ProviderCommandReactor,
|
|
ProviderCommandReactorShape
|
|
>()("t3/orchestration/Services/ProviderCommandReactor") {}
|