/**
 * Retry Manager for Transient Failures
 * Handles automatic retries with exponential backoff and intelligent failure detection
 */
export declare enum RetryStrategy {
    EXPONENTIAL_BACKOFF = "exponential_backoff",
    LINEAR_BACKOFF = "linear_backoff",
    IMMEDIATE = "immediate",
    CUSTOM = "custom"
}
export declare enum FailureType {
    TRANSIENT = "transient",// Temporary, likely to succeed on retry
    PERMANENT = "permanent",// Persistent, unlikely to succeed
    UNKNOWN = "unknown"
}
export interface RetryConfig {
    maxAttempts: number;
    strategy: RetryStrategy;
    initialDelay?: number;
    maxDelay?: number;
    backoffMultiplier?: number;
    timeout?: number;
    onRetry?: (attempt: number, error: Error) => void;
    shouldRetry?: (error: Error) => boolean;
}
export interface RetryResult<T> {
    success: boolean;
    result?: T;
    error?: Error;
    attempts: number;
    totalTime: number;
    failureType?: FailureType;
}
export declare class RetryManager {
    private static readonly DEFAULT_CONFIG;
    /**
     * Execute a function with automatic retry logic
     */
    static execute<T>(fn: () => Promise<T>, config?: Partial<RetryConfig>): Promise<RetryResult<T>>;
    /**
     * Classify error as transient or permanent
     */
    static classifyFailure(error: Error): FailureType;
    /**
     * Calculate delay based on retry strategy
     */
    private static calculateDelay;
    /**
     * Execute function with timeout
     */
    private static withTimeout;
    /**
     * Sleep for specified milliseconds
     */
    private static sleep;
    /**
     * Batch retry - execute multiple operations with retry
     */
    static executeBatch<T>(operations: Array<() => Promise<T>>, config?: Partial<RetryConfig>): Promise<BatchRetryResult<T>>;
    /**
     * Circuit breaker pattern - stop retrying if too many failures
     */
    static createCircuitBreaker(name: string, failureThreshold?: number, resetTimeout?: number): CircuitBreaker;
}
/**
 * Circuit breaker implementation
 */
export declare class CircuitBreaker {
    private name;
    private failureThreshold;
    private resetTimeout;
    private failures;
    private lastFailureTime;
    private state;
    constructor(name: string, failureThreshold: number, resetTimeout: number);
    execute<T>(fn: () => Promise<T>): Promise<T>;
    private onSuccess;
    private onFailure;
    getState(): 'closed' | 'open' | 'half-open';
    reset(): void;
}
export interface BatchRetryResult<T> {
    totalOperations: number;
    executedOperations: number;
    succeeded: number;
    failed: number;
    results: Array<RetryResult<T>>;
    totalTime: number;
    allSucceeded: boolean;
}
/**
 * Retry-specific error messages
 */
export declare class RetryError extends Error {
    readonly attempts: number;
    readonly failureType: FailureType;
    readonly originalError: Error;
    constructor(message: string, attempts: number, failureType: FailureType, originalError: Error);
    format(): string;
}
/**
 * Helper functions for common retry scenarios
 */
export declare class RetryHelpers {
    /**
     * Retry file operations
     */
    static retryFileOperation<T>(operation: () => Promise<T>, description: string): Promise<T>;
    /**
     * Retry network operations
     */
    static retryNetworkOperation<T>(operation: () => Promise<T>, description: string): Promise<T>;
    /**
     * Retry database operations
     */
    static retryDatabaseOperation<T>(operation: () => Promise<T>, description: string): Promise<T>;
}
//# sourceMappingURL=retry-manager.d.ts.map