-
Notifications
You must be signed in to change notification settings - Fork 13
/
core.ts
25 lines (20 loc) · 865 Bytes
/
core.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { EventEmitter } from 'events';
import { Logger } from '@terascope/utils';
import { Context, ExecutionConfig, OperationLifeCycle } from '../../interfaces';
/**
* The core class for creating for all varients or base classes for an operation.
*/
export default abstract class Core<T extends Context> implements OperationLifeCycle {
readonly context: Readonly<T>;
readonly executionConfig: Readonly<ExecutionConfig>;
readonly logger: Logger;
readonly events: EventEmitter;
constructor(context: T, executionConfig: ExecutionConfig, logger: Logger) {
this.context = context;
this.executionConfig = executionConfig;
this.logger = logger;
this.events = context.apis.foundation.getSystemEvents();
}
abstract initialize(initConfig?: unknown): Promise<void>;
abstract shutdown(): Promise<void>;
}