#include <ozo/failover/retry.h>
Operation try representation.
Controls current try state incluiding number of tries remain, context of operation call for current try.
Options | — map of ozo::options . |
Context | — operation call context, literally operation arguments except CompletionToken. |
Public Member Functions | |
constexpr | basic_try (Options options, Context ctx) |
Construct a new basic try object. More... | |
auto | get_context () const |
Get the operation context. More... | |
template<typename Connection > | |
std::optional< basic_try > | get_next_try (ozo::error_code ec, Connection &&conn) |
Get the next try. More... | |
constexpr int | tries_remain () const |
Number of tries remains. More... | |
constexpr decltype(auto) | get_conditions () const |
Retry conditions for the try. More... | |
|
constexpr |
Construct a new basic try object.
options | — map of ozo::failover::retry_options . |
ctx | — operation context, compartible with ozo::failover::basic_context |
|
constexpr |
Retry conditions for the try.
boost::hana::tuple
of error conditions which have a good chance to be solved by a retry. References ozo::failover::retry_options::conditions, and ozo::get_option().
auto ozo::failover::basic_try< Options, Context >::get_context | ( | ) | const |
Get the operation context.
boost::hana::tuple
— operation initiation context for the try with modified time constraint; see ozo::retry_strategy::tries()
for details about calculations. References ozo::unwrap().
std::optional<basic_try> ozo::failover::basic_try< Options, Context >::get_next_try | ( | ozo::error_code | ec, |
Connection && | conn | ||
) |
Get the next try.
Return next try object for retry operation if it possible. See ozo::fallback::get_next_try()
for details.
ec | — error code which should be examined for retry ability. |
conn | — Connection object which should be closed in any case. |
std::optional<basic_try>
— initialized with basic_try object if retry is possible. std::nullopt
— retry is not possible due to ec
value or tries remain count. References ozo::failover::retry_options::close_connection, ozo::defer_close_connection(), ozo::get_option(), and ozo::failover::retry_options::on_retry.
|
constexpr |
Number of tries remains.
References ozo::get_option(), and ozo::failover::retry_options::tries.