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 process a single DataEntity at a time.
|
6 | * This processor should have zero side-effects on the data.
|
7 | */
|
8 | export default abstract class EachProcessor<T = OpConfig> extends ProcessorCore<T> {
|
9 | /**
|
10 | * Called by {@link Processor#handle} and will handle single {@link DataEntity}
|
11 | * @returns void in order to avoid side-effects
|
12 | */
|
13 | abstract forEach(data: DataEntity): void;
|
14 | /**
|
15 | * A generic method called by the Teraslice framework, calls {@link #forEach}
|
16 | * @param input an array of DataEntities
|
17 | * @returns an array of DataEntities
|
18 | */
|
19 | handle(input: DataEntity[]): Promise<DataEntity[]>;
|
20 | }
|