UNPKG

@tableau/taco-toolkit

Version:
28 lines (27 loc) 1.43 kB
/// <reference types="node" /> import EventEmitter from 'events'; import { ExtractHandlerRequest, ExtractResponse } from './extract'; import { TerminateExractorHandlerRequest, TerminateExractorHandlerResponse } from './terminate-extractor'; /** * A class to handle extractors creation and deletion requests on the EPS API layer. * It dedups the extractor creation and deletion requests for the same connection-id. * * It is based on the fact that extactor creation and deletion are always paired in a * extractor lifecycle. On the monolith side, a protocol sends a creation request * during the init, while it sends a delete request when the protocol is destroyed. * * Currently, 1 connection-id can have only 1 paired extractor, so when a connection-id * is trying to send extractor creation request multi times (triggered by multiple protocol), * we want them to share the single extractor instance. */ export declare class ExtractHandler { private connectionStates; private requestCounts; handleExtractRequest(extractorLaunchedEvent: EventEmitter, extractHandlerRequest: ExtractHandlerRequest): Promise<ExtractResponse>; handleTerminationRequest(terminationRequest: TerminateExractorHandlerRequest): TerminateExractorHandlerResponse; getConnectionCount(): number; private removeConnection; private addRequestCount; private reduceRequestCount; private isDeletableConnection; }