UNPKG

1.06 kBTypeScriptView Raw
1import { SlicerFn, OpConfig } from '../interfaces';
2import SlicerCore from './core/slicer-core';
3/**
4 * A varient of a "Slicer" for running a parallel stream of slicers.
5 * @see SlicerCore
6 */
7export default abstract class ParallelSlicer<T = OpConfig> extends SlicerCore<T> {
8 protected _slicers: SlicerObj[];
9 /**
10 * Register the different Slicer instances
11 * @see SlicerCore#initialize
12 */
13 initialize(recoveryData: object[]): Promise<void>;
14 /**
15 * Cleanup the slicers functions
16 * @see SlicerCore#shutdown
17 */
18 shutdown(): Promise<void>;
19 /**
20 * Called by {@link ParallelSlicer#handle} for every count of `slicers` in the ExecutionConfig
21 * @returns a function which will be called in parallel
22 */
23 abstract newSlicer(): Promise<SlicerFn | undefined>;
24 slicers(): number;
25 handle(): Promise<boolean>;
26 readonly isFinished: boolean;
27 private processSlicer;
28}
29interface SlicerObj {
30 done: boolean;
31 fn: SlicerFn;
32 id: number;
33 processing: boolean;
34 order: number;
35}
36export {};