Skip to main content

Class: VersionManager

Defined in: electron/services/monitoring/MigrationSystem.ts:645

Manages version state for monitor types.

Remarks

Tracks applied versions and timestamps for each monitor type. Used by orchestrators and migration utilities to record and query migration state.

Constructors

Constructor

new VersionManager(): VersionManager

Returns

VersionManager

Properties

versions

private readonly versions: Map<string, VersionInfo>

Defined in: electron/services/monitoring/MigrationSystem.ts:656

Internal

Internal storage for version information organized by monitor type.

Remarks

Maps monitor type strings to VersionInfo objects containing version state, application status, and timestamps. Used to track which migrations have been successfully applied.

Methods

getAllVersions()

getAllVersions(): Map<string, VersionInfo>

Defined in: electron/services/monitoring/MigrationSystem.ts:670

Retrieves all version information for all monitor types.

Returns

Map<string, VersionInfo>

A new Map with monitor type strings as keys and VersionInfo objects as values

Remarks

Returns a defensive copy of the internal version storage to prevent external modification of the version state. The returned Map contains the same VersionInfo object references but modifications to the Map structure will not affect the internal state.


getVersion()

getVersion(monitorType: string): string | undefined

Defined in: electron/services/monitoring/MigrationSystem.ts:688

Gets the current version for a specific monitor type.

Parameters

monitorType

string

The monitor type identifier (e.g., "http", "ping", "dns")

Returns

string | undefined

The semantic version string (e.g., "1.1.0") if set, or undefined if no version information exists for the monitor type

Remarks

Retrieves the version string from the stored VersionInfo for the specified monitor type. Returns undefined if no version has been set for the monitor type.


isVersionApplied()

isVersionApplied(monitorType: string, version: string): boolean

Defined in: electron/services/monitoring/MigrationSystem.ts:707

Checks if a specific version is applied for a monitor type.

Parameters

monitorType

string

The monitor type identifier (e.g., "http", "ping", "dns")

version

string

The semantic version string to check (e.g., "1.1.0")

Returns

boolean

True if the specified version is applied for the monitor type, false if not found, version mismatch, or not applied

Remarks

Verifies both that the version matches the stored version string and that the VersionInfo.applied flag is true. Returns false if the monitor type is not found, version doesn't match, or the applied flag is false.


setVersion()

setVersion(monitorType: string, version: string): void

Defined in: electron/services/monitoring/MigrationSystem.ts:725

Sets the version for a monitor type and marks it as applied.

Parameters

monitorType

string

The monitor type identifier (e.g., "http", "ping", "dns")

version

string

The semantic version string to set (e.g., "1.1.0")

Returns

void

Remarks

Creates or updates the VersionInfo entry for the specified monitor type, setting the version string, marking it as applied, and recording the current timestamp. This indicates that migrations to this version have been successfully completed.