TraceMaker
C++ API of the engine
Loading...
Searching...
No Matches
tmk::server::ReplayWriter Class Reference

#include <server/replay_log.hpp>

Public Member Functions

 ReplayWriter (const std::string &path, int level=6)
 Compresses when path ends in ".zst". Throws std::runtime_error if the file cannot be created.
 ~ReplayWriter ()
 ReplayWriter (const ReplayWriter &)=delete
ReplayWriter & operator= (const ReplayWriter &)=delete
bool compressed () const
void write_line (std::string_view line)
 appends '\n'
void end_frame ()
 closes the current zstd frame (no-op when plain or empty)
void close ()
 ends the last frame and closes the file; called by the destructor
std::uint64_t bytes_in () const

Static Public Member Functions

static bool compressed_path (std::string_view path)

Static Public Attributes

static constexpr std::size_t kFrameBytes = 1u << 20
 Uncompressed bytes per zstd frame before it is closed: big enough for full compression ratio, small enough that a crash loses little.

Detailed Description

Definition at line 19 of file replay_log.hpp.

Constructor & Destructor Documentation

◆ ReplayWriter() [1/2]

tmk::server::ReplayWriter::ReplayWriter ( const std::string & path,
int level = 6 )
explicit

Compresses when path ends in ".zst". Throws std::runtime_error if the file cannot be created.

◆ ~ReplayWriter()

tmk::server::ReplayWriter::~ReplayWriter ( )

◆ ReplayWriter() [2/2]

tmk::server::ReplayWriter::ReplayWriter ( const ReplayWriter & )
delete

Member Function Documentation

◆ bytes_in()

std::uint64_t tmk::server::ReplayWriter::bytes_in ( ) const
inline

Definition at line 36 of file replay_log.hpp.

◆ close()

void tmk::server::ReplayWriter::close ( )

ends the last frame and closes the file; called by the destructor

◆ compressed()

bool tmk::server::ReplayWriter::compressed ( ) const
inline

Definition at line 32 of file replay_log.hpp.

◆ compressed_path()

bool tmk::server::ReplayWriter::compressed_path ( std::string_view path)
static

◆ end_frame()

void tmk::server::ReplayWriter::end_frame ( )

closes the current zstd frame (no-op when plain or empty)

◆ operator=()

ReplayWriter & tmk::server::ReplayWriter::operator= ( const ReplayWriter & )
delete

◆ write_line()

void tmk::server::ReplayWriter::write_line ( std::string_view line)

appends '\n'

Member Data Documentation

◆ kFrameBytes

std::size_t tmk::server::ReplayWriter::kFrameBytes = 1u << 20
staticconstexpr

Uncompressed bytes per zstd frame before it is closed: big enough for full compression ratio, small enough that a crash loses little.

Definition at line 23 of file replay_log.hpp.


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