@sidequest/engine
Version:
@sidequest/engine is the core engine of SideQuest, a distributed background job processing system for Node.js and TypeScript.
49 lines (46 loc) • 1.51 kB
TypeScript
import { Backend } from '@sidequest/backend';
import { QueueConfig, JobData } from '@sidequest/core';
import { NonNullableEngineConfig } from '../engine.js';
/**
* Manages job execution and worker concurrency for Sidequest.
*/
declare class ExecutorManager {
private backend;
private nonNullConfig;
private activeByQueue;
private activeJobs;
private runnerPool;
/**
* Creates a new ExecutorManager.
* @param backend The backend instance.
* @param nonNullConfig The non-nullable engine configuration.
*/
constructor(backend: Backend, nonNullConfig: NonNullableEngineConfig);
/**
* Gets the number of available slots for a given queue.
* @param queueConfig The queue configuration.
* @returns The number of available slots.
*/
availableSlotsByQueue(queueConfig: QueueConfig): number;
/**
* Gets the number of available slots globally.
* @returns The number of available slots.
*/
availableSlotsGlobal(): number;
/**
* Gets the total number of active workers.
* @returns The number of active jobs.
*/
totalActiveWorkers(): number;
/**
* Executes a job in the given queue.
* @param queueConfig The queue configuration.
* @param job The job data to execute.
*/
execute(queueConfig: QueueConfig, job: JobData): Promise<void>;
/**
* Destroys the runner pool and releases resources.
*/
destroy(): Promise<void>;
}
export { ExecutorManager };