High performance C++ framework for concurrent servers
Public Types | Public Member Functions | List of all members
seastar::output_stream< CharType > Class Template Referencefinal

Detailed Description

template<typename CharType>
class seastar::output_stream< CharType >

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.

All methods must be called sequentially. That is, no method may be invoked before the previous method's returned future is resolved.

#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_streamoperator= (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 () &&

Member Function Documentation

◆ close()

template<typename CharType >
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.

◆ detach()

template<typename CharType >
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_errorif called on a used stream
the data_sink

The documentation for this class was generated from the following files: