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.
};
{
...
}
{
...
}
{
...
}
.address(...)
.port(...)
.request_handler(
headers_checker,
authentificator,
actual_handler )
);
A holder of fixed-size chain of synchronous handlers.
run_on_thread_pool_settings_t< Traits > on_thread_pool(std::size_t pool_size)
A special marker for the case when http_server must be run on an thread pool.
std::shared_ptr< request_t > request_handle_t
An alias for handle for incoming request without additional extra-data.
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.
traits_t< asio_timer_manager_t, null_logger_t > default_traits_t
details::autodetect_request_handler_type request_handler_t
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::sync_chain::fixed_size_chain_t<3>>(
headers_checker, authentificator, actual_handler);
...
restinio::run(
.address(...)
.port(...)
.request_handler(std::move(chain))
);
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>;
}
};
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());
...
}
.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.
no_extra_data_factory_t extra_data_factory_t
- 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.