import { Exit } from "@effect/core/io/Exit/definition"; import { Effect } from "@effect/core/io/Effect/definition"; import { ImmutableQueue } from "@tsplus/stdlib/collections/ImmutableQueue/definition"; import type { ErasedChannel, ErasedExecutor } from "@effect/core/stream/Channel/ChannelExecutor"; import type { ChildExecutorDecision } from "@effect/core/stream/Channel/ChildExecutorDecision"; import type { UpstreamPullRequest } from "@effect/core/stream/Channel/UpstreamPullRequest"; import type { UpstreamPullStrategy } from "@effect/core/stream/Channel/UpstreamPullStrategy"; export declare const SubexecutorSym: unique symbol; export type SubexecutorSym = typeof SubexecutorSym; /** * @tsplus type effect/core/stream/Channel/Subexecutor */ export interface Subexecutor { readonly [SubexecutorSym]: SubexecutorSym; readonly close: (exit: Exit) => Effect | undefined; readonly enqueuePullFromChild: (child: PullFromChild) => Subexecutor; } /** * @tsplus type effect/core/stream/Channel/Subexecutor.Ops */ export interface SubexecutorOps { } export declare const Subexecutor: SubexecutorOps; /** * Execute upstreamExecutor and for each emitted element, spawn a child * channel and continue with processing it by `PullFromChild`. */ export declare class PullFromUpstream implements Subexecutor { readonly upstreamExecutor: ErasedExecutor; readonly createChild: (_: unknown) => ErasedChannel; readonly lastDone: unknown; readonly activeChildExecutors: ImmutableQueue | undefined>; readonly combineChildResults: (x: unknown, y: unknown) => unknown; readonly combineWithChildResult: (x: unknown, y: unknown) => unknown; readonly onPull: (_: UpstreamPullRequest) => UpstreamPullStrategy; readonly onEmit: (_: unknown) => ChildExecutorDecision; readonly _tag = "PullFromUpstream"; readonly [SubexecutorSym]: SubexecutorSym; constructor(upstreamExecutor: ErasedExecutor, createChild: (_: unknown) => ErasedChannel, lastDone: unknown, activeChildExecutors: ImmutableQueue | undefined>, combineChildResults: (x: unknown, y: unknown) => unknown, combineWithChildResult: (x: unknown, y: unknown) => unknown, onPull: (_: UpstreamPullRequest) => UpstreamPullStrategy, onEmit: (_: unknown) => ChildExecutorDecision); close(exit: Exit): Effect | undefined; enqueuePullFromChild(child: PullFromChild): Subexecutor; } /** * Execute the childExecutor and on each emitted value, decide what to do by * `onEmit`. */ export declare class PullFromChild implements Subexecutor { readonly childExecutor: ErasedExecutor; readonly parentSubexecutor: Subexecutor; readonly onEmit: (_: unknown) => ChildExecutorDecision; readonly _tag = "PullFromChild"; readonly [SubexecutorSym]: SubexecutorSym; constructor(childExecutor: ErasedExecutor, parentSubexecutor: Subexecutor, onEmit: (_: unknown) => ChildExecutorDecision); close(exit: Exit): Effect | undefined; enqueuePullFromChild(_: PullFromChild): Subexecutor; } export declare class DrainChildExecutors implements Subexecutor { readonly upstreamExecutor: ErasedExecutor; readonly lastDone: unknown; readonly activeChildExecutors: ImmutableQueue | undefined>; readonly upstreamDone: Exit; readonly combineChildResults: (x: unknown, y: unknown) => unknown; readonly combineWithChildResult: (x: unknown, y: unknown) => unknown; readonly onPull: (_: UpstreamPullRequest) => UpstreamPullStrategy; readonly _tag = "DrainChildExecutors"; readonly [SubexecutorSym]: SubexecutorSym; constructor(upstreamExecutor: ErasedExecutor, lastDone: unknown, activeChildExecutors: ImmutableQueue | undefined>, upstreamDone: Exit, combineChildResults: (x: unknown, y: unknown) => unknown, combineWithChildResult: (x: unknown, y: unknown) => unknown, onPull: (_: UpstreamPullRequest) => UpstreamPullStrategy); close(exit: Exit): Effect | undefined; enqueuePullFromChild(child: PullFromChild): Subexecutor; } export declare class Emit implements Subexecutor { readonly value: unknown; readonly next: Subexecutor; readonly _tag = "Emit"; readonly [SubexecutorSym]: SubexecutorSym; constructor(value: unknown, next: Subexecutor); close(exit: Exit): Effect | undefined; enqueuePullFromChild(_child: PullFromChild): Subexecutor; } /** * @tsplus macro remove */ export declare function concreteSubexecutor(_: Subexecutor): asserts _ is PullFromUpstream | PullFromChild | DrainChildExecutors | Emit; /** * @tsplus static effect/core/stream/Channel/Subexecutor.Ops PullFromUpstream * @tsplus location "@effect/core/stream/Channel/Subexecutor" */ export declare function pullFromUpstream(upstreamExecutor: ErasedExecutor, createChild: (_: unknown) => ErasedChannel, lastDone: unknown, activeChildExecutors: ImmutableQueue | undefined>, combineChildResults: (x: unknown, y: unknown) => unknown, combineWithChildResult: (x: unknown, y: unknown) => unknown, onPull: (_: UpstreamPullRequest) => UpstreamPullStrategy, onEmit: (_: unknown) => ChildExecutorDecision): Subexecutor; /** * @tsplus static effect/core/stream/Channel/Subexecutor.Ops PullFromChild * @tsplus location "@effect/core/stream/Channel/Subexecutor" */ export declare function pullFromChild(childExecutor: ErasedExecutor, parentSubexecutor: Subexecutor, onEmit: (_: unknown) => ChildExecutorDecision): Subexecutor; /** * @tsplus static effect/core/stream/Channel/Subexecutor.Ops DrainChildExecutors * @tsplus location "@effect/core/stream/Channel/Subexecutor" */ export declare function drainChildExecutors(upstreamExecutor: ErasedExecutor, lastDone: unknown, activeChildExecutors: ImmutableQueue | undefined>, upstreamDone: Exit, combineChildResults: (x: unknown, y: unknown) => unknown, combineWithChildResult: (x: unknown, y: unknown) => unknown, onPull: (_: UpstreamPullRequest) => UpstreamPullStrategy): Subexecutor; /** * @tsplus static effect/core/stream/Channel/Subexecutor.Ops Emit * @tsplus location "@effect/core/stream/Channel/Subexecutor" */ export declare function emit(value: unknown, next: Subexecutor): Subexecutor; //# sourceMappingURL=Subexecutor.d.ts.map