RESTinio
|
Helper class for writting response data. More...
#include <write_group_output_ctx.hpp>
Classes | |
class | file_write_operation_t |
Write operaton using sendfile. More... | |
struct | none_write_operation_t |
None write operation. More... | |
class | trivial_write_operation_t |
Trivial write operaton. More... | |
Public Types | |
using | solid_write_operation_variant_t = variant_t< none_write_operation_t, trivial_write_operation_t, file_write_operation_t > |
An alias for variant holding write operation specifics. More... | |
Public Member Functions | |
write_group_output_ctx_t () | |
Contruct an object. More... | |
bool | transmitting () const noexcept |
Check if data is trunsmitting now. More... | |
void | start_next_write_group (optional_t< write_group_t > next_wg) noexcept |
Start handlong next write group. More... | |
solid_write_operation_variant_t | extract_next_write_operation () |
et an object with next write operation to perform. More... | |
void | fail_write_group (const asio_ns::error_code &ec) |
Handle current group write process failed. More... | |
void | finish_write_group () |
Finish writing group normally. More... | |
Private Member Functions | |
void | reset_write_group () |
Reset the write group and associated context. More... | |
void | invoke_after_write_notificator_if_necessary (const asio_ns::error_code &ec) |
Execute notification callback if necessary. More... | |
trivial_write_operation_t | prepare_trivial_buffers_wo () |
Prepare write operation for trivial buffers. More... | |
file_write_operation_t | prepare_sendfile_wo () |
Prepare write operation for sendfile. More... | |
Static Private Member Functions | |
static constexpr auto | max_iov_len () noexcept |
Get the maximum number of buffers that can be written with gather write operation. More... | |
Private Attributes | |
optional_t< write_group_t > | m_current_wg |
Real buffers with data. More... | |
std::size_t | m_next_writable_item_index { 0 } |
Keeps track of the next writable item stored in m_current_wg. More... | |
asio_bufs_container_t | m_asio_bufs |
Asio buffers storage. More... | |
sendfile_operation_shared_ptr_t | m_sendfile_operation |
Sendfile operation storage context. More... | |
Helper class for writting response data.
The usage scenario is some kind of the following:
Of course, the real usage is complicated by spreading in time and running plenty of other logic cooperatively.
Definition at line 79 of file write_group_output_ctx.hpp.
using restinio::impl::write_group_output_ctx_t::solid_write_operation_variant_t = variant_t< none_write_operation_t, trivial_write_operation_t, file_write_operation_t > |
An alias for variant holding write operation specifics.
Definition at line 245 of file write_group_output_ctx.hpp.
|
inline |
Contruct an object.
Definition at line 96 of file write_group_output_ctx.hpp.
|
inline |
et an object with next write operation to perform.
Definition at line 253 of file write_group_output_ctx.hpp.
|
inline |
Handle current group write process failed.
Definition at line 283 of file write_group_output_ctx.hpp.
|
inline |
Finish writing group normally.
Definition at line 294 of file write_group_output_ctx.hpp.
|
inlineprivate |
Execute notification callback if necessary.
Definition at line 313 of file write_group_output_ctx.hpp.
|
inlinestaticconstexprprivatenoexcept |
Get the maximum number of buffers that can be written with gather write operation.
Definition at line 84 of file write_group_output_ctx.hpp.
|
inlineprivate |
Prepare write operation for sendfile.
Definition at line 358 of file write_group_output_ctx.hpp.
|
inlineprivate |
Prepare write operation for trivial buffers.
Definition at line 334 of file write_group_output_ctx.hpp.
|
inlineprivate |
Reset the write group and associated context.
Definition at line 305 of file write_group_output_ctx.hpp.
|
inlinenoexcept |
Start handlong next write group.
Definition at line 239 of file write_group_output_ctx.hpp.
|
inlinenoexcept |
Check if data is trunsmitting now.
Definition at line 235 of file write_group_output_ctx.hpp.
|
private |
Asio buffers storage.
Definition at line 377 of file write_group_output_ctx.hpp.
|
private |
Real buffers with data.
Definition at line 367 of file write_group_output_ctx.hpp.
|
private |
Keeps track of the next writable item stored in m_current_wg.
When emitting next solid write operation we need to know where the next starting item is.
Definition at line 374 of file write_group_output_ctx.hpp.
|
private |
Sendfile operation storage context.
Definition at line 380 of file write_group_output_ctx.hpp.