import { IQueueWorkload } from './IQueueWorkload'; import { IQueue } from './IQueue'; import { IdObject } from './IdObject'; export declare class QueueJob implements IdObject { private static _INC; private _id; private _workload; private _start; private _stop; private _enqueued; private _duration; private _error; private _result; constructor(/* queue: IQueue, */ workload: T); prepare(queue: IQueue): void; get id(): string; workload(): T; enqueued(queue: IQueue): Promise>; getResult(): any; setResult(v: any): void; getError(): Error; setError(v: any): void; /** * Wait till the job is begins */ starting(queue: IQueue): Promise>; /** * Wait till the job is finished */ done(queue: IQueue): Promise>; /** * Fire event that the job was enqueued */ doEnqueue(queue: IQueue): Promise; /** * Fire event that the job was started */ doStart(queue: IQueue): Promise; /** * Fire event that the job was stopped */ doStop(queue: IQueue, err?: Error): Promise; /** * Check if the job is enqueued */ isEnqueued(): boolean; /** * Check if the job is started */ isStarted(): boolean; /** * Check if the job is finished */ isFinished(): boolean; /** * Fired when the job is finished */ private onDone; /** * Clear references to the _queue object */ finalize(queue: IQueue): void; /** * Helper generating the event names for different jobs id and states * * @param type */ private jobEventName; }