pub struct RetryExecutor { /* private fields */ }Expand description
Executes an async operation with automatic retry.
Implementations§
Source§impl RetryExecutor
impl RetryExecutor
Sourcepub fn new(config: RetryConfig) -> Self
pub fn new(config: RetryConfig) -> Self
Creates a new retry executor with the given config.
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Creates a retry executor with default config.
Sourcepub async fn execute<F, Fut, T>(&self, operation: F) -> AptosResult<T>
pub async fn execute<F, Fut, T>(&self, operation: F) -> AptosResult<T>
Executes an async operation with retry logic.
The operation will be retried if it returns a retryable error, up to the configured maximum number of retries.
§Errors
Returns an error if the operation fails and either the maximum number of retries has been exhausted or the error is not retryable according to the retry configuration.
Sourcepub async fn execute_with_predicate<F, Fut, T, P>(
&self,
operation: F,
should_retry: P,
) -> AptosResult<T>
pub async fn execute_with_predicate<F, Fut, T, P>( &self, operation: F, should_retry: P, ) -> AptosResult<T>
Executes an async operation with retry logic and a custom retry predicate.
§Errors
Returns an error if the operation fails and either the maximum number of
retries has been exhausted or the custom retry predicate returns false.
Trait Implementations§
Source§impl Clone for RetryExecutor
impl Clone for RetryExecutor
Source§fn clone(&self) -> RetryExecutor
fn clone(&self) -> RetryExecutor
Returns a duplicate 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 moreAuto Trait Implementations§
impl Freeze for RetryExecutor
impl RefUnwindSafe for RetryExecutor
impl Send for RetryExecutor
impl Sync for RetryExecutor
impl Unpin for RetryExecutor
impl UnwindSafe for RetryExecutor
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