import type { PoolConfig } from "pg";
import { Pool } from "pg";
import type { ClientQueryLoggerProps, SwallowedErrorLoggerProps } from "../abstract/Loggers";
import type { MaybeCallable, PickPartial } from "../internal/misc";
import type { PgClientConn, PgClientOptions } from "./PgClient";
import { PgClient } from "./PgClient";
/**
 * Options for PgClientPool constructor.
 */
export interface PgClientPoolOptions extends PgClientOptions {
    /** Node-Postgres config. We can't make it MaybeCallable unfortunately,
     * because it's used to initialize Node-Postgres Pool. */
    config: PoolConfig & {
        min?: number | undefined;
    };
    /** Pool class (constructor) compatible with node-postgres Pool. */
    Pool?: typeof Pool;
    /** Close the connection after the query if it was opened long time ago. */
    maxConnLifetimeMs?: MaybeCallable<number>;
    /** Jitter for maxConnLifetimeMs. */
    maxConnLifetimeJitter?: MaybeCallable<number>;
    /** Add not more than this number of connections in each prewarm interval. New
     * connections are expensive to establish (especially when SSL is enabled). */
    prewarmIntervalStep?: MaybeCallable<number>;
    /** How often to send bursts of prewarm queries to all Clients to keep the
     * minimal number of open connections. */
    prewarmIntervalMs?: MaybeCallable<number>;
    /** Jitter for prewarmIntervalMs. */
    prewarmIntervalJitter?: MaybeCallable<number>;
    /** What prewarm query to send. */
    prewarmQuery?: MaybeCallable<string>;
}
/**
 * This class carries connection pooling logic only and delegates the rest to
 * PgClient base class.
 *
 * The idea is that in each particular project, people may have they own classes
 * derived from PgClient, in case the codebase already has some existing
 * connection pooling solution. They don't have to use PgClientPool.
 */
export declare class PgClientPool extends PgClient {
    /** Default values for the constructor options. */
    static readonly DEFAULT_OPTIONS: Required<PickPartial<PgClientPoolOptions>>;
    /** PG connection pool to use. */
    private readonly pool;
    /** Prewarming periodic timer (if scheduled). */
    private readonly prewarmTimeout;
    /** Whether the pool has been ended and is not usable anymore. */
    private readonly ended;
    /** PgClientPool configuration options. */
    readonly options: Required<PgClientPoolOptions>;
    constructor(options: PgClientPoolOptions);
    acquireConn(): Promise<PgClientConn>;
    poolStats(): ClientQueryLoggerProps["poolStats"];
    address(): string;
    logSwallowedError(props: SwallowedErrorLoggerProps): void;
    end(): Promise<void>;
    isEnded(): boolean;
    prewarm(): void;
}
//# sourceMappingURL=PgClientPool.d.ts.map