import * as k8s from '@kubernetes/client-node'; import { Logger } from 'winston'; import { EventEmitter } from 'events'; /** * Configuration options for connection pooling */ export interface ConnectionPoolConfig { /** * Maximum number of connections per pool */ maxConnections?: number; /** * Minimum number of connections to maintain */ minConnections?: number; /** * Maximum idle time for a connection before removal (ms) */ maxIdleTime?: number; /** * Time to wait for a connection to become available (ms) */ acquireTimeout?: number; /** * Interval for health check runs (ms) */ healthCheckInterval?: number; /** * Number of retries for failed health checks */ healthCheckRetries?: number; /** * Enable connection warm-up on pool initialization */ enableWarmup?: boolean; /** * Logger instance for debug output */ logger?: Logger; } /** * Connection state enum */ export declare enum ConnectionState { IDLE = "idle", IN_USE = "in-use", UNHEALTHY = "unhealthy", DISPOSED = "disposed" } /** * Connection entry tracking individual API client instances */ export declare class ConnectionEntry { readonly id: string; readonly kubeConfig: k8s.KubeConfig; private readonly logger?; private _state; private _lastUsed; private _createdAt; private _useCount; private _lastHealthCheck?; private _healthCheckFailures; constructor(id: string, kubeConfig: k8s.KubeConfig, logger?: Logger | undefined); /** * Get the current state of the connection */ get state(): ConnectionState; /** * Set the connection state */ set state(value: ConnectionState); /** * Get the last used timestamp */ get lastUsed(): Date; /** * Get the creation timestamp */ get createdAt(): Date; /** * Get the use count */ get useCount(): number; /** * Get health check failure count */ get healthCheckFailures(): number; /** * Get last health check timestamp */ get lastHealthCheck(): Date | undefined; /** * Mark the connection as used */ markUsed(): void; /** * Release the connection back to the pool */ release(): void; /** * Perform a health check on the connection */ checkHealth(): Promise; /** * Check if the connection has been idle too long */ isIdleExpired(maxIdleTime: number): boolean; /** * Dispose of the connection */ dispose(): void; /** * Create an API client of the specified type */ makeApiClient(apiClientType: new (config: k8s.Configuration) => T): T; } /** * Connection pool for managing Kubernetes API client connections */ export declare class ConnectionPool extends EventEmitter { private readonly contextName; private readonly kubeConfigFactory; private readonly config; private readonly connections; private readonly waitQueue; private healthCheckTimer?; private idleCheckTimer?; private disposed; private connectionCounter; constructor(contextName: string, kubeConfigFactory: () => k8s.KubeConfig, config?: ConnectionPoolConfig); private logger?; /** * Get pool statistics */ get stats(): { total: number; idle: number; inUse: number; unhealthy: number; waitQueueLength: number; }; /** * Warm up the pool by creating minimum connections */ private warmup; /** * Create a new connection */ private createConnection; /** * Acquire a connection from the pool */ acquire(): Promise; /** * Release a connection back to the pool */ release(connection: ConnectionEntry): void; /** * Remove a connection from the pool */ private removeConnection; /** * Start periodic health checks */ private startHealthChecks; /** * Perform health checks on all connections */ private performHealthChecks; /** * Start periodic idle connection checks */ private startIdleChecks; /** * Remove connections that have been idle too long */ private removeIdleConnections; /** * Dispose of the connection pool */ dispose(): Promise; } //# sourceMappingURL=ConnectionPool.d.ts.map