UNPKG

grafast

Version:

Cutting edge GraphQL planning and execution engine

25 lines 1.44 kB
import { type Maybe } from ".."; import type { Step } from "../step"; declare const $$isDistributor: unique symbol; export interface Distributor<TData> { [$$isDistributor]: true; iterableFor(stepId: number): AsyncIterable<TData, void, never>; releaseIfUnused(stepId: number): void; } export declare function isDistributor<TData = any>(value: null | undefined | (object & { [$$isDistributor]?: true; })): value is Distributor<TData>; /** * Creates a "distributor" for the sourceIterable such that the dependent steps * may each consume it independently and safely. * * @param sourceIterable - the iterable or async iterable to clone * @param dependentSteps - the steps we're expecting to depend on this (so we * know how many clones we'll need) * @param grafastOptions - the options (from the preset) that may be relevant */ export declare function distributor<TData>(sourceIterable: AsyncIterable<TData, void, never> | Iterable<TData, void, never>, dependentSteps: readonly Step[], abortSignal: AbortSignal, distributorOptions: DistributorOptions): Distributor<TData>; export type DistributorOptions = Required<Pick<GraphileConfig.GrafastOptions, "distributorPauseDuration" | "distributorTargetBufferSize" | "distributorTargetBufferSizeIncrement">>; export declare function resolveDistributorOptions(options: Maybe<GraphileConfig.GrafastOptions>): DistributorOptions; export {}; //# sourceMappingURL=distributor.d.ts.map