X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Ftypes%2FWorker.ts;h=8f47f57818e6e8b968bc10dce0c5bc21552df56e;hb=72495c24c4e750fce20245faca4609dd4eacd7ba;hp=dde976aea42278d2c3e17c63ec891e9c44849f58;hpb=322c9192eaa7142da1bf475cc2c6588ca72d922c;p=e-mobility-charging-stations-simulator.git diff --git a/src/types/Worker.ts b/src/types/Worker.ts index dde976ae..8f47f578 100644 --- a/src/types/Worker.ts +++ b/src/types/Worker.ts @@ -1,3 +1,4 @@ +import { PoolOptions } from 'poolifier'; import { Worker } from 'worker_threads'; export enum WorkerProcessType { @@ -11,22 +12,25 @@ export interface WorkerOptions { poolMaxSize?: number; poolMinSize?: number; elementsPerWorker?: number; + poolOptions?: PoolOptions; + messageHandler?: (message: unknown) => void | Promise; } // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface WorkerData {} -export interface StationWorkerData extends WorkerData { - index: number; - templateFile: string; +export interface WorkerSetElement { + worker: Worker; + numberOfWorkerElements: number; } -export interface WorkerSetElement { - worker: Worker, - numberOfWorkerElements: number +export interface WorkerMessage { + id: WorkerMessageEvents; + data: any; } -export enum WorkerEvents { +export enum WorkerMessageEvents { START_WORKER_ELEMENT = 'startWorkerElement', + STOP_WORKER_ELEMENT = 'stopWorkerElement' }