iceberg-cpp
Loading...
Searching...
No Matches
Public Member Functions | List of all members
iceberg::RetryRunner Class Reference

Utility class for running tasks with retry logic. More...

#include <retry_util.h>

Public Member Functions

 RetryRunner (RetryConfig config={})
 Construct a RetryRunner with the given configuration.
 
RetryRunnerOnlyRetryOn (std::initializer_list< ErrorKind > error_kinds)
 Specify error types that should trigger a retry.
 
RetryRunnerOnlyRetryOn (ErrorKind error_kind)
 Specify a single error type that should trigger a retry.
 
RetryRunnerStopRetryOn (std::initializer_list< ErrorKind > error_kinds)
 Specify error types that should stop retries immediately.
 
RetryRunnerStopRetryOn (ErrorKind error_kind)
 Specify a single error type that should stop retries immediately.
 
template<typename F >
requires detail::RetryTask<F>
auto Run (F &&task, int32_t *attempt_counter=nullptr) -> detail::RetryTaskResult< F >
 Run a task that returns a Result<T>
 

Detailed Description

Utility class for running tasks with retry logic.

When retries are enabled (num_retries > 0), callers must explicitly configure retry policy with OnlyRetryOn(...) or StopRetryOn(...).

Member Function Documentation

◆ OnlyRetryOn() [1/2]

RetryRunner & iceberg::RetryRunner::OnlyRetryOn ( ErrorKind  error_kind)
inline

Specify a single error type that should trigger a retry.

Note
OnlyRetryOn takes priority over StopRetryOn. If OnlyRetryOn is set, StopRetryOn is ignored.

◆ OnlyRetryOn() [2/2]

RetryRunner & iceberg::RetryRunner::OnlyRetryOn ( std::initializer_list< ErrorKind >  error_kinds)
inline

Specify error types that should trigger a retry.

When set, only errors matching one of these kinds will be retried. All other errors will stop retries immediately.

Note
OnlyRetryOn takes priority over StopRetryOn. If OnlyRetryOn is set, StopRetryOn is ignored.

◆ Run()

template<typename F >
requires detail::RetryTask<F>
auto iceberg::RetryRunner::Run ( F &&  task,
int32_t *  attempt_counter = nullptr 
) -> detail::RetryTaskResult<F>
inline

Run a task that returns a Result<T>

When num_retries > 0, the retry policy must be configured explicitly via OnlyRetryOn(...) or StopRetryOn(...).

TODO: Replace attempt_counter with a metrics reporter once it is available.

◆ StopRetryOn() [1/2]

RetryRunner & iceberg::RetryRunner::StopRetryOn ( ErrorKind  error_kind)
inline

Specify a single error type that should stop retries immediately.

Note
OnlyRetryOn takes priority over StopRetryOn. If OnlyRetryOn is set, StopRetryOn is ignored.

◆ StopRetryOn() [2/2]

RetryRunner & iceberg::RetryRunner::StopRetryOn ( std::initializer_list< ErrorKind >  error_kinds)
inline

Specify error types that should stop retries immediately.

When set, errors matching one of these kinds will not be retried. All other errors will be retried.

Note
OnlyRetryOn takes priority over StopRetryOn. If OnlyRetryOn is set, StopRetryOn is ignored.

The documentation for this class was generated from the following files: