1 | import { Gauge, Counter, Histogram } from 'prom-client';
|
2 | import { ExtendedGaugeInternal } from 'prometheus-extended-gauge';
|
3 | import { Pool, Factory } from 'generic-pool';
|
4 |
|
5 |
|
6 |
|
7 | export declare const DEFAULT_CONNECTION_POOL_OPTIONS: PoolConfig<any>;
|
8 |
|
9 |
|
10 |
|
11 | export interface ConnectionConfig {
|
12 | }
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | export interface PoolConfig<C extends ConnectionConfig> {
|
19 | max?: number;
|
20 | min?: number;
|
21 | maxWaitingClients?: number;
|
22 | testOnBorrow?: boolean;
|
23 | acquireTimeoutMillis?: number;
|
24 | evictionRunIntervalMillis?: number;
|
25 | numTestsPerRun?: number;
|
26 | softIdleTimeoutMillis?: number;
|
27 | idleTimeoutMillis?: number;
|
28 | connectionConfig?: C;
|
29 | }
|
30 | export declare abstract class ConnectionPool<T> {
|
31 | abstract getName(): string;
|
32 | abstract isReadonly(): boolean;
|
33 | abstract getConnection(): Promise<T>;
|
34 | abstract release(connection: T): any;
|
35 | abstract start(): any;
|
36 | abstract stop(): any;
|
37 | }
|
38 | export declare class InstrumentedFactory<T> implements Factory<T> {
|
39 | validateFailedCounter: Counter.Internal;
|
40 | connectErrorsCounter: Counter.Internal;
|
41 | connectTimeHistogram: Histogram.Internal;
|
42 | totalGauge: Gauge.Internal;
|
43 | factory: Factory<T>;
|
44 | constructor(factory: Factory<T>, name: string, readonly: boolean);
|
45 | create(): Promise<T>;
|
46 | destroy(client: T): Promise<undefined>;
|
47 | validate(client: T): Promise<boolean>;
|
48 | }
|
49 | export declare class InstrumentedConnectionPool<C, CC extends ConnectionConfig> extends ConnectionPool<C> {
|
50 | readonly: boolean;
|
51 | name: string;
|
52 | activeGauge: ExtendedGaugeInternal;
|
53 | useTimeHistogram: Histogram.Internal;
|
54 | acquireErrorsCounter: Counter.Internal;
|
55 | pool: Pool<C>;
|
56 | acquireTimeHistogram: Histogram.Internal;
|
57 | options: PoolConfig<CC>;
|
58 | private status;
|
59 | maxConnectionLimitGauge: Gauge.Internal;
|
60 | constructor(factory: Factory<C>, options: PoolConfig<CC>, name: string, readonly: boolean);
|
61 | getName(): string;
|
62 | isReadonly(): boolean;
|
63 | getConnection(): Promise<C>;
|
64 | private getGenericPoolOptions();
|
65 | release(connection: C): void;
|
66 | start(): Promise<void>;
|
67 | stop(): Promise<void>;
|
68 | getOptions(): PoolConfig<CC>;
|
69 | }
|