import { ConnectionConfig } from "../types/connection";
import { Connection } from "./Connection";
/**
 * Options for connection pool
 */
export interface ConnectionPoolOptions {
    /**
     * Minimum number of connections to keep in the pool
     * @default 1
     */
    minConnections?: number;
    /**
     * Maximum number of connections to allow in the pool
     * @default 10
     */
    maxConnections?: number;
    /**
     * Time in ms after which idle connections are removed from the pool
     * @default 60000 (1 minute)
     */
    idleTimeoutMillis?: number;
    /**
     * Time in ms to wait for a connection to become available
     * @default 30000 (30 seconds)
     */
    acquireTimeoutMillis?: number;
    /**
     * Whether to validate connections before returning them
     * @default true
     */
    validateOnBorrow?: boolean;
}
/**
 * Connection pool for managing multiple ClickHouse connections
 * Provides automatic connection management, retry logic, and error handling
 */
export declare class ConnectionPool {
    /**
     * Minimum number of connections to keep in the pool
     */
    private minConnections;
    /**
     * Maximum number of connections to allow in the pool
     */
    private maxConnections;
    /**
     * Time in ms after which idle connections are removed from the pool
     */
    private idleTimeoutMillis;
    /**
     * Time in ms to wait for a connection to become available
     */
    private acquireTimeoutMillis;
    /**
     * Whether to validate connections before returning them
     */
    private validateOnBorrow;
    /**
     * Database connection options
     */
    private connectionOptions;
    /**
     * Pool of available connections
     */
    private availableConnections;
    /**
     * Currently borrowed connections
     */
    private borrowedConnections;
    /**
     * Queue of pending requests for connections
     */
    private waitingClients;
    /**
     * Create a new connection pool
     * @param connectionOptions - Options for ClickHouse connections
     * @param poolOptions - Options for the connection pool
     */
    constructor(connectionOptions: ConnectionConfig, poolOptions?: ConnectionPoolOptions);
    /**
     * Initialize the pool with minimum connections
     */
    private initialize;
    /**
     * Get a connection from the pool
     * @returns Promise that resolves to a connection
     */
    getConnection(): Promise<Connection>;
    /**
     * Release a connection back to the pool
     * @param connection - Connection to release
     */
    releaseConnection(connection: Connection): void;
    /**
     * Create a new connection
     * @returns Promise that resolves to a new connection
     */
    private createConnection;
    /**
     * Remove idle connections from the pool
     */
    private removeIdleConnections;
    /**
     * Execute a function with a connection from the pool
     * @param fn - Function to execute with the connection
     * @returns Promise that resolves to the function's result
     */
    withConnection<T>(fn: (connection: Connection) => Promise<T>): Promise<T>;
    /**
     * Close all connections in the pool
     */
    close(): Promise<void>;
}
//# sourceMappingURL=ConnectionPool.d.ts.map