@mdf.js/core
Version:
MMS - API Core - Common types, classes and functions
43 lines • 1.63 kB
TypeScript
/**
* Copyright 2024 Mytra Control S.L. All rights reserved.
*
* Use of this source code is governed by an MIT-style license that can be found in the LICENSE file
* or at https://opensource.org/licenses/MIT.
*/
import { Crash } from '@mdf.js/crash';
import { State } from '.';
import { Port } from '../Port';
import { ProviderState } from '../types';
/**
* Provider Stopped state
* @category State
* @public
*/
export declare class StoppedState implements State {
private readonly instance;
private readonly changeState;
private readonly manageError;
/** Actual provider state */
readonly state: ProviderState;
/** Handler for disconnected or unhealthy events */
private readonly errorEventHandler;
/**
* Create a instance of the stopped instance
* @param instance - Port instance
* @param changeState - Provider state change function
* @param manageError - Provider error management function function
*/
constructor(instance: Port<any, any>, changeState: (newState: State) => void, manageError: (error: unknown) => void);
/** Stop the process: internal jobs, external dependencies connections ... */
stop(): Promise<void>;
/** Initialize the process: internal jobs, external dependencies connections ... */
start(): Promise<void>;
/**
* Go to error state: waiting for new state o auto-fix de the problems
* @param error - incoming error from provider
*/
fail(error: Crash | Error): Promise<void>;
/** Clean event handlers for error state */
private cleanEventHandlers;
}
//# sourceMappingURL=Stopped.d.ts.map