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 is used to removed data from the batch of data
|
7 | */
|
8 | export default abstract class FilterProcessor<T = OpConfig> extends ProcessorCore<T> {
|
9 | /**
|
10 | * Called by {@link Processor#handle} and will handle single {@link DataEntity}
|
11 | * @returns a thruthy value to indicate whether the data should be passed on.
|
12 | */
|
13 | abstract filter(data: DataEntity): boolean;
|
14 | /**
|
15 | * A generic method called by the Teraslice framework, calls {@link #filter}
|
16 | * @param input an array of DataEntities
|
17 | * @returns an array of DataEntities
|
18 | */
|
19 | handle(input: DataEntity[]): Promise<DataEntity[]>;
|
20 | }
|