Expand description
Error recovery patterns for handling transient errors
This module provides various error recovery strategies that can be used to make applications more resilient to transient failures.
§Features
- Backoff strategies for controlling retry timing
- Circuit breaker pattern to prevent cascading failures
- Retry policies for flexible retry behaviors
§Examples
ⓘ
use error_forge::recovery::{ExponentialBackoff, RetryPolicy};
let backoff = ExponentialBackoff::new()
.with_initial_delay(100)
.with_max_delay(10000)
.with_jitter(true);
let policy = RetryPolicy::new(backoff)
.with_max_retries(3);
let result = policy.retry(|| {
// Operation that might fail
Ok(())
});
Structs§
- Circuit
Breaker - Circuit breaker implementation to prevent cascading failures
- Circuit
Breaker Config - Configuration for a circuit breaker
- Circuit
Open Error - Error returned when circuit is open
- Exponential
Backoff - Exponential backoff strategy with optional jitter
- Fixed
Backoff - Fixed backoff strategy
- Linear
Backoff - Linear backoff strategy
- Retry
Executor - Executor for retry operations
- Retry
Policy - Policy for retrying operations
Enums§
- Circuit
State - Represents the current state of a circuit breaker
Traits§
- Backoff
- Trait for backoff strategies used in retry mechanisms
- Forge
Error Recovery - Extension trait that adds recovery capabilities to ForgeError types
Type Aliases§
- Recovery
Result - Result type for recovery operations