UNPKG

pandora

Version:

A powerful and lightweight application manager for Node.js applications powered by TypeScript.

37 lines (36 loc) 1.22 kB
import { ProcessRepresentation, ServiceRepresentation } from '../domain'; import { ServiceReconciler } from '../service/ServiceReconciler'; import { Environment } from 'pandora-env'; import { WorkerContextAccessor } from './WorkerContextAccessor'; /** * Class WorkerContext * 1. Inject the service * 2. manage the process's lifecycle, provide start() and stop() * 3. drive the lifecycle of the service */ export declare class WorkerContext { processRepresentation: ProcessRepresentation; serviceReconciler: ServiceReconciler; workerContextAccessor: WorkerContextAccessor; constructor(processRepresentation: ProcessRepresentation); /** * Get environment object * @returns {Environment} */ getEnvironment(): Environment; /** * Bind services * @param {ServiceRepresentation | ServiceRepresentation[]} services */ bindService(services: ServiceRepresentation | ServiceRepresentation[]): void; /** * Start worker, drive the lifecycle of the service * @returns {Promise<void>} */ start(): Promise<void>; /** * Stop worker, drive the lifecycle of the service * @returns {Promise<void>} */ stop(): Promise<void>; }