OZO 「お象」
Boost.Asio and libpq based asynchronous PostgreSQL unofficial header-only C++17 client library.

Description

Failover by simple retry operation.

Classes

struct  ozo::failover::retry_options
 Options for retry. More...
 
class  ozo::failover::basic_try< Options, Context >
 Operation try representation. More...
 
class  ozo::failover::retry_strategy< Options >
 Retry strategy. More...
 

Functions

template<typename ... ErrorConditions>
constexpr auto ozo::failover::retry (ErrorConditions ...ec)
 

Function Documentation

◆ retry()

template<typename ... ErrorConditions>
constexpr auto ozo::failover::retry ( ErrorConditions ...  ec)
constexpr

Retry on specified error conditions.

Parameters
ec— variadic of error conditions to retry
Returns
ozo::failover::retry_strategy specialization.

Example

Retry on a network problem and operation timed-out no more than 3 tries. Each try has own time constraint calculated from total operation time constraint. See ozo::failover::retry_strategy::tries() for time constraint details.

auto retry = failover::retry(errc::connection_error, errc::timeout)*3;
ozo::request[retry](pool, query, .5s, out, yield);
See also
ozo::failover::retry_strategy

References ozo::failover::retry_options::conditions, and ozo::options_factory_base< RealType, Options >::set().

ozo::request
decltype(auto) request(ConnectionProvider &&provider, BinaryQueryConvertible &&query, TimeConstraint time_constraint, Out out, CompletionToken &&token)
Executes query and retrives a result from a database with time constraint.
ozo::errc::connection_error
@ connection_error
connection-related error condition, incorporates ozo, libpq and Boost.Asio connection errors
Definition: error.h:399
ozo::failover::retry
constexpr auto retry(ErrorConditions ...ec)
Definition: retry.h:308