refactor: remove pool strategy from worker configuration section
[e-mobility-charging-stations-simulator.git] / src / types / ConfigurationData.ts
1 import type { ListenOptions } from 'node:net';
2
3 import type { WorkerChoiceStrategy } from 'poolifier';
4
5 import type { StorageType } from './Storage';
6 import type { ApplicationProtocol, AuthenticationType } from './UIProtocol';
7 import type { WorkerProcessType } from '../worker';
8
9 type ServerOptions = ListenOptions;
10
11 export enum SupervisionUrlDistribution {
12 ROUND_ROBIN = 'round-robin',
13 RANDOM = 'random',
14 CHARGING_STATION_AFFINITY = 'charging-station-affinity',
15 }
16
17 export type StationTemplateUrl = {
18 file: string;
19 numberOfStations: number;
20 };
21
22 export 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
35 export type UIServerConfiguration = {
36 enabled?: boolean;
37 type?: ApplicationProtocol;
38 options?: ServerOptions;
39 authentication?: {
40 enabled: boolean;
41 type: AuthenticationType;
42 username?: string;
43 password?: string;
44 };
45 };
46
47 export type StorageConfiguration = {
48 enabled?: boolean;
49 type?: StorageType;
50 uri?: string;
51 };
52
53 export type WorkerConfiguration = {
54 processType?: WorkerProcessType;
55 startDelay?: number;
56 elementsPerWorker?: number | 'auto';
57 elementStartDelay?: number;
58 poolMinSize?: number;
59 poolMaxSize?: number;
60 /** @deprecated Not publicly exposed to end users. */
61 poolStrategy?: WorkerChoiceStrategy;
62 };
63
64 export type ConfigurationData = {
65 supervisionUrls?: string | string[];
66 supervisionUrlDistribution?: SupervisionUrlDistribution;
67 stationTemplateUrls: StationTemplateUrl[];
68 log?: LogConfiguration;
69 worker?: WorkerConfiguration;
70 uiServer?: UIServerConfiguration;
71 performanceStorage?: StorageConfiguration;
72 autoReconnectMaxRetries?: number;
73 /** @deprecated Moved to worker configuration section. */
74 workerProcess?: WorkerProcessType;
75 /** @deprecated Moved to worker configuration section. */
76 workerStartDelay?: number;
77 /** @deprecated Moved to worker configuration section. */
78 elementStartDelay?: number;
79 /** @deprecated Moved to worker configuration section. */
80 workerPoolMinSize?: number;
81 /** @deprecated Moved to worker configuration section. */
82 workerPoolMaxSize?: number;
83 /** @deprecated Moved to worker configuration section. */
84 workerPoolStrategy?: WorkerChoiceStrategy;
85 /** @deprecated Moved to worker configuration section. */
86 chargingStationsPerWorker?: number;
87 /** @deprecated Moved to log configuration section. */
88 logStatisticsInterval?: number;
89 /** @deprecated Moved to log configuration section. */
90 logEnabled?: boolean;
91 /** @deprecated Moved to log configuration section. */
92 logConsole?: boolean;
93 /** @deprecated Moved to log configuration section. */
94 logFormat?: string;
95 /** @deprecated Moved to log configuration section. */
96 logLevel?: string;
97 /** @deprecated Moved to log configuration section. */
98 logRotate?: boolean;
99 /** @deprecated Moved to log configuration section. */
100 logMaxFiles?: number | string;
101 /** @deprecated Moved to log configuration section. */
102 logMaxSize?: number | string;
103 /** @deprecated Moved to log configuration section. */
104 logFile?: string;
105 /** @deprecated Moved to log configuration section. */
106 logErrorFile?: string;
107 };