pub struct RetryEngine { /* private fields */ }Expand description
Runtime retry state for all connections.
Implementations§
Source§impl RetryEngine
impl RetryEngine
pub fn new() -> Self
Sourcepub fn classify_http_status(status: u16) -> FailureClass
pub fn classify_http_status(status: u16) -> FailureClass
Classify an HTTP status code into a failure class.
Sourcepub fn classify_error(error: &str) -> FailureClass
pub fn classify_error(error: &str) -> FailureClass
Classify a connection error string.
Sourcepub fn strategy_for(class: FailureClass) -> RetryStrategy
pub fn strategy_for(class: FailureClass) -> RetryStrategy
Get the retry strategy for a failure class.
Sourcepub fn get_circuit(&mut self, endpoint: &str) -> &CircuitBreaker
pub fn get_circuit(&mut self, endpoint: &str) -> &CircuitBreaker
Get or create a circuit breaker for an endpoint.
Sourcepub fn record_failure(
&mut self,
endpoint: &str,
class: FailureClass,
message: &str,
status: Option<u16>,
)
pub fn record_failure( &mut self, endpoint: &str, class: FailureClass, message: &str, status: Option<u16>, )
Record a failure for an endpoint.
Sourcepub fn record_success(&mut self, endpoint: &str)
pub fn record_success(&mut self, endpoint: &str)
Record a success for an endpoint.
Sourcepub fn should_allow(&self, endpoint: &str) -> bool
pub fn should_allow(&self, endpoint: &str) -> bool
Check if a request to this endpoint should be allowed.
Sourcepub fn update_rate_limit(
&mut self,
endpoint: &str,
limit: u32,
remaining: u32,
reset_epoch: i64,
)
pub fn update_rate_limit( &mut self, endpoint: &str, limit: u32, remaining: u32, reset_epoch: i64, )
Update rate limit tracking from response headers.
Sourcepub fn rate_limit_status(&self, endpoint: &str) -> Option<&RateLimitWindow>
pub fn rate_limit_status(&self, endpoint: &str) -> Option<&RateLimitWindow>
Get rate limit status for an endpoint.
Sourcepub fn all_circuits(&self) -> &HashMap<String, CircuitBreaker>
pub fn all_circuits(&self) -> &HashMap<String, CircuitBreaker>
Get all circuit breaker states.
Sourcepub fn reset_circuit(&mut self, endpoint: &str) -> bool
pub fn reset_circuit(&mut self, endpoint: &str) -> bool
Reset a circuit breaker.
Sourcepub fn failure_patterns(&self, endpoint: &str) -> Vec<&FailureRecord>
pub fn failure_patterns(&self, endpoint: &str) -> Vec<&FailureRecord>
Get failure patterns for an endpoint.
Sourcepub fn recent_failures(&self, limit: usize) -> Vec<&FailureRecord>
pub fn recent_failures(&self, limit: usize) -> Vec<&FailureRecord>
Get all recent failures.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RetryEngine
impl RefUnwindSafe for RetryEngine
impl Send for RetryEngine
impl Sync for RetryEngine
impl Unpin for RetryEngine
impl UnsafeUnpin for RetryEngine
impl UnwindSafe for RetryEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more