/** * Advanced error handling and resilience patterns for Memorai * Includes retry mechanisms, circuit breakers, and graceful degradation */ export interface RetryOptions { maxAttempts: number; baseDelayMs: number; maxDelayMs: number; exponentialBackoff: boolean; jitter: boolean; retryableErrors?: string[]; } export interface CircuitBreakerOptions { failureThreshold: number; resetTimeoutMs: number; monitoringWindowMs: number; minimumCalls: number; } export declare enum CircuitBreakerState { CLOSED = "CLOSED", OPEN = "OPEN", HALF_OPEN = "HALF_OPEN" } export declare class RetryManager { private defaultOptions; /** * Execute a function with retry logic */ executeWithRetry(operation: () => Promise, options?: Partial): Promise; private isRetryableError; private calculateDelay; private sleep; } export declare class CircuitBreaker { private name; private options; private state; private failures; private lastFailureTime; private nextAttemptTime; private recentCalls; constructor(name: string, options: CircuitBreakerOptions); /** * Execute a function with circuit breaker protection */ execute(operation: () => Promise): Promise; /** * Get current circuit breaker status */ getStatus(): { state: CircuitBreakerState; failures: number; successRate: number; nextAttemptTime?: Date; }; private shouldRejectCall; private onSuccess; private onFailure; private shouldOpenCircuit; private recordCall; private getRecentCallsCount; private calculateSuccessRate; private getRecentCallsInWindow; } export declare class ResilienceManager { private retryManager; private circuitBreakers; /** * Execute operation with both retry and circuit breaker protection */ executeResilient(operationName: string, operation: () => Promise, options?: { retry?: Partial; circuitBreaker?: CircuitBreakerOptions; }): Promise; /** * Execute with graceful degradation fallback */ executeWithFallback(operation: () => Promise, fallback: () => Promise, operationName?: string, options?: { retry?: Partial; circuitBreaker?: CircuitBreakerOptions; }): Promise; /** * Get status of all circuit breakers */ getAllCircuitBreakerStatus(): Record>; /** * Reset a specific circuit breaker */ resetCircuitBreaker(name: string): boolean; private getOrCreateCircuitBreaker; } export declare const resilienceManager: ResilienceManager; //# sourceMappingURL=ResilienceManager.d.ts.map