pub struct RetryBackoffLayer<P: RetryPolicy = RateLimitRetryPolicy> { /* private fields */ }
Expand description
A Transport Layer that is responsible for retrying requests based on the
error type. See TransportError
.
TransportError: crate::error::TransportError
Implementations§
Source§impl RetryBackoffLayer
impl RetryBackoffLayer
Sourcepub const fn new(
max_rate_limit_retries: u32,
initial_backoff: u64,
compute_units_per_second: u64,
) -> Self
pub const fn new( max_rate_limit_retries: u32, initial_backoff: u64, compute_units_per_second: u64, ) -> Self
Creates a new retry layer with the given parameters and the default RateLimitRetryPolicy.
Sourcepub const fn with_avg_unit_cost(self, avg_cost: u64)
pub const fn with_avg_unit_cost(self, avg_cost: u64)
Set the average cost of a request. Defaults to 17
CU
The cost of requests are usually weighted and can vary from 10 CU to several 100 CU,
cheaper requests are more common some example alchemy
weights:
eth_getStorageAt
: 17eth_getBlockByNumber
: 16eth_newFilter
: 20
(coming from forking mode) assuming here that storage request will be the
driver for Rate limits we choose 17
as the average cost
of any request
Source§impl<P: RetryPolicy> RetryBackoffLayer<P>
impl<P: RetryPolicy> RetryBackoffLayer<P>
Sourcepub const fn new_with_policy(
max_rate_limit_retries: u32,
initial_backoff: u64,
compute_units_per_second: u64,
policy: P,
) -> Self
pub const fn new_with_policy( max_rate_limit_retries: u32, initial_backoff: u64, compute_units_per_second: u64, policy: P, ) -> Self
Creates a new retry layer with the given parameters and RetryPolicy.
Trait Implementations§
Source§impl<P: Clone + RetryPolicy> Clone for RetryBackoffLayer<P>
impl<P: Clone + RetryPolicy> Clone for RetryBackoffLayer<P>
Source§fn clone(&self) -> RetryBackoffLayer<P>
fn clone(&self) -> RetryBackoffLayer<P>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<P: Debug + RetryPolicy> Debug for RetryBackoffLayer<P>
impl<P: Debug + RetryPolicy> Debug for RetryBackoffLayer<P>
Source§impl<S, P: RetryPolicy + Clone> Layer<S> for RetryBackoffLayer<P>
impl<S, P: RetryPolicy + Clone> Layer<S> for RetryBackoffLayer<P>
Auto Trait Implementations§
impl<P> Freeze for RetryBackoffLayer<P>where
P: Freeze,
impl<P> RefUnwindSafe for RetryBackoffLayer<P>where
P: RefUnwindSafe,
impl<P> Send for RetryBackoffLayer<P>
impl<P> Sync for RetryBackoffLayer<P>
impl<P> Unpin for RetryBackoffLayer<P>where
P: Unpin,
impl<P> UnwindSafe for RetryBackoffLayer<P>where
P: UnwindSafe,
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