feat: add elementsPerWorker automatic calculation
[e-mobility-charging-stations-simulator.git] / src / types / ConfigurationData.ts
CommitLineData
3f85aa2b 1import type { ListenOptions } from 'node:net';
8114d10e 2
9efbac5b 3import type { WorkerChoiceStrategy } from 'poolifier';
8114d10e 4
69074173
JB
5import type { StorageType } from './Storage';
6import type { ApplicationProtocol, AuthenticationType } from './UIProtocol';
268a74bb 7import type { WorkerProcessType } from '../worker';
a4624c96 8
0ac97927 9type ServerOptions = ListenOptions;
66271092 10
2dcfe98e
JB
11export enum SupervisionUrlDistribution {
12 ROUND_ROBIN = 'round-robin',
13 RANDOM = 'random',
c72f6634 14 CHARGING_STATION_AFFINITY = 'charging-station-affinity',
2dcfe98e
JB
15}
16
83e00df1 17export type StationTemplateUrl = {
e118beaa
JB
18 file: string;
19 numberOfStations: number;
83e00df1 20};
e118beaa 21
3d48c1c1
JB
22export type LogConfiguration = {
23 enabled?: boolean;
24 file?: string;
25 errorFile?: string;
26 statisticsInterval?: number;
27 level?: string;
28 console?: boolean;
29 format?: string;
30 rotate?: boolean;
31 maxFiles?: string | number;
32 maxSize?: string | number;
33};
34
83e00df1 35export type UIServerConfiguration = {
6a49ad23 36 enabled?: boolean;
1f7fa4de 37 type?: ApplicationProtocol;
66271092 38 options?: ServerOptions;
eb3abc4f
JB
39 authentication?: {
40 enabled: boolean;
41 type: AuthenticationType;
42 username?: string;
43 password?: string;
44 };
83e00df1 45};
6a49ad23 46
83e00df1 47export type StorageConfiguration = {
72f041bd
JB
48 enabled?: boolean;
49 type?: StorageType;
1f5df42a 50 uri?: string;
83e00df1 51};
72f041bd 52
83e00df1 53export type WorkerConfiguration = {
cf2a5d9b
JB
54 processType?: WorkerProcessType;
55 startDelay?: number;
8603c1ca 56 elementsPerWorker?: number | 'auto';
cf2a5d9b
JB
57 elementStartDelay?: number;
58 poolMinSize?: number;
59 poolMaxSize?: number;
60 poolStrategy?: WorkerChoiceStrategy;
83e00df1 61};
cf2a5d9b 62
83e00df1 63export type ConfigurationData = {
2dcfe98e
JB
64 supervisionUrls?: string | string[];
65 supervisionUrlDistribution?: SupervisionUrlDistribution;
1f5df42a 66 stationTemplateUrls: StationTemplateUrl[];
3d48c1c1
JB
67 log?: LogConfiguration;
68 worker?: WorkerConfiguration;
675fa8e3 69 uiServer?: UIServerConfiguration;
72f041bd 70 performanceStorage?: StorageConfiguration;
e118beaa 71 autoReconnectMaxRetries?: number;
edd13439 72 /** @deprecated Moved to worker configuration section. */
a4624c96 73 workerProcess?: WorkerProcessType;
edd13439 74 /** @deprecated Moved to worker configuration section. */
322c9192 75 workerStartDelay?: number;
edd13439 76 /** @deprecated Moved to worker configuration section. */
4bfd80fa 77 elementStartDelay?: number;
edd13439 78 /** @deprecated Moved to worker configuration section. */
a4624c96 79 workerPoolMinSize?: number;
edd13439 80 /** @deprecated Moved to worker configuration section. */
4fa59b8a 81 workerPoolMaxSize?: number;
edd13439 82 /** @deprecated Moved to worker configuration section. */
9efbac5b 83 workerPoolStrategy?: WorkerChoiceStrategy;
edd13439 84 /** @deprecated Moved to worker configuration section. */
5fdab605 85 chargingStationsPerWorker?: number;
3d48c1c1 86 /** @deprecated Moved to log configuration section. */
72f041bd 87 logStatisticsInterval?: number;
3d48c1c1 88 /** @deprecated Moved to log configuration section. */
ae389044 89 logEnabled?: boolean;
3d48c1c1 90 /** @deprecated Moved to log configuration section. */
ae389044 91 logConsole?: boolean;
3d48c1c1 92 /** @deprecated Moved to log configuration section. */
e118beaa 93 logFormat?: string;
3d48c1c1 94 /** @deprecated Moved to log configuration section. */
324fd4ee 95 logLevel?: string;
3d48c1c1 96 /** @deprecated Moved to log configuration section. */
6bf6769e 97 logRotate?: boolean;
3d48c1c1 98 /** @deprecated Moved to log configuration section. */
9988696d 99 logMaxFiles?: number | string;
3d48c1c1 100 /** @deprecated Moved to log configuration section. */
9988696d 101 logMaxSize?: number | string;
3d48c1c1 102 /** @deprecated Moved to log configuration section. */
e118beaa 103 logFile?: string;
3d48c1c1 104 /** @deprecated Moved to log configuration section. */
7ec46a9a 105 logErrorFile?: string;
83e00df1 106};