X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Ftypes%2FConfigurationData.ts;h=d1948921660b0da42774c813686405c2baf4d74c;hb=6a4032b5d8f3cbaa18d3beddcdfe9d335c1cba90;hp=accdcc2198b05d79c0c9416bc46d28b40a784eee;hpb=eda9c4514246fca7fb42572936dfe2b018abb8e5;p=e-mobility-charging-stations-simulator.git diff --git a/src/types/ConfigurationData.ts b/src/types/ConfigurationData.ts index accdcc21..d1948921 100644 --- a/src/types/ConfigurationData.ts +++ b/src/types/ConfigurationData.ts @@ -1,4 +1,5 @@ import type { ListenOptions } from 'node:net'; +import type { ResourceLimits } from 'node:worker_threads'; import type { WorkerChoiceStrategy } from 'poolifier'; @@ -8,18 +9,25 @@ import type { WorkerProcessType } from '../worker'; type ServerOptions = ListenOptions; +export enum ConfigurationSection { + log = 'log', + performanceStorage = 'performanceStorage', + worker = 'worker', + uiServer = 'uiServer', +} + export enum SupervisionUrlDistribution { ROUND_ROBIN = 'round-robin', RANDOM = 'random', CHARGING_STATION_AFFINITY = 'charging-station-affinity', } -export type StationTemplateUrl = { +export interface StationTemplateUrl { file: string; numberOfStations: number; -}; +} -export type LogConfiguration = { +export interface LogConfiguration { enabled?: boolean; file?: string; errorFile?: string; @@ -30,11 +38,17 @@ export type LogConfiguration = { rotate?: boolean; maxFiles?: string | number; maxSize?: string | number; -}; +} + +export enum ApplicationProtocolVersion { + VERSION_11 = 1.1, + VERSION_20 = 2.0, +} -export type UIServerConfiguration = { +export interface UIServerConfiguration { enabled?: boolean; type?: ApplicationProtocol; + version?: ApplicationProtocolVersion; options?: ServerOptions; authentication?: { enabled: boolean; @@ -42,26 +56,27 @@ export type UIServerConfiguration = { username?: string; password?: string; }; -}; +} -export type StorageConfiguration = { +export interface StorageConfiguration { enabled?: boolean; type?: StorageType; uri?: string; -}; +} + +export type ElementsPerWorkerType = number | 'auto' | 'all'; -export type WorkerConfiguration = { +export interface WorkerConfiguration { processType?: WorkerProcessType; startDelay?: number; - elementsPerWorker?: number | 'auto'; + elementsPerWorker?: ElementsPerWorkerType; elementStartDelay?: number; poolMinSize?: number; poolMaxSize?: number; - /** @deprecated Not publicly exposed to end users. */ - poolStrategy?: WorkerChoiceStrategy; -}; + resourceLimits?: ResourceLimits; +} -export type ConfigurationData = { +export interface ConfigurationData { supervisionUrls?: string | string[]; supervisionUrlDistribution?: SupervisionUrlDistribution; stationTemplateUrls: StationTemplateUrl[]; @@ -69,6 +84,7 @@ export type ConfigurationData = { worker?: WorkerConfiguration; uiServer?: UIServerConfiguration; performanceStorage?: StorageConfiguration; + /** @deprecated Moved to charging station template */ autoReconnectMaxRetries?: number; /** @deprecated Moved to worker configuration section. */ workerProcess?: WorkerProcessType; @@ -104,4 +120,4 @@ export type ConfigurationData = { logFile?: string; /** @deprecated Moved to log configuration section. */ logErrorFile?: string; -}; +}