Add worker configuration section
[e-mobility-charging-stations-simulator.git] / src / types / ConfigurationData.ts
CommitLineData
b153c0fd 1import { ListenOptions } from 'net';
72f041bd 2import { StorageType } from './Storage';
18d3414a 3import { ServerOptions as WSServerOptions } from 'ws';
9efbac5b 4import type { WorkerChoiceStrategy } from 'poolifier';
a4624c96
JB
5import { WorkerProcessType } from './Worker';
6
b153c0fd 7export type ServerOptions = WSServerOptions & ListenOptions;
66271092 8
2dcfe98e
JB
9export enum SupervisionUrlDistribution {
10 ROUND_ROBIN = 'round-robin',
11 RANDOM = 'random',
12 SEQUENTIAL = 'sequential',
13}
14
1f5df42a 15export interface StationTemplateUrl {
e118beaa
JB
16 file: string;
17 numberOfStations: number;
18}
19
675fa8e3 20export interface UIServerConfiguration {
6a49ad23 21 enabled?: boolean;
66271092 22 options?: ServerOptions;
6a49ad23
JB
23}
24
72f041bd
JB
25export interface StorageConfiguration {
26 enabled?: boolean;
27 type?: StorageType;
1f5df42a 28 uri?: string;
72f041bd
JB
29}
30
cf2a5d9b
JB
31export interface WorkerConfiguration {
32 processType?: WorkerProcessType;
33 startDelay?: number;
34 elementsPerWorker?: number;
35 elementStartDelay?: number;
36 poolMinSize?: number;
37 poolMaxSize?: number;
38 poolStrategy?: WorkerChoiceStrategy;
39}
40
e118beaa 41export default interface ConfigurationData {
2dcfe98e
JB
42 supervisionUrls?: string | string[];
43 supervisionUrlDistribution?: SupervisionUrlDistribution;
1f5df42a 44 stationTemplateUrls: StationTemplateUrl[];
675fa8e3 45 uiServer?: UIServerConfiguration;
72f041bd 46 performanceStorage?: StorageConfiguration;
cf2a5d9b 47 worker?: WorkerConfiguration;
e118beaa 48 autoReconnectMaxRetries?: number;
cf2a5d9b 49 // deprecated
a4624c96 50 workerProcess?: WorkerProcessType;
cf2a5d9b 51 // deprecated
322c9192 52 workerStartDelay?: number;
cf2a5d9b 53 // deprecated
4bfd80fa 54 elementStartDelay?: number;
cf2a5d9b 55 // deprecated
a4624c96 56 workerPoolMinSize?: number;
cf2a5d9b 57 // deprecated
4fa59b8a 58 workerPoolMaxSize?: number;
cf2a5d9b 59 // deprecated
9efbac5b 60 workerPoolStrategy?: WorkerChoiceStrategy;
cf2a5d9b 61 // deprecated
5fdab605 62 chargingStationsPerWorker?: number;
72f041bd 63 logStatisticsInterval?: number;
e118beaa 64 logFormat?: string;
324fd4ee 65 logLevel?: string;
6bf6769e
JB
66 logRotate?: boolean;
67 logMaxFiles?: number;
e118beaa 68 logFile?: string;
7ec46a9a
JB
69 logErrorFile?: string;
70 logConsole?: boolean;
e118beaa 71}