Refactored connection pool (#913)

* Refactored ConnectionPool
- Created BaseConnectionPool class
- Created CloudConnectionPool
- connection pool updates are immutable
- resurrect now happens inside getConnection()

* Rewritten connection pool(s) type definitions

* Updated test

* Fixed test

* Fix if check

* Removed old files

* Improve code coverage

* Updated license header

* Fix if check

* Improve code coverage

* Updated coverage script
This commit is contained in:
Tomas Della Vedova
2019-07-26 11:43:48 +02:00
committed by delvedor
parent 90be646658
commit 8e86450aeb
19 changed files with 1305 additions and 620 deletions

6
lib/Transport.d.ts vendored
View File

@ -2,7 +2,7 @@
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
import ConnectionPool from './ConnectionPool';
import { ConnectionPool, CloudConnectionPool } from './pool';
import Connection from './Connection';
import Serializer from './Serializer';
@ -23,7 +23,7 @@ declare type emitFn = (event: string | symbol, ...args: any[]) => boolean;
interface TransportOptions {
emit: emitFn & noopFn;
connectionPool: ConnectionPool;
connectionPool: ConnectionPool | CloudConnectionPool;
serializer: Serializer;
maxRetries: number;
requestTimeout: number | string;
@ -113,7 +113,7 @@ export default class Transport {
DEFAULT: string;
};
emit: emitFn & noopFn;
connectionPool: ConnectionPool;
connectionPool: ConnectionPool | CloudConnectionPool;
serializer: Serializer;
maxRetries: number;
requestTimeout: number;