UNPKG

pandora

Version:
62 lines (61 loc) 2.04 kB
import { ProcessRepresentation, AppletRepresentation, ServiceRepresentation, Configurator } from '../domain'; import { AppletReconciler } from './AppletReconciler'; import { ServiceReconciler } from '../service/ServiceReconciler'; import { Environment } from 'pandora-env'; import { WorkerContextAccessor } from './WorkerContextAccessor'; /** * Class WorkerContext * 1. Inject the service and the applet * 2. manage the process's lifecycle, provide start() and stop() * 3. drive the lifecycle of the service and the applet */ export declare class WorkerContext { private configurator; processRepresentation: ProcessRepresentation; serviceReconciler: ServiceReconciler; appletReconciler: AppletReconciler; workerContextAccessor: WorkerContextAccessor; private configProperties; constructor(processRepresentation: ProcessRepresentation); /** * Get environment object * @returns {Environment} */ getEnvironment(): Environment; /** * Set configurator object * @param configurator * @returns {Promise<void>} */ setConfigurator(configurator: any): Promise<void>; /** * Get properties from configurator object * @returns {any} */ getProperties(): any; /** * Get configurator object * @returns {Configurator} */ getConfigurator(): Configurator; /** * Bind services * @param {ServiceRepresentation | ServiceRepresentation[]} services */ bindService(services: ServiceRepresentation | ServiceRepresentation[]): void; /** * Bind applets * @param {AppletRepresentation | AppletRepresentation[]} applets */ bindApplet(applets: AppletRepresentation | AppletRepresentation[]): void; /** * Start worker, drive the lifecycle of the service and the applet * @returns {Promise<void>} */ start(): Promise<void>; /** * Stop worker, drive the lifecycle of the service and the applet * @returns {Promise<void>} */ stop(): Promise<void>; }