libtasks Documentation
1.6
|
#include <uwsgi_thrift_async_handler.h>
Public Types | |
using | handler_finish_func_t = std::function< void()> |
using | result_t = thrift_result_type |
using | args_t = thrift_args_type |
Public Member Functions | |
virtual | ~uwsgi_thrift_async_handler () |
virtual void | service (std::shared_ptr< args_t > args)=0 |
virtual std::string | service_name () const =0 |
result_t & | result_base () |
Return a reference to the thrift result base object. More... | |
auto | result () -> decltype((m_result.success)) |
Return a reference to the thrift result object. A thrift handler uses this to return data. More... | |
void | set_uwsgi_task (uwsgi_task *t) |
The uwsgi_thrift_async_processor uses this method to assign the underlying uwsgi_task object. More... | |
void | on_finish (handler_finish_func_t f) |
![]() | |
error_base () | |
virtual | ~error_base () |
bool | error () const |
Return true if an error occured. More... | |
tasks_error | error_code () const |
Return the error code. More... | |
const std::string & | error_message () const |
Return the error message. More... | |
int | sys_errno () const |
Return the errno if available. More... | |
std::string | sys_errno_str () const |
Return the errno description if available. More... | |
const tasks_exception & | exception () const |
Return the underlying exception object. More... | |
void | set_exception (tasks_exception &e) |
Set an exception to report an error. More... | |
void | reset_error () |
Reset the error state. More... | |
Protected Member Functions | |
const uwsgi_request & | request () const |
const uwsgi_request * | request_p () const |
http_response & | response () |
http_response * | response_p () |
void | finish () |
Async handlers call this method to trigger the processor callback. More... | |
void | set_error (std::string msg) |
Report an error. More... | |
Private Attributes | |
result_t | m_result |
uwsgi_task * | m_uwsgi_task = nullptr |
handler_finish_func_t | m_finish_func |
The base class for asynchronous thrift handlers. The two template arguments have to match the thrift generated types. A handler also has to implement a service and a service_name method. See below.
Definition at line 23 of file uwsgi_thrift_async_handler.h.
using tasks::net::uwsgi_thrift_async_handler< thrift_result_type, thrift_args_type >::args_t = thrift_args_type |
Definition at line 27 of file uwsgi_thrift_async_handler.h.
using tasks::net::uwsgi_thrift_async_handler< thrift_result_type, thrift_args_type >::handler_finish_func_t = std::function<void()> |
Definition at line 25 of file uwsgi_thrift_async_handler.h.
using tasks::net::uwsgi_thrift_async_handler< thrift_result_type, thrift_args_type >::result_t = thrift_result_type |
Definition at line 26 of file uwsgi_thrift_async_handler.h.
|
inlinevirtual |
Definition at line 57 of file uwsgi_thrift_async_handler.h.
|
inlineprotected |
Async handlers call this method to trigger the processor callback.
Definition at line 48 of file uwsgi_thrift_async_handler.h.
|
inline |
Set a finish callback. This is used by the uwsgi_thrift_async_processor to get notified when an async operation has finished and the thrift result set can be send back to the caller.
f | The callback function |
Definition at line 81 of file uwsgi_thrift_async_handler.h.
|
inlineprotected |
Definition at line 36 of file uwsgi_thrift_async_handler.h.
|
inlineprotected |
Definition at line 39 of file uwsgi_thrift_async_handler.h.
|
inlineprotected |
Definition at line 42 of file uwsgi_thrift_async_handler.h.
|
inlineprotected |
Definition at line 45 of file uwsgi_thrift_async_handler.h.
|
inline |
Return a reference to the thrift result object. A thrift handler uses this to return data.
Definition at line 72 of file uwsgi_thrift_async_handler.h.
|
inline |
Return a reference to the thrift result base object.
Definition at line 69 of file uwsgi_thrift_async_handler.h.
|
pure virtual |
The service method will be called by the processor after a new thrift message has been deserialized.
args | A pointer to the arguments of the thrift service method. |
Implemented in ip_service_async2, and ip_service_async1.
|
pure virtual |
Implemented in ip_service_async2, and ip_service_async1.
|
inlineprotected |
Report an error.
Definition at line 51 of file uwsgi_thrift_async_handler.h.
|
inline |
The uwsgi_thrift_async_processor uses this method to assign the underlying uwsgi_task object.
Definition at line 75 of file uwsgi_thrift_async_handler.h.
|
private |
Definition at line 32 of file uwsgi_thrift_async_handler.h.
|
private |
Definition at line 30 of file uwsgi_thrift_async_handler.h.
|
private |
Definition at line 31 of file uwsgi_thrift_async_handler.h.