Seastar
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.

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

Member Function Documentation

◆ close()

template<typename CharType >
future seastar::output_stream< CharType >::close
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.

◆ 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.

Exceptions
std::logic_errorif called on a used stream
Returns
the data_sink

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