libtasks Documentation  1.6
tasks::net::uwsgi_task Class Referenceabstract

The base class for the uwsgi protocol implementation. More...

#include <uwsgi_task.h>

Inheritance diagram for tasks::net::uwsgi_task:
Collaboration diagram for tasks::net::uwsgi_task:

Public Member Functions

 uwsgi_task (net::socket &sock)
 
virtual ~uwsgi_task ()
 
bool handle_event (tasks::worker *worker, int revents)
 
virtual bool handle_request ()=0
 
uwsgi_requestrequest ()
 
const uwsgi_requestrequest () const
 
uwsgi_requestrequest_p ()
 
const uwsgi_requestrequest_p () const
 
http_responseresponse ()
 
const http_responseresponse () const
 
http_responseresponse_p ()
 
const http_responseresponse_p () const
 
void send_response ()
 Send the resonse back. More...
 
- Public Member Functions inherited from tasks::net_io_task
 net_io_task (int events)
 
 net_io_task (net::socket &socket, int events)
 
virtual ~net_io_task ()
 
std::string get_string () const
 A debug helper. More...
 
net::socketsocket ()
 Provide access to the underlying socket object. More...
 
const net::socketsocket () const
 Provide const access to the underlying socket object. More...
 
- Public Member Functions inherited from tasks::io_task_base
 io_task_base (int events)
 
virtual ~io_task_base ()
 
std::string get_string () const
 
int events () const
 Return the monitored events. More...
 
ev_io * watcher () const
 Return the io watcher object. More...
 
virtual void init_watcher ()
 Initialize the watcher. More...
 
virtual void start_watcher (worker *worker)
 Start a watcher in the context of the given worker. More...
 
virtual void stop_watcher (worker *worker)
 Stop a watcher in the context of the given worker. More...
 
virtual void update_watcher (worker *worker)
 Udate a watcher in the context of the given worker. More...
 
virtual void dispose (worker *worker)
 Stop the watcher before being deleted. More...
 
- Public Member Functions inherited from tasks::event_task
virtual ~event_task ()
 
workerassigned_worker () const
 Returns a pointer to the assigned worker. More...
 
void assign_worker (worker *worker)
 
void notify_error (worker *worker=nullptr)
 
void on_error (error_func_worker_t f)
 
void on_error (error_func_void_t f)
 Install an error callback. More...
 
- Public Member Functions inherited from tasks::task
virtual ~task ()
 
bool auto_delete () const
 Returns true if auto deletion is active. More...
 
void disable_auto_delete ()
 Call this to deactivate auto deletion. More...
 
void finish (worker *worker=nullptr)
 Called by a worker when a task has auto_deletion enabled. More...
 
void on_finish (finish_func_worker_t f)
 
void on_finish (finish_func_void_t f)
 
- Public Member Functions inherited from tasks::error_base
 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_exceptionexception () 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...
 
- Public Member Functions inherited from tasks::disposable
 disposable ()
 
virtual ~disposable ()
 
bool can_dispose () const
 Check if a task can be disposed or not. More...
 
void disable_dispose ()
 Mark a task for being not disposable. More...
 
void enable_dispose ()
 Mark a task for being disposable. More...
 

Protected Member Functions

void finish_request ()
 Called after a request has been responded. More...
 
- Protected Member Functions inherited from tasks::net_io_task
void add_task (worker *worker, net_io_task *task)
 
io_baseiob ()
 Grant socket access to the io_task_base. More...
 
const io_baseiob () const
 Grant const socket access to the io_task_base. More...
 
void disable_auto_close ()
 Disable automatic closing of the socket in the desctructor. More...
 
- Protected Member Functions inherited from tasks::io_task_base
void set_events (int events)
 Update the events the object monitors. More...
 

Protected Attributes

uwsgi_request m_request
 
http_response m_response
 

Additional Inherited Members

- Public Types inherited from tasks::event_task
typedef std::function< void(worker
*worker, const tasks_exception
&e)> 
error_func_worker_t
 
