UNPKG

@tableau/taco-toolkit

Version:
31 lines (30 loc) 1.12 kB
export declare class PortManager { private readonly start; private readonly end; private readonly reservedPorts; private static readonly MAX_RETRIES; constructor(start: number, end: number, reservedPorts?: number[]); /** * Returns an unused port within the given range and reserve it on the PortManager instance. */ reserveUnusedPort(): Promise<number>; /** * Returns an unused port within the given range. */ getUnusedPort(): Promise<number>; /** * This function is designated to get reserved ports for EPS main services, so that * extractors may skip these ports during start. * * It must be called after all EPS main services have started, e.g. static server, * eps api, grpc server, etc. Otherwise, it could potentially cause race condition, * since the port detection is async. */ getReservedPorts(): number[]; getPortRange(): [number, number]; /** * Get a random port number within [min, max] (both inclusively) without checking * port availability. */ private getRandomPortNumber; }