import { type EndpointInfo } from '@ydbjs/api/discovery';
import type { ChannelCredentials, ChannelOptions } from 'nice-grpc';
import { type Connection } from './conn.js';
export declare class ConnectionPool implements Disposable {
    #private;
    protected connections: Set<Connection>;
    protected pessimized: Set<Connection>;
    constructor(channelCredentials: ChannelCredentials, channelOptions?: ChannelOptions);
    /**
     * Get a channel based on load balancing rules
     * @param preferNodeId The preferred node id to use
     * @returns A connection from the pool
     */
    acquire(preferNodeId?: Connection["nodeId"]): Connection;
    /**
     * Release a connection back to the pool
     * @param conn The connection to release
     * @returns The connection pool instance
     */
    release(conn: Connection): this;
    /**
     * Add a new connection to the pool
     * @param endpoint The endpoint information for the new connection
     */
    add(endpoint: EndpointInfo): this;
    /**
     * Find a connection by node id
     * @param nodeId The node id to search for
     * @returns The connection if found, undefined otherwise
     */
    findByNodeId(nodeId: Connection["nodeId"]): Connection | undefined;
    /**
     * Remove a connection from the pool
     * @param connection The connection to remove
     */
    remove(connection: Connection): this;
    /**
     * Pessimize a connection for a set amount of time
     * @param connection The connection to pessimize
     */
    pessimize(connection: Connection): this;
    /**
     * Close all connections in the pool
     */
    close(): void;
    /**
     * Destroy the connection pool.
     */
    destroy(): void;
    [Symbol.dispose](): void;
}
//# sourceMappingURL=pool.d.ts.map