import type AsyncProcess from './asyncProcess'; import { Scheduler } from '../../types/lrap'; import AsyncProcessPool from './asyncProcessPool'; /** * Process context */ declare class ProcessContext { private _context; private _scheduler; private _runChildren?; private _process; /** * Constructs instance * @param poolContext context from pool * @param scheduler process scheduler * @param childPoolConstructor child pool constructor */ constructor(poolContext: AsyncProcessPool.Context, scheduler: Scheduler); /** * Returns process ID * @returns process ID */ get processId(): string; /** * Returns current process stage * @returns process stage */ get stage(): ProcessContext.ProcessStage; /** * Whether the process was scheduled to cancel by external command (cancel or restart) * @returns whether canceled */ get canceled(): boolean; /** * Returns process IDs chain from root process * @returns process IDs chain */ getProcessIdChain(): string[]; /** * Process this context relates to. Called automatically by async pool * @param process current process */ initialize(process: AsyncProcess): void; /** * Releases internal resources. Called automatically by async pool */ release(): void; } declare namespace ProcessContext { /** Process stage */ enum ProcessStage { STARTING = 0, RUNNING = 1, STOPPING = 2, STOPPED = 3 } } export default ProcessContext;