import { type ClickHouseClient } from '@clickhouse/client';
export declare class ClickHouseService {
    private client;
    private config;
    private credentials;
    private isInitialized;
    private initPromise;
    private retryConfig;
    constructor();
    /**
     * Check if an error is retryable (503, 502, 504, network errors, timeouts)
     */
    private isRetryableError;
    /**
     * Sleep for a given number of milliseconds
     */
    private sleep;
    /**
     * Execute a function with retry logic and exponential backoff
     */
    private executeWithRetry;
    /**
     * Initialize the ClickHouse service with credentials and connection pooling
     * This function fetches credentials and sets up the connection pool
     * Uses a promise lock to prevent race conditions during initialization
     */
    init(): Promise<void>;
    /**
     * Internal initialization method
     */
    private _doInit;
    /**
     * Mock function to fetch credentials
     * Replace this with actual secrets management implementation
     */
    private fetchCredentials;
    /**
     * Ensure the service is initialized before performing operations
     */
    private ensureInitialized;
    /**
     * Execute a query and return results
     * Utilizes the connection pool for efficient connection management
     * Includes retry logic with exponential backoff for transient failures
     */
    query<T = any>(sql: string, params?: Record<string, any>): Promise<T[]>;
    /**
     * Execute an insert operation
     * Uses the connection pool for efficient bulk inserts
     * Includes retry logic with exponential backoff for transient failures
     */
    insert(table: string, data: Record<string, any>[]): Promise<void>;
    /**
     * Execute a command (DDL operations, etc.)
     * Reuses pooled connections for efficient command execution
     * Includes retry logic with exponential backoff for transient failures
     */
    command(sql: string): Promise<void>;
    /**
     * Execute a delete operation
     * Uses the connection pool for efficient delete operations
     * Includes retry logic with exponential backoff for transient failures
     */
    delete(table: string, whereClause: string, params?: Record<string, any>): Promise<void>;
    /**
     * Check if the connection is healthy
     * Uses the built-in ping method which leverages the connection pool
     */
    ping(): Promise<boolean>;
    /**
     * Get connection pool statistics (if available)
     * Note: The ClickHouse client doesn't expose detailed pool stats,
     * but this method can be extended in the future
     */
    getPoolStats(): Record<string, any>;
    /**
     * Close the connection pool and cleanup resources
     * This closes all pooled connections gracefully
     */
    close(): Promise<void>;
    /**
     * Get client instance (for advanced operations)
     * Note: Direct client access should be used carefully to maintain connection pool efficiency
     */
    getClient(): ClickHouseClient | null;
    /**
     * Reset the connection pool
     * Useful for handling connection issues or configuration changes
     */
    resetPool(): Promise<void>;
}
export declare const clickHouseService: ClickHouseService;
//# sourceMappingURL=clickhouseService.d.ts.map