typedef std::function< void(const
tasks_exception &e)> 
error_func_void_t
 
- Public Types inherited from tasks::task
typedef std::function< void(worker
*worker)> 
finish_func_worker_t
 
typedef std::function< void()> finish_func_void_t
 
- Static Public Member Functions inherited from tasks::net_io_task
static void add_task (net_io_task *task)
 

Detailed Description

The base class for the uwsgi protocol implementation.

Definition at line 30 of file uwsgi_task.h.

Constructor & Destructor Documentation

tasks::net::uwsgi_task::uwsgi_task ( net::socket sock)
inline

Definition at line 32 of file uwsgi_task.h.

virtual tasks::net::uwsgi_task::~uwsgi_task ( )
inlinevirtual

Definition at line 33 of file uwsgi_task.h.

Member Function Documentation

void tasks::net::uwsgi_task::finish_request ( )
inlineprotected

Called after a request has been responded.

Definition at line 79 of file uwsgi_task.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool tasks::net::uwsgi_task::handle_event ( tasks::worker worker,
int  revents 
)
virtual

Will be called for each I/O or timer event.

Each task needs to implement the handle_event method. Returns true if the task stays active and false otherwise. The task will be deleted if false is returned and auto_delete() returns true.

Parameters
workerThe worker thread executing the task.
eventsThe events bitmask.
Returns
True to continue execution. False to remove the task.

Implements tasks::event_task.

Definition at line 16 of file uwsgi_task.cpp.

Here is the call graph for this function:

virtual bool tasks::net::uwsgi_task::handle_request ( )
pure virtual

A uwsgi request handler needs to implement this. This method gets called after a uwsgi request has been deserialized successfully.

Implemented in tasks::net::uwsgi_thrift_async_processor< handler_type >, tasks::net::uwsgi_thrift_processor< processor_type, handler_type >, uwsgi_handler, and uwsgi_handler.

Here is the caller graph for this function:

uwsgi_request& tasks::net::uwsgi_task::request ( )
inline
Returns
A reference to the underlying request object.

Definition at line 43 of file uwsgi_task.h.

Here is the caller graph for this function:

const uwsgi_request& tasks::net::uwsgi_task::request ( ) const
inline
Returns
A const reference to the underlying request object.

Definition at line 46 of file uwsgi_task.h.

uwsgi_request* tasks::net::uwsgi_task::request_p ( )
inline
Returns
A pointer to the underlying request onject.

Definition at line 49 of file uwsgi_task.h.

Here is the caller graph for this function:

const uwsgi_request* tasks::net::uwsgi_task::request_p ( ) const
inline
Returns
A const pointer to the underlying request onject.

Definition at line 52 of file uwsgi_task.h.

http_response& tasks::net::uwsgi_task::response ( )
inline
Returns
A reference to the underlying response object.

Definition at line 55 of file uwsgi_task.h.

Here is the caller graph for this function:

const http_response& tasks::net::uwsgi_task::response ( ) const
inline
Returns
A const reference to the underlying response object.

Definition at line 58 of file uwsgi_task.h.

http_response* tasks::net::uwsgi_task::response_p ( )
inline
Returns
A pointer to the underlying response onject.

Definition at line 61 of file uwsgi_task.h.

Here is the caller graph for this function:

const http_response* tasks::net::uwsgi_task::response_p ( ) const
inline
Returns
A const pointer to the underlying response onject.

Definition at line 64 of file uwsgi_task.h.

void tasks::net::uwsgi_task::send_response ( )
inline

Send the resonse back.

Definition at line 67 of file uwsgi_task.h.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

uwsgi_request tasks::net::uwsgi_task::m_request
protected

Definition at line 75 of file uwsgi_task.h.

http_response tasks::net::uwsgi_task::m_response
protected

Definition at line 76 of file uwsgi_task.h.


The documentation for this class was generated from the following files: