47 lines
1.7 KiB
TypeScript
47 lines
1.7 KiB
TypeScript
import { HealthCheckResult } from '../health/checkFns';
|
|
import { Ready } from './Daemons';
|
|
import { Daemon } from './Daemon';
|
|
import { Effects, SDKManifest } from '../../../base/lib/types';
|
|
export declare const EXIT_SUCCESS: "EXIT_SUCCESS";
|
|
/**
|
|
* Wanted a structure that deals with controlling daemons by their health status
|
|
* States:
|
|
* -- Waiting for dependencies to be success
|
|
* -- Running: Daemon is running and the status is in the health
|
|
*
|
|
*/
|
|
export declare class HealthDaemon<Manifest extends SDKManifest> {
|
|
readonly daemon: Daemon<Manifest> | null;
|
|
readonly dependencies: HealthDaemon<Manifest>[];
|
|
readonly id: string;
|
|
readonly ready: Ready | typeof EXIT_SUCCESS;
|
|
readonly effects: Effects;
|
|
private _health;
|
|
private healthWatchers;
|
|
private running;
|
|
private started?;
|
|
private resolveReady;
|
|
private resolvedReady;
|
|
private readyPromise;
|
|
private session;
|
|
constructor(daemon: Daemon<Manifest> | null, dependencies: HealthDaemon<Manifest>[], id: string, ready: Ready | typeof EXIT_SUCCESS, effects: Effects);
|
|
/** Run after we want to do cleanup */
|
|
term(termOptions?: {
|
|
signal?: NodeJS.Signals | undefined;
|
|
timeout?: number | undefined;
|
|
destroySubcontainer?: boolean;
|
|
}): Promise<void>;
|
|
/** Want to add another notifier that the health might have changed */
|
|
addWatcher(watcher: () => unknown): void;
|
|
get health(): Readonly<HealthCheckResult>;
|
|
private changeRunning;
|
|
private stopSession;
|
|
private resetReady;
|
|
private startSession;
|
|
private runHealthCheckLoop;
|
|
onReady(): Promise<void>;
|
|
get isReady(): boolean;
|
|
private setHealth;
|
|
updateStatus(): Promise<void>;
|
|
}
|