UNPKG

@cloud-copilot/iam-collect

Version:

Collect IAM information from AWS Accounts

62 lines 1.8 kB
import { type Job, type JobResult } from './jobQueue.js'; /** * Job runner that allows running jobs as they are created. * This will wait for jobs to be added to it and run them up the * maximum concurrency. * * Results are available via `getResults()`. */ export declare class JobRunner<T = void, P = Record<string, unknown>> { private concurrency; private queue; private results; private activeJobs; private waitingResolvers; private workers; private isAcceptingWork; private workAvailablePromise; private resolveWorkAvailable; /** * Create a new runner with the specified concurrency. * * @param concurrency - The maximum number of jobs to run concurrently. */ constructor(concurrency: number); private worker; private waitForWorkAvailable; private ensureWorkers; private notifyWorkersOfNewWork; private checkIfIdle; /** * Add a job to the queue */ enqueue(job: Job<T, P>): void; /** * Add multiple jobs to the queue */ enqueueAll(jobs: Job<T, P>[]): void; /** * Returns a promise that resolves when all queued work is complete */ waitForIdle(): Promise<void>; /** * Get all results accumulated so far */ getResults(): JobResult<T, P>[]; /** * Shutdown the queue - no new jobs will be accepted, but existing jobs will complete. * * Returns when a promise that resolves when all jobs have been processed and * are available in `getResults()`. */ finishAllWork(): Promise<void>; /** * Get the current queue length */ get queueLength(): number; /** * Get the number of currently active jobs */ get activeJobCount(): number; } //# sourceMappingURL=jobRunner.d.ts.map