1 | import { DataEntity } from '@terascope/utils';
|
2 | import { OpConfig } from '../interfaces';
|
3 | import ProcessorCore from './core/processor-core';
|
4 | /**
|
5 | * A variation of "Processor" that can handle a batch of data at a time.
|
6 | */
|
7 | export 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 | }
|