Clio develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
util::Retry Class Reference

A retry mechanism. More...

#include <Retry.hpp>

Public Member Functions

 Retry (RetryStrategyPtr strategy, boost::asio::strand< boost::asio::io_context::executor_type > strand)
 Construct a new Retry object.
 
 ~Retry ()
 Destroy the Retry object.
 
template<typename Fn >
void retry (Fn &&func)
 Schedule a retry.
 
void cancel ()
 Cancel scheduled retry if any.
 
size_t attemptNumber () const
 
std::chrono::steady_clock::duration delayValue () const
 
void reset ()
 Reset the delay value and attempt number.
 

Detailed Description

A retry mechanism.

Constructor & Destructor Documentation

◆ Retry()

util::Retry::Retry ( RetryStrategyPtr strategy,
boost::asio::strand< boost::asio::io_context::executor_type > strand )

Construct a new Retry object.

Parameters
strategyThe retry strategy to use
strandThe strand to use for async operations

Member Function Documentation

◆ attemptNumber()

size_t util::Retry::attemptNumber ( ) const
Returns
The current attempt number

◆ delayValue()

std::chrono::steady_clock::duration util::Retry::delayValue ( ) const
Returns
The current delay value

◆ retry()

template<typename Fn >
void util::Retry::retry ( Fn && func)
inline

Schedule a retry.

Template Parameters
FnThe type of the callable to execute
Parameters
funcThe callable to execute

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