RESTinio
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Member Functions | Friends | List of all members
restinio::async_chain::async_handling_controller_t< Extra_Data_Factory > Class Template Referenceabstract

Interface of a controller of an async chan. More...

#include <common.hpp>

Inheritance diagram for restinio::async_chain::async_handling_controller_t< Extra_Data_Factory >:
restinio::async_chain::fixed_size_chain_t< Size, Extra_Data_Factory >::actual_controller_t restinio::async_chain::growable_size_chain_t< Extra_Data_Factory >::actual_controller_t

Public Types

using actual_request_handle_t
 Short alias for request_handle type.
 
using actual_async_request_scheduler_t
 Short alias for async_request_scheduler type.
 
using actual_on_next_result_t
 Short alias for the result type of on_next method.
 

Public Member Functions

virtual ~async_handling_controller_t ()=default
 
virtual const actual_request_handle_trequest_handle () const noexcept=0
 Get reference to the source request.
 

Private Member Functions

virtual actual_on_next_result_t on_next ()=0
 Command to try find a next scheduler to be invoked.
 

Friends

template<typename Extra_Data_Factory_For_Next >
void next (unique_async_handling_controller_t< Extra_Data_Factory_For_Next > controller)
 

Detailed Description

template<typename Extra_Data_Factory>
class restinio::async_chain::async_handling_controller_t< Extra_Data_Factory >

Interface of a controller of an async chan.

All actual controllers have to implement this interface.

It's assumed that implementation of that interface won't be thread safe. It means that methods like request_handle() and on_next() must not be called in parallel.

Template Parameters
Extra_Data_FactoryType of factory for creation of extra data objects for every incoming request. Should be no_extra_data_factory_t if extra data for incoming requests is not needed.
Since
v.0.7.0

Definition at line 145 of file common.hpp.

Member Typedef Documentation

◆ actual_async_request_scheduler_t

Initial value:
run_on_this_thread_settings_t< Traits > on_this_thread()
A special marker for the case when http_server must be run on the context of the current thread.

Short alias for async_request_scheduler type.

Definition at line 158 of file common.hpp.

◆ actual_on_next_result_t

Initial value:

Short alias for the result type of on_next method.

Definition at line 162 of file common.hpp.

◆ actual_request_handle_t

Initial value:

Short alias for request_handle type.

Definition at line 154 of file common.hpp.

Constructor & Destructor Documentation

◆ ~async_handling_controller_t()

Member Function Documentation

◆ on_next()

Command to try find a next scheduler to be invoked.

Implementation of async_handling_controller_t should switch to the next scheduler in the chain and return the scheduler to be called next. If there are no such schedulers, no_more_schedulers_t must be returned.

Note
This method is intended to be called by next() function.

Implemented in restinio::async_chain::fixed_size_chain_t< Size, Extra_Data_Factory >::actual_controller_t, and restinio::async_chain::growable_size_chain_t< Extra_Data_Factory >::actual_controller_t.

◆ request_handle()

Get reference to the source request.

Usage example:

{
// Get access to the source request.
const auto req = controller->request_handle();
if( restinio::http_method_get() == req->header().method() )
{
...
}
}
constexpr schedule_result_t ok() noexcept
Helper function to be used if scheduling was successful.
Definition common.hpp:49
schedule_result_t
Type for return value of a scheduler in a chain.
Definition common.hpp:25
std::unique_ptr< async_handling_controller_t< Extra_Data_Factory > > unique_async_handling_controller_t
Short alias for unique_ptr to async_handling_controller.
Definition common.hpp:84

Implemented in restinio::async_chain::fixed_size_chain_t< Size, Extra_Data_Factory >::actual_controller_t, and restinio::async_chain::growable_size_chain_t< Extra_Data_Factory >::actual_controller_t.

Friends And Related Symbol Documentation

◆ next


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