Macro pravega_client_retry::wrap_with_sync_retry [−][src]
wrap_with_sync_retry!
macro wraps any arbitrary synchronous function with pravega_rust_client_retry::retry_sync::retry_sync
This macro takes two parameters. The first parameter is the Retry policy which implements trait BackoffSchedule
.
The second parameter is the synchrounous function that needs to be wrapped within the retry logic.
The function invocation will be retried only error returned by the function returns can_retry()
as true.
E.g: usage
ⓘ
use pravega_rust_client_retry::retry_policy::RetryWithBackoff; use pravega_rust_client_retry::retry_sync::retry_sync; use pravega_rust_client_retry::wrap_with_sync_retry; // CustomError implements Retryable trait fn function_a(param1: &str, param2:u8) -> Result<(), CustomError>{ } let retry_policy = RetryWithBackoff::default().max_tries(5); // the below invocation wraps function_a with the retry logic. wrap_with_sync_retry!(retry_policy, function_a("test", 1));