Seastar
High performance C++ framework for concurrent servers
Classes | Namespaces | Functions
fstream.hh File Reference
#include <seastar/core/file.hh>
#include <seastar/core/iostream.hh>
#include <seastar/core/shared_ptr.hh>
#include <seastar/core/internal/api-level.hh>

Go to the source code of this file.

Classes

class  seastar::file_input_stream_history
 
struct  seastar::file_input_stream_options
 Data structure describing options for opening a file input stream. More...
 
struct  seastar::file_output_stream_options
 

Namespaces

 seastar
 Seastar API namespace.
 

Functions

input_stream< char > seastar::make_file_input_stream (file file, uint64_t offset, uint64_t len, file_input_stream_options options={})
 Creates an input_stream to read a portion of a file. More...
 
input_stream< char > seastar::make_file_input_stream (file file, uint64_t offset, file_input_stream_options={})
 
input_stream< char > seastar::make_file_input_stream (file file, file_input_stream_options={})
 
output_stream< char > seastar::api_v2::make_file_output_stream (file file, uint64_t buffer_size=8192)
 
output_stream< char > seastar::api_v2::make_file_output_stream (file file, file_output_stream_options options)
 
data_sink seastar::api_v2::make_file_data_sink (file, file_output_stream_options)
 
future< output_stream< char > > seastar::api_v3::make_file_output_stream (file file, uint64_t buffer_size=8192) noexcept
 
future< output_stream< char > > seastar::api_v3::make_file_output_stream (file file, file_output_stream_options options) noexcept
 
future< data_sink > seastar::api_v3::make_file_data_sink (file, file_output_stream_options) noexcept
 

Class Documentation

◆ seastar::file_input_stream_options

struct seastar::file_input_stream_options
Class Members
size_t buffer_size I/O buffer size.
lw_shared_ptr< file_input_stream_history > dynamic_adjustments Input stream history, if null dynamic adjustments are disabled.
::io_priority_class io_priority_class
unsigned read_ahead Maximum number of extra read-ahead operations.

◆ seastar::file_output_stream_options

struct seastar::file_output_stream_options
Class Members
unsigned buffer_size
::io_priority_class io_priority_class
unsigned preallocation_size Preallocate extents. For large files, set to a large number (a few megabytes) to reduce fragmentation.
unsigned write_behind Number of buffers to write in parallel.

Function Documentation

◆ make_file_data_sink() [1/2]

data_sink seastar::api_v2::make_file_data_sink ( file  ,
file_output_stream_options   
)

Create a data_sink for writing starting at the position zero of a newly created file.

◆ make_file_data_sink() [2/2]

future<data_sink> seastar::api_v3::and_newer::make_file_data_sink ( file  ,
file_output_stream_options   
)
noexcept

Create a data_sink for writing starting at the position zero of a newly created file. Closes the file if the sink creation fails.

◆ make_file_output_stream() [1/4]

output_stream<char> seastar::api_v2::make_file_output_stream ( file  file,
file_output_stream_options  options 
)

Create an output_stream for writing starting at the position zero of a newly created file. NOTE: flush() should be the last thing to be called on a file output stream.

◆ make_file_output_stream() [2/4]

future<output_stream<char> > seastar::api_v3::and_newer::make_file_output_stream ( file  file,
file_output_stream_options  options 
)
noexcept

Create an output_stream for writing starting at the position zero of a newly created file. NOTE: flush() should be the last thing to be called on a file output stream. Closes the file if the stream creation fails.

◆ make_file_output_stream() [3/4]

output_stream<char> seastar::api_v2::make_file_output_stream ( file  file,
uint64_t  buffer_size = 8192 
)

Create an output_stream for writing starting at the position zero of a newly created file. NOTE: flush() should be the last thing to be called on a file output stream.

Examples
file_demo.cc.

◆ make_file_output_stream() [4/4]

future<output_stream<char> > seastar::api_v3::and_newer::make_file_output_stream ( file  file,
uint64_t  buffer_size = 8192 
)
noexcept

Create an output_stream for writing starting at the position zero of a newly created file. NOTE: flush() should be the last thing to be called on a file output stream. Closes the file if the stream creation fails.