#include <ozo/core/concept.h>
Handler concept.
Handler is a function or a functor which is used as a callback for handling result of asynchronous IO operations in the library.
In case of function it has to have this signature:
In case of functor it has to have such operator():
In case of lambda:
Handler has to handle an ozo::error_code object as first argument, and the Connection implementation object as a second one. It is better to define second argument as a template parameter because the implementation depends on a numerous of compile-time options but if it is really needed - real type can be obtained with ozo::connection_type.
Handler has to be invoked according to ec state:
Connection should be in good state and can be used for an operation.ec contains error, Connection could be in these states:Connection is in null-state — ozo::is_null_recursive() returns true, object is useless;Connection is in bad state — ozo::is_null_recursive() returns false, ozo::connection_bad() returns true or ozo::get_transaction_status() returns not ozo::transaction_status::idle, object may not be used for further operations but it may provide additional error context via ozo::error_message() and ozo::get_error_context() functions.Connection is in good state — ozo::is_null_recursive() returns false, ozo::connection_bad() returns true and ozo::get_transaction_status() returns ozo::transaction_status::idle, object may be used for further operations and may provide additional error context via ozo::error_message() and ozo::get_error_context() functions.