import { Config } from '../config'; import { Executor, Method, Params, Manifest } from './Executor'; interface Job { id: string; method: Method; params: Params; delegator?: Executor; date: Date; resolve: (result: Type) => void; reject: (error: Error) => void; } /** * A base `Executor` class that queues all requests. */ export declare class Queuer extends Executor { /** * A job queue */ readonly queue: Job[]; /** * Configuration options. * * Currently, using application configuration, but * this may be split up later. */ readonly config: Config; /** * Timer used to call `check` */ private checkInterval?; /** * Timer used to call `clean` */ private cleanInterval?; constructor(config?: Config); /** * @override Override of {@link Executor.manifest} to * provide additional properties for inspection. */ manifest(): Promise; /** * @override Overrides {@link Executor.call} by placing * all requests on the queue. * * @param client The executor, if any that delegated this call. * Used to notify that client on the status of the job. */ call(method: Method, params?: Params, client?: Executor): Promise; /** * @override Overrides {@link Executor.cancel} by removing * a job from the queue. */ cancel(job: string): Promise; notifyDelegator(job: Job, subject: string, message: string): void; /** * Check the queue on an ongoing basis and attempt to * reduce its size by completing jobs. * * @see {@link Queuer.reduce} * * @param executor An executor that will attempt * to complete jobs. * @returns A timeout that can be used to cancel the checks */ check(executor: Executor): Promise; /** * Attempt to reduce the size of the queue by completing * any jobs that are on it. * * @param executor An executor that will attempt * to complete jobs. * @returns The amount by which the queue was reduced */ reduce(executor: Executor): Promise; /** * Clean the queue by removing stale jobs. */ clean(): void; /** * @override Override of {@link Executor.start} to begin * an interval for checking queue. */ start(): Promise; /** * @override Override of {@link Executor.stop} to reject * all outstanding jobs in the queue. */ stop(): Promise; } export {};