import Configuration from '../utils/Configuration';
import { StationWorkerData } from '../types/Worker';
import Utils from '../utils/Utils';
+import WorkerAbstract from '../worker/WorkerAbstract';
import WorkerFactory from '../worker/WorkerFactory';
-import Wrk from '../worker/Wrk';
import { isMainThread } from 'worker_threads';
import path from 'path';
private static instance: Bootstrap;
private started: boolean;
private workerScript: string;
- private workerImplementationInstance: Wrk;
+ private workerImplementationInstance: WorkerAbstract;
private constructor() {
this.started = false;
await this.start();
}
- private getWorkerImplementationInstance(): Wrk {
+ private getWorkerImplementationInstance(): WorkerAbstract {
if (!this.workerImplementationInstance) {
this.workerImplementationInstance = WorkerFactory.getWorkerImplementation<StationWorkerData>(this.workerScript, Configuration.getWorkerProcess(), {
poolMaxSize: Configuration.getWorkerPoolMaxSize(),
import { WorkerData } from '../types/Worker';
-export default abstract class Wrk {
+export default abstract class WorkerAbstract {
protected workerScript: string;
public abstract size: number;
public abstract maxElementsPerWorker: number;
/**
- * Create a new `Wrk`.
+ * Create a new `Worker` implementation.
*
* @param {string} workerScript
*/
import Constants from '../utils/Constants';
import Utils from '../utils/Utils';
import { Worker } from 'worker_threads';
+import WorkerAbstract from './WorkerAbstract';
import { WorkerData } from '../types/Worker';
-import Wrk from './Wrk';
-export default class WorkerDynamicPool<T> extends Wrk {
+export default class WorkerDynamicPool<T> extends WorkerAbstract {
private pool: DynamicPool;
/**
* @return {Promise<void>}
* @public
*/
+ // eslint-disable-next-line @typescript-eslint/require-await
public async stop(): Promise<void> {
return this.pool.destroy();
}
import { WorkerOptions, WorkerProcessType } from '../types/Worker';
import Utils from '../utils/Utils';
+import WorkerAbstract from './WorkerAbstract';
import WorkerDynamicPool from './WorkerDynamicPool';
import WorkerSet from './WorkerSet';
import WorkerStaticPool from './WorkerStaticPool';
-import Wrk from './Wrk';
import { isMainThread } from 'worker_threads';
export default class WorkerFactory {
- public static getWorkerImplementation<T>(workerScript: string, workerProcessType: WorkerProcessType, options?: WorkerOptions): Wrk {
+ public static getWorkerImplementation<T>(workerScript: string, workerProcessType: WorkerProcessType, options?: WorkerOptions): WorkerAbstract {
if (!isMainThread) {
throw new Error('Trying to get a worker implementation outside the main thread');
}
import Constants from '../utils/Constants';
import Utils from '../utils/Utils';
import { Worker } from 'worker_threads';
-import Wrk from './Wrk';
+import WorkerAbstract from './WorkerAbstract';
-export default class WorkerSet<T> extends Wrk {
+export default class WorkerSet<T> extends WorkerAbstract {
public maxElementsPerWorker: number;
private workerSet: Set<WorkerSetElement>;
import Constants from '../utils/Constants';
import Utils from '../utils/Utils';
import { Worker } from 'worker_threads';
+import WorkerAbstract from './WorkerAbstract';
import { WorkerData } from '../types/Worker';
-import Wrk from './Wrk';
-export default class WorkerStaticPool<T> extends Wrk {
+export default class WorkerStaticPool<T> extends WorkerAbstract {
private pool: StaticPool;
/**