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 |
Public Member Functions | |
output_stream (data_sink fd, size_t size, bool trim_to_size=false, bool batch_flushes=false) noexcept | |
output_stream (output_stream &&) noexcept=default | |
output_stream & | operator= (output_stream &&) noexcept=default |
future | write (const char_type *buf, size_t n) |
future | write (const char_type *buf) |
template<typename StringChar , typename SizeType , SizeType MaxSize, bool NulTerminate> | |
future | write (const basic_sstring< StringChar, SizeType, MaxSize, NulTerminate > &s) |
future | write (const std::basic_string< char_type > &s) |
future | write (net::packet p) |
future | write (scattered_message< char_type > msg) |
future | write (temporary_buffer< char_type >) |
future | flush () |
future | close () |
data_sink | detach () && |
future seastar::output_stream< CharType >::close |
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 |