/** * Worker pools with bounded concurrency and explicit queueing. * * @module bquery/concurrency */ import type { CreateRpcPoolOptions, CreateTaskPoolOptions, RpcPool, TaskPool, WorkerRpcHandlers, WorkerTaskHandler } from './types'; /** * Creates a reusable pool of task workers with bounded concurrency and FIFO queueing. * * @example * ```ts * import { createTaskPool } from '@bquery/bquery/concurrency'; * * const pool = createTaskPool( * ({ value }: { value: number }) => value * 2, * { concurrency: 4, maxQueue: 16, name: 'double-pool' } * ); * * const results = await Promise.all([ * pool.run({ value: 1 }), * pool.run({ value: 2 }), * pool.run({ value: 3 }), * ]); * * pool.terminate(); * ``` */ export declare function createTaskPool(handler: WorkerTaskHandler, options?: CreateTaskPoolOptions): TaskPool; /** * Creates a reusable pool of RPC workers with bounded concurrency and FIFO queueing. * * @example * ```ts * import { createRpcPool } from '@bquery/bquery/concurrency'; * * const pool = createRpcPool( * { * sum: ({ values }: { values: number[] }) => values.reduce((total, value) => total + value, 0), * }, * { concurrency: 2, maxQueue: 8 } * ); * * const total = await pool.call('sum', { values: [1, 2, 3] }); * pool.terminate(); * ``` */ export declare function createRpcPool(handlers: TRoutes, options?: CreateRpcPoolOptions): RpcPool; //# sourceMappingURL=pool.d.ts.map