/** * Retryable Operation Module * * Combines retry logic and circuit breaker pattern into a single * reusable component for Kubernetes operations. */ import { Logger } from 'winston'; import { RetryConfig } from './RetryStrategy.js'; import { CircuitBreakerConfig } from './CircuitBreaker.js'; import { ErrorMonitor, ErrorContext } from './ErrorHandling.js'; /** * Configuration for retryable operations */ export interface RetryableOperationConfig { /** Retry configuration */ retry?: Partial; /** Circuit breaker configuration */ circuitBreaker?: Partial>; /** Error monitor instance */ errorMonitor?: ErrorMonitor; /** Logger instance */ logger?: Logger; } /** * Result of a retryable operation */ export interface OperationResult { success: boolean; value?: T; error?: any; attempts: number; totalTimeMs: number; circuitState?: string; } /** * Retryable operation that combines retry and circuit breaker */ export declare class RetryableOperation { private readonly operationName; private readonly retryStrategy; private readonly circuitBreaker; private readonly errorMonitor?; private readonly logger?; constructor(operationName: string, config?: RetryableOperationConfig); /** * Execute an operation with retry and circuit breaker protection */ execute(operation: () => Promise, context?: ErrorContext): Promise>; /** * Execute operation and throw on failure */ executeOrThrow(operation: () => Promise, context?: ErrorContext): Promise; /** * Get circuit breaker state */ getCircuitState(): string; /** * Get circuit breaker statistics */ getCircuitStats(): import("./CircuitBreaker.js").CircuitStats; /** * Manually reset the circuit breaker */ resetCircuit(): void; /** * Force open the circuit breaker */ openCircuit(): void; /** * Set up circuit breaker event listeners */ private setupCircuitBreakerEvents; /** * Cleanup resources */ dispose(): void; } /** * Factory for creating retryable operations */ export declare class RetryableOperationFactory { private readonly operations; private readonly defaultConfig; constructor(defaultConfig?: RetryableOperationConfig, logger?: Logger); /** * Create or get a retryable operation */ create(operationName: string, config?: RetryableOperationConfig): RetryableOperation; /** * Get an existing operation */ get(operationName: string): RetryableOperation | undefined; /** * Remove an operation */ remove(operationName: string): boolean; /** * Get all operation names */ getOperationNames(): string[]; /** * Get statistics for all operations */ getAllStats(): Record; /** * Reset all circuit breakers */ resetAllCircuits(): void; /** * Dispose all operations */ dispose(): void; } /** * Decorator for making methods retryable */ export declare function RetryableMethod(operationName?: string, config?: RetryableOperationConfig): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor; //# sourceMappingURL=RetryableOperation.d.ts.map