/** * Copyright 2023 Kapeta Inc. * SPDX-License-Identifier: BUSL-1.1 */ import { EnvironmentType, InstanceInfo, LogEntry } from './types'; import { Task } from './taskManager'; import { InstanceOperator } from '@kapeta/sdk-config'; export declare class InstanceManager { private _interval; private readonly _instances; private readonly instanceLocks; constructor(); startMonitoring(): void; stopMonitoring(): void; private checkInstancesLater; getInstances(): InstanceInfo[]; getInstancesForPlan(systemId: string): Promise; getInstance(systemId: string, instanceId: string): InstanceInfo | undefined; private exclusive; private isLocked; getLogs(systemId: string, instanceId: string): Promise; saveInternalInstance(instance: InstanceInfo): Promise; /** * Method is called when instance is started from the Kapeta SDKs (e.g. NodeJS SDK) * which self-registers with the cluster service locally on startup. */ registerInstanceFromSDK(systemId: string, instanceId: string, info: Omit): Promise; private getHealthUrl; markAsStopped(systemId: string, instanceId: string): Promise; startAllForPlan(systemId: string): Promise>; stopAllForPlan(systemId: string): Task; getInstanceOperator(systemId: string, instanceId: string, environment?: EnvironmentType, ensureContainer?: boolean): Promise>; stop(systemId: string, instanceId: string): Promise; private stopInner; start(systemId: string, instanceId: string, checkForSingleton?: boolean): Promise>; /** * Stops an instance but does not remove it from the list of active instances * * It will be started again next time the system checks the status of the instance * * We do it this way to not cause the user to wait for the instance to start again */ prepareForRestart(systemId: string, instanceId: string): Promise; stopAll(): Promise; private stopInstances; private save; private checkInstances; private getExternalStatus; private requestInstanceStatus; private isSingletonOperator; private getKindForAssetRef; /** * Get the kind of an asset. Use the maxDepth parameter to specify how deep to look for the * kind. For example, if maxDepth is 2, the method will look for the kind of the asset and then * the kind of the kind. * @param assetRef The asset reference * @param maxDepth The maximum depth to look for the kind * @returns The kind of the asset or null if not found */ private getDeepKindForAssetRef; private isUsingKind; private getAllInstancesForKind; /** * Get the ids for all block instances except the ones of the specified kind * @param systemId The plan reference id * @param kind The kind to exclude. Can be a string or an array of strings * @returns An array of block instance ids */ private getAllInstancesExceptKind; } export declare const instanceManager: InstanceManager;