Expand description
ChronoMachines - Pure Rust exponential backoff and retry library
This crate provides a lightweight, no_std compatible implementation of
exponential backoff with full jitter for retry mechanisms.
§Features
- Full Jitter: Prevents thundering herd problem
- no_std compatible: Works in embedded environments
- Zero allocation: Uses stack-only data structures
- Fast: Minimal overhead for delay calculations
§Example
use chrono_machines::Policy;
let policy = Policy {
max_attempts: 5,
base_delay_ms: 100,
multiplier: 2.0,
max_delay_ms: 10_000,
};
// Use full jitter (1.0) - recommended for distributed systems
let delay = policy.calculate_delay(1, 1.0);
println!("Wait {}ms before retry", delay);Re-exports§
pub use backoff::fibonacci;pub use backoff::BackoffPolicy;pub use backoff::BackoffStrategy;pub use backoff::ConstantBackoff;pub use backoff::ExponentialBackoff;pub use backoff::FibonacciBackoff;pub use dsl::builder_for_policy;pub use dsl::retry_with_policy;pub use dsl::DslError;pub use policy::PolicyRegistry;pub use policy::clear_global_policies;pub use policy::get_global_policy;pub use policy::list_global_policies;pub use policy::register_global_policy;pub use policy::remove_global_policy;pub use retry::RetryBuilder;pub use retry::RetryContext;pub use retry::RetryError;pub use retry::RetryOutcome;pub use retry::Retryable;pub use retry::RetryableExt;pub use sleep::StdSleeper;pub use sleep::FnSleeper;pub use sleep::Sleeper;
Modules§
- backoff
- Backoff strategy implementations for retry mechanisms
- dsl
- Ergonomic helpers that mirror the high-level DSL available in the Ruby gem.
- policy
- Named policy management utilities.
- retry
- Retry mechanism with fluent builder API
- sleep
- Sleep abstraction for no_std compatibility
Structs§
- Policy
- Retry policy configuration