pub trait CanRetry {
// Required method
fn can_retry(&self) -> bool;
// Provided methods
fn is_no_available_addresses(&self) -> bool { ... }
fn rate_limit_ban_duration(&self) -> Option<Duration> { ... }
fn is_node_failure(&self) -> bool { ... }
}Expand description
Returns true if the operation can be retried.
Required Methods§
Provided Methods§
Sourcefn is_no_available_addresses(&self) -> bool
fn is_no_available_addresses(&self) -> bool
Returns true if this error represents a “no available addresses” condition.
When all addresses have been banned due to errors, the client returns this error. Retry logic uses this to return the last meaningful error instead of this one.
Sourcefn rate_limit_ban_duration(&self) -> Option<Duration>
fn rate_limit_ban_duration(&self) -> Option<Duration>
If this error is a gRPC ResourceExhausted (Envoy rate-limit) that
carries a RateLimit-Reset metadata header, returns the server-advertised
ban duration (clamped to a safe range). Returns None for all other
errors and for rate-limit errors that carry no usable header (the caller
falls back to the normal exponential ban ladder in that case).
Sourcefn is_node_failure(&self) -> bool
👎Deprecated: Use !can_retry() instead
fn is_node_failure(&self) -> bool
Use !can_retry() instead
Get boolean flag that indicates if the error is retryable.
Deprecated in favor of CanRetry::can_retry.
Implementations on Foreign Types§
Source§impl CanRetry for Status
impl CanRetry for Status
Source§fn rate_limit_ban_duration(&self) -> Option<Duration>
fn rate_limit_ban_duration(&self) -> Option<Duration>
Returns the Envoy-advertised ban duration for a ResourceExhausted
response, or None if this is not a rate-limit or carries no usable
RateLimit-Reset header.
Envoy’s global rate-limit filter emits RateLimit-Reset: <seconds> when
LIMIT_RESPONSE_HEADERS_ENABLED=true is set on the Lyft RLS container
(see packages/dashmate/docker-compose.rate_limiter.yml). The value is
the whole-second count until the per-IP window resets.
Parse rules (adversarial-input safe):
- Non-
ResourceExhaustedcode →None. - Header absent, non-numeric, or
0→None(caller uses normal ban ladder). - Valid positive integer → clamped to
[
[MIN_RATE_LIMIT_BAN_SECS, MAX_RATE_LIMIT_BAN_SECS]] (dapi_client.rs) and returned asSome(Duration).