UNPKG

543 BTypeScriptView Raw
1import { DataEntity } from '@terascope/utils';
2import { OpConfig } from '../interfaces';
3import ProcessorCore from './core/processor-core';
4/**
5 * A variation of "Processor" that can handle a batch of data at a time.
6 */
7export default abstract class BatchProcessor<T = OpConfig> extends ProcessorCore<T> {
8 /**
9 * A method called by {@link BatchProcessor#handle}
10 * @returns an array of DataEntities
11 */
12 abstract onBatch(batch: DataEntity[]): Promise<DataEntity[]>;
13 handle(input: DataEntity[]): Promise<DataEntity[]>;
14}