UNPKG

harperdb

Version:

HarperDB is a distributed database, caching service, streaming broker, and application development platform focused on performance and ease of use.

62 lines (61 loc) 1.61 kB
/** * ComponentStatus Class * * This module contains the ComponentStatus class which represents an individual * component's status with methods for status management. */ import { type ComponentStatusLevel } from './types.ts'; /** * Component status information class */ export declare class ComponentStatus { /** Last time this status was checked/updated */ lastChecked: Date; /** Current status level */ status: ComponentStatusLevel; /** Human-readable status message */ message?: string; /** Error information if status is 'error' */ error?: Error | string; constructor(status: ComponentStatusLevel, message?: string, error?: Error | string); /** * Update the status level and refresh the timestamp */ updateStatus(status: ComponentStatusLevel, message?: string): void; /** * Set status to healthy */ markHealthy(message?: string): void; /** * Set status to error */ markError(error: Error | string, message?: string): void; /** * Set status to warning */ markWarning(message: string): void; /** * Set status to loading */ markLoading(message?: string): void; /** * Check if component is healthy */ isHealthy(): boolean; /** * Check if component has an error */ hasError(): boolean; /** * Check if component is loading */ isLoading(): boolean; /** * Check if component has a warning */ hasWarning(): boolean; /** * Get a summary string of the component status */ getSummary(): string; }