Failover microframwork strategy extention interface.
Classes | |
struct | ozo::failover::basic_context< ConnectionProvider, TimeConstraint, Args > |
Basic operation context. More... | |
Functions | |
template<typename FailoverStrategy , typename Operation , typename Allocator , typename ... Args> | |
auto | ozo::failover::get_first_try (const Operation &op, const FailoverStrategy &strategy, const Allocator &alloc, Args &&...args) |
Get the first try object for an operation. More... | |
template<typename FailoverTry > | |
auto | ozo::failover::get_try_context (const FailoverTry &a_try) |
Get operation context for the try. More... | |
template<typename Try , typename Connection > | |
auto | ozo::failover::get_next_try (Try &a_try, const error_code &ec, Connection &conn) |
Get the next try object. More... | |
template<typename Try , typename Connection , typename Initiator > | |
auto | ozo::failover::initiate_next_try (Try &a_try, const error_code &ec, Connection &conn, Initiator &&init) |
Initiates the next try of an operation execution. More... | |
Variables | |
template<typename T > | |
constexpr auto | ozo::FailoverStrategy |
FailoverStrategy concept. More... | |
template<typename T > | |
constexpr auto | ozo::FailoverTry |
FailoverTry concept. More... | |
auto ozo::failover::get_first_try | ( | const Operation & | op, |
const FailoverStrategy & | strategy, | ||
const Allocator & | alloc, | ||
Args &&... | args | ||
) |
Get the first try object for an operation.
This function is a part of failover strategy interface. It creates the first try of operation execution context. The context data should be allocated via the specified allocator. This function would be called once during a failover operation execution. By default #FailoverStrategy should have get_first_try(const Operation& op, const Allocator& alloc, Args&& ...args) const
member function.
op | — operation for which the try object should be created. |
strategy | — strategy according to which the try object should be created. |
alloc | — allocator for try object. |
args | — operation arguments except CompletionToken. |
This function may be customized for a #FailoverStrategy via specialization of ozo::failover::get_first_try_impl
. E.g.:
auto ozo::failover::get_next_try | ( | Try & | a_try, |
const error_code & | ec, | ||
Connection & | conn | ||
) |
Get the next try object.
Return #FailoverTry for next failover try if it possible. By default it calls a_try.get_next_try(ec, conn)
. This behavior customisable via ozo::failover::get_next_try_impl
specialization. It will be used by default if no ozo::failover::initiate_next_try
customization had been made.
a_try | — current #FailoverTry object. |
ec | — current try error code. |
conn | — current #connection object. |
This function may be customized for a #FailoverTry via specialization of ozo::failover::get_next_try_impl
. E.g.:
References ozo::unwrap().
auto ozo::failover::get_try_context | ( | const FailoverTry & | a_try | ) |
Get operation context for the try.
By default #FailoverTry object should have get_context() const
member function.
a_try | — #FailoverTry object |
This function may be customized for a #FailoverTry via specialization of ozo::failover::get_try_context_impl
. E.g.:
References ozo::unwrap().
auto ozo::failover::initiate_next_try | ( | Try & | a_try, |
const error_code & | ec, | ||
Connection & | conn, | ||
Initiator && | init | ||
) |
Initiates the next try of an operation execution.
This mechanism supports static polymorphism of tries depended on error conditions. Unlike ozo::failover::get_next_try()
it allows to use different types of try-objects for different error conditions.
Function implementation should call initiator in case of operation with given error condition may be recovered by try-object is given to initiator. Or should not call initiator in case of an unrecoverable error condition.
a_try | — current #FailoverTry object. |
ec | — current try error code. |
conn | — current #connection object. |
init | — initiator of an operation execution, functional object with signature void(auto try) |
This function may be customized for a #FailoverTry via specialization of ozo::failover::initiate_next_try_impl
. E.g. default implementation may look like this:
References ozo::unwrap().
|
constexpr |
FailoverStrategy concept.
Failover strategy defines interface for the failover framework extention. FailoverStrategy
should be a factory for the first #FailoverTry.
|
constexpr |
FailoverTry concept.
Failover try defines interface for a single operation execution try and possible next failover try.