import { MessagePort, Worker } from "node:worker_threads";
import { Thread } from "@chainsafe/threads";
import { Logger } from "@lodestar/logger";
import { Metrics } from "../metrics/metrics.js";
import { NetworkCoreWorkerMetrics } from "../network/core/metrics.js";
import { EventDirection } from "../network/events.js";
import { StrictEventEmitterSingleArg } from "./strictEvents.js";
export type WorkerBridgeEvent<EventData> = {
    type: string;
    event: keyof EventData;
    posted: [number, number];
    data: EventData[keyof EventData];
};
/**
 * Bridges events from worker to main thread
 * Each event can only have one direction:
 * - worker to main
 * - main to worker
 */
export declare function wireEventsOnWorkerThread<EventData>(mainEventName: string, events: StrictEventEmitterSingleArg<EventData>, parentPort: MessagePort, metrics: NetworkCoreWorkerMetrics | null, isWorkerToMain: {
    [K in keyof EventData]: EventDirection;
}): void;
export declare function wireEventsOnMainThread<EventData>(mainEventName: string, events: StrictEventEmitterSingleArg<EventData>, worker: Pick<Worker, "on" | "postMessage">, metrics: Metrics | null, isWorkerToMain: {
    [K in keyof EventData]: EventDirection;
}): void;
export declare function terminateWorkerThread({ worker, retryMs, retryCount, logger }: {
    worker: Thread;
    retryMs: number;
    retryCount: number;
    logger?: Logger;
}): Promise<void>;
//# sourceMappingURL=workerEvents.d.ts.map