template<std::size_t Size, typename Extra_Data_Factory = no_extra_data_factory_t>
class restinio::sync_chain::fixed_size_chain_t< Size, Extra_Data_Factory >
A holder of fixed-size chain of synchronous handlers.
- Note
- An instance of that type is intended to be filled with actual handlers at the creation time. After that new handlers can't be added to the chain, and old handlers can't be removed from the chain.
Usage example for the case when there is no extra-data in a request object.
};
{
...
}
{
...
}
{
...
}
on_thread_pool<my_traits>(16)
.address(...)
.port(...)
.request_handler(
headers_checker,
authentificator,
actual_handler )
);
A holder of fixed-size chain of synchronous handlers.
void run(asio_ns::io_context &ioctx, run_on_this_thread_settings_t< Traits > &&settings)
Helper function for running http server until ctrl+c is hit.
request_handling_status_t
Request handling status.
std::shared_ptr< request_t > request_handle_t
An alias for handle for incoming request without additional extra-data.
An instance of fixed_size_chain_t
can also be created manually and passed to server's settings by unique_ptr
:
auto chain = std::make_unique<restinio::fixed_size_chain_t<3>>(
headers_checker, authentificator, actual_handler);
...
restinio::run(
on_thread_pool<my_traits>(16)
.address(...)
.port(...)
);
Usage example for the case when some extra-data is incorporated into a request object.
struct my_extra_data_factory {
struct request_specific_fields_t {...};
struct user_info_t {...};
using data_t = std::tuple<request_specific_fields_t, user_info_t>;
}
};
using extra_data_factory_t = my_extra_data_factory;
3,
extra_data_factory>;
};
using my_request_handle_t =
const my_request_handle_t & req )
{
...
}
const my_request_handle_t & req )
{
...
}
const my_request_handle_t & req )
{
auto & field_values = std::get<my_extra_data_factory::request_specific_fields_t>(req->extra_data());
auto & user_info = std::get<my_extra_data_factory::user_info_t>(req->extra_data());
...
}
on_thread_pool<my_traits>(16)
.address(...)
.port(...)
.request_handler(
headers_checker,
authentificator,
actual_handler )
);
std::shared_ptr< generic_request_t< Extra_Data > > generic_request_handle_t
An alias for shared-pointer to incoming request.
- Template Parameters
-
Size | The exact number of handlers in the chain. |
Extra_Data_Factory | The type of extra-data-factory specified in the server's traits. |
- Since
- v.0.6.13
- Examples
- sample/chained_handlers/main.cpp.
Definition at line 163 of file fixed_size.hpp.