Class: LoadSitesCommand
Defined in: electron/services/commands/DatabaseCommands.ts:906
Command for loading sites from the database into the in-memory cache.
Remarks
Encapsulates the logic for loading all sites from the database and atomically replacing the cache. Rollback restores the previous cache state. Validation is a no-op.
Extends
Constructors
Constructor
new LoadSitesCommand(
serviceFactory:DatabaseServiceFactory,eventEmitter:TypedEventBus<UptimeEvents>,cache:StandardizedCache<Site>):LoadSitesCommand
Defined in: electron/services/commands/DatabaseCommands.ts:249
Parameters
serviceFactory
eventEmitter
cache
Returns
LoadSitesCommand
Inherited from
Constructor
new LoadSitesCommand(
context:DatabaseCommandContext):LoadSitesCommand
Defined in: electron/services/commands/DatabaseCommands.ts:255
Parameters
context
Returns
LoadSitesCommand
Inherited from
Properties
cache
protectedreadonlycache:StandardizedCache<Site>
Defined in: electron/services/commands/DatabaseCommands.ts:184
Site cache for data synchronization during operations
Inherited from
eventEmitter
protectedreadonlyeventEmitter:TypedEventBus<UptimeEvents>
Defined in: electron/services/commands/DatabaseCommands.ts:187
Event bus for emitting command execution events
Inherited from
serviceFactory
protectedreadonlyserviceFactory:DatabaseServiceFactory
Defined in: electron/services/commands/DatabaseCommands.ts:190
Factory for accessing database services and repositories
Inherited from
DatabaseCommand.serviceFactory
configurationManager
protectedreadonlyconfigurationManager:ConfigurationManager|undefined
Defined in: electron/services/commands/DatabaseCommands.ts:193
Optional configuration manager used for validation flows
Inherited from
DatabaseCommand.configurationManager
updateHistoryLimit
protectedreadonlyupdateHistoryLimit: (limit:number) =>Promise<void> |undefined
Defined in: electron/services/commands/DatabaseCommands.ts:196
Optional history limit updater for settings propagation
Inherited from
DatabaseCommand.updateHistoryLimit
originalCacheState
Defined in: electron/services/commands/DatabaseCommands.ts:908
Backup of original cache state for rollback functionality
Methods
emitFailureEvent()
protectedemitFailureEvent<K>(eventType:K,error:Error,data:Partial<UptimeEvents[K]>):Promise<void>
Defined in: electron/services/commands/DatabaseCommands.ts:213
Internal
Emits a failure event for the command operation.
Type Parameters
K
K extends string
Parameters
eventType
K
The event type to emit.
error
The ://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error that occurred.
data
Partial<UptimeEvents[K]> = {}
Additional event data to include in the event payload.
Returns
Promise<void>
Remarks
Used internally to emit a typed event indicating command failure, including error details and additional event data.
Inherited from
DatabaseCommand.emitFailureEvent
emitSuccessEvent()
protectedemitSuccessEvent<K>(eventType:K,data:Partial<UptimeEvents[K]>):Promise<void>
Defined in: electron/services/commands/DatabaseCommands.ts:238
Internal
Emits a success event for the command operation.
Type Parameters
K
K extends string
Parameters
eventType
K
The event type to emit.
data
Partial<UptimeEvents[K]>
Additional event data to include in the event payload.
Returns
Promise<void>
Remarks
Used internally to emit a typed event indicating command success, including additional event data.
Inherited from
DatabaseCommand.emitSuccessEvent
execute()
Defined in: electron/services/commands/DatabaseCommands.ts:910
Executes the command operation.
Returns
Promise resolving to the operation result.
Remarks
Performs the main database operation encapsulated by the command.
Throws
When command execution fails.
Overrides
rollback()
rollback():
Promise<void>
Defined in: electron/services/commands/DatabaseCommands.ts:940
Restores the cache to its previous state.
Returns
Promise<void>
Resolved promise after cache restoration is complete
Remarks
Performs a synchronous cache restoration operation by clearing the current cache and restoring the backup state. Returns a resolved promise to satisfy the IDatabaseCommand interface contract.
Overrides
validate()
validate():
Promise<{errors:string[];isValid:boolean; }>
Defined in: electron/services/commands/DatabaseCommands.ts:959
Validates site loading operation prerequisites.
Returns
Promise<{ errors: string[]; isValid: boolean; }>
Resolved promise with validation result indicating success
Remarks
Site loading operations have minimal prerequisites, so validation always succeeds. Returns a resolved promise to satisfy the IDatabaseCommand interface contract.
Overrides
getDescription()
getDescription():
string
Defined in: electron/services/commands/DatabaseCommands.ts:970
Gets a description of the command for logging and debugging.
Returns
string
Human-readable command description.