1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | import { FarmOptions, PromiseWithCustomMessage, TaskQueue } from './types';
|
8 | export default class Farm {
|
9 | private _numOfWorkers;
|
10 | private _callback;
|
11 | private readonly _computeWorkerKey;
|
12 | private readonly _workerSchedulingPolicy;
|
13 | private readonly _cacheKeys;
|
14 | private readonly _locks;
|
15 | private _offset;
|
16 | private readonly _taskQueue;
|
17 | constructor(_numOfWorkers: number, _callback: Function, options?: {
|
18 | computeWorkerKey?: FarmOptions['computeWorkerKey'];
|
19 | workerSchedulingPolicy?: FarmOptions['workerSchedulingPolicy'];
|
20 | taskQueue?: TaskQueue;
|
21 | });
|
22 | doWork(method: string, ...args: Array<unknown>): PromiseWithCustomMessage<unknown>;
|
23 | private _process;
|
24 | private _push;
|
25 | private _getNextWorkerOffset;
|
26 | private _lock;
|
27 | private _unlock;
|
28 | private _isLocked;
|
29 | }
|