Seastar
High performance C++ framework for concurrent servers
|
Facilitates data buffering before it's handed over to data_sink.
When trim_to_size is true it's guaranteed that data sink will not receive chunks larger than the configured size, which could be the case when a single write call is made with data larger than the configured size.
The data sink will not receive empty chunks.
#include <seastar/core/iostream.hh>
Public Types | |
using | char_type = CharType |
using | batch_flush_list_t = bi::slist< output_stream, bi::constant_time_size< false >, bi::cache_last< true >, bi::member_hook< output_stream, bi::slist_member_hook<>, &output_stream::_in_poller > > |
Public Member Functions | |
output_stream (data_sink fd, size_t size, output_stream_options opts={}) noexcept | |
output_stream (data_sink fd, size_t size, bool trim_to_size, bool batch_flushes=false) noexcept | |
output_stream (data_sink fd) noexcept | |
output_stream (output_stream &&) noexcept=default | |
output_stream & | operator= (output_stream &&) noexcept=default |
future | write (const char_type *buf, size_t n) noexcept |
future | write (const char_type *buf) noexcept |
template<typename StringChar , typename SizeType , SizeType MaxSize, bool NulTerminate> | |
future | write (const basic_sstring< StringChar, SizeType, MaxSize, NulTerminate > &s) noexcept |
future | write (const std::basic_string< char_type > &s) noexcept |
future | write (net::packet p) noexcept |
future | write (scattered_message< char_type > msg) noexcept |
future | write (temporary_buffer< char_type >) noexcept |
future | flush () noexcept |
future | close () noexcept |
data_sink | detach () && |
|
noexcept |
Flushes the stream before closing it (and the underlying data sink) to any further writes. The resulting future must be waited on before destroying this object.
data_sink seastar::output_stream< CharType >::detach | ( | ) | && |
Detaches the underlying data_sink
from the output_stream
.
The intended usage is custom data_sink_impl
implementations wrapping an existing output_stream
, therefore it shouldn't be called on an output_stream
that was already used. After calling detach()
the output_stream
is in an unusable, moved-from state.
std::logic_error | if called on a used stream |