import { PublicKey } from "@chainsafe/blst";
import { ISignatureSet, PubkeyCache } from "@lodestar/state-transition";
import { Logger } from "@lodestar/utils";
import { Metrics } from "../../../metrics/index.js";
import { IBlsVerifier, VerifySignatureOpts } from "../interface.js";
import { JobQueueItemType } from "./jobItem.js";
export type BlsMultiThreadWorkerPoolModules = {
    logger: Logger;
    metrics: Metrics | null;
    pubkeyCache: PubkeyCache;
};
export type BlsMultiThreadWorkerPoolOptions = {
    blsVerifyAllMultiThread?: boolean;
};
export type { JobQueueItemType };
/**
 * Wraps "threads" library thread pool queue system with the goals:
 * - Complete total outstanding jobs in total minimum time possible.
 *   Will split large signature sets into smaller sets and send to different workers
 * - Reduce the latency cost for small signature sets. In NodeJS 12,14 worker <-> main thread
 *   communication has very high latency, of around ~5 ms. So package multiple small signature
 *   sets into packages of work and send at once to a worker to distribute the latency cost
 */
export declare class BlsMultiThreadWorkerPool implements IBlsVerifier {
    private readonly logger;
    private readonly metrics;
    private readonly pubkeyCache;
    private readonly workers;
    private readonly jobs;
    private bufferedJobs;
    private blsVerifyAllMultiThread;
    private closed;
    private workersBusy;
    constructor(options: BlsMultiThreadWorkerPoolOptions, modules: BlsMultiThreadWorkerPoolModules);
    canAcceptWork(): boolean;
    verifySignatureSets(sets: ISignatureSet[], opts?: VerifySignatureOpts): Promise<boolean>;
    /**
     * Verify signature sets of the same message, only supports worker verification.
     */
    verifySignatureSetsSameMessage(sets: {
        publicKey: PublicKey;
        signature: Uint8Array;
    }[], message: Uint8Array, opts?: Omit<VerifySignatureOpts, "verifyOnMainThread">): Promise<boolean[]>;
    close(): Promise<void>;
    private createWorkers;
    /**
     * Register BLS work to be done eventually in a worker
     */
    private queueBlsWork;
    /**
     * Potentially submit jobs to an idle worker, only if there's a worker and jobs
     */
    private runJob;
    /**
     * Grab pending work up to a max number of signatures
     */
    private prepareWork;
    /**
     * Add all buffered jobs to the job queue and potentially run them immediately
     */
    private runBufferedJobs;
    private retryJobItemSameMessage;
    /** For testing */
    protected waitTillInitialized(): Promise<void>;
}
//# sourceMappingURL=index.d.ts.map