import { OpConfig, ExecutionConfig, Slice, SliceRequest, SlicerOperationLifeCycle, ExecutionStats, Context, SlicerRecoveryData, OpAPI } from '../../interfaces/index.js'; import Core from './core.js'; /** * A base class for supporting "Slicers" that run on a "Execution Controller", * that supports the execution lifecycle events. * This class will likely not be used externally * since Teraslice only supports a few type varients. * * See [[Core]] for more information */ export default abstract class SlicerCore extends Core implements SlicerOperationLifeCycle { protected stats: ExecutionStats; protected recoveryData: SlicerRecoveryData[]; protected readonly opConfig: Readonly; private readonly queue; constructor(context: Context, opConfig: OpConfig & T, executionConfig: ExecutionConfig); /** * Called during execution initialization * @param recoveryData is the data to recover from */ initialize(recoveryData: SlicerRecoveryData[]): Promise; shutdown(): Promise; /** * Create an API and add it to the operation lifecycle */ createAPI(name: string, ...params: any[]): Promise; /** * Get a reference to an existing API */ getAPI(name: string): A; /** * A generic method called by the Teraslice framework to a give a "Slicer" * the ability to handle creating slices. * @returns a boolean depending on whether the slicer is done */ abstract handle(): Promise; /** * Return the number of registered slicers */ abstract slicers(): number; /** * Create a Slice object from a slice request. * In the case of recovery the "Slice" already has the required * This will be enqueued and dequeued by the "Execution Controller" */ createSlice(input: Slice | SliceRequest, order: number, id?: number): void; /** * A method called by the "Execution Controller" to dequeue a created "Slice" */ getSlice(): Slice | null; /** * A method called by the "Execution Controller" to dequeue many created slices */ getSlices(max: number): Slice[]; /** * The number of enqueued slices */ sliceCount(): number; /** * Used to indicate whether this slicer is recoverable. */ isRecoverable(): boolean; /** * Used to indicate whether this slicer is relocatable. Only relevant for * kubernetesV2 backend */ isRelocatable(): boolean; /** * Used to determine the maximum number of slices queued. * Defaults to 10000 * NOTE: if you want to base of the number of * workers use {@link #workersConnected} */ maxQueueLength(): number; onExecutionStats(stats: ExecutionStats): void; protected canComplete(): boolean; protected get workersConnected(): number; } //# sourceMappingURL=slicer-core.d.ts.map