/** * postgres-mcp - Connection Pool Manager * * Wraps pg connection pooling with health monitoring, * statistics tracking, and graceful shutdown support. */ import pg from "pg"; import type { PoolClient, QueryResult as PgQueryResult } from "pg"; import type { PoolConfig, PoolStats, HealthStatus } from "../types/index.js"; /** * Connection pool configuration with defaults */ export interface ConnectionPoolConfig { host: string; port: number; user: string; password: string; database: string; initializationSql?: string[]; pool?: PoolConfig | undefined; ssl?: pg.ConnectionConfig["ssl"] | undefined; statementTimeout?: number | undefined; applicationName?: string | undefined; } /** * Connection pool wrapper with statistics and health monitoring */ export declare class ConnectionPool { private pool; private config; private initializedConnections; private stats; private shuttingDown; constructor(config: ConnectionPoolConfig); /** * Initialize the connection pool */ initialize(): Promise; /** * Get a connection from the pool */ getConnection(): Promise; /** * Release a connection back to the pool */ releaseConnection(client: PoolClient): void; /** * Execute a query using a pooled connection. * Routes through getConnection() to ensure initializationSql is applied. */ query[]>(sql: string, params?: unknown[]): Promise>; /** * Get pool statistics */ getStats(): PoolStats; /** * Check pool health */ checkHealth(): Promise; /** * Gracefully shutdown the pool */ shutdown(): Promise; /** * Check if pool is initialized */ isInitialized(): boolean; /** * Check if pool is shutting down */ isClosing(): boolean; /** * Apply initialization SQL to a connection if configured and not yet applied. * Uses WeakSet tracking so init runs exactly once per physical connection. * Releases the connection and throws PoolError on failure. */ private applyInitializationSql; } //# sourceMappingURL=connection-pool.d.ts.map