39 void write_out(
const void* p, std::size_t n);
40 void compress(std::string_view data,
bool end);
41 std::FILE* f_ =
nullptr;
42 ::ZSTD_CCtx_s* cctx_ =
nullptr;
44 std::size_t frame_in_ = 0;
45 std::uint64_t in_ = 0;
63 std::FILE* f_ =
nullptr;
64 ::ZSTD_DCtx_s* dctx_ =
nullptr;
66 std::size_t in_pos_ = 0, in_len_ = 0;
70 bool out_pending_ =
false;
ReplayReader(const ReplayReader &)=delete
bool next_line(std::string &line)
Next complete line (without '\n').
ReplayReader & operator=(const ReplayReader &)=delete
ReplayReader(const std::string &path)
Detects zstd by its magic number, so a renamed file still reads. Throws if the file cannot be opened.
static constexpr std::size_t kFrameBytes
Uncompressed bytes per zstd frame before it is closed: big enough for full compression ratio,...
void close()
ends the last frame and closes the file; called by the destructor
std::uint64_t bytes_in() const
ReplayWriter(const ReplayWriter &)=delete
void write_line(std::string_view line)
appends '\n'
ReplayWriter(const std::string &path, int level=6)
Compresses when path ends in ".zst". Throws std::runtime_error if the file cannot be created.
static bool compressed_path(std::string_view path)
void end_frame()
closes the current zstd frame (no-op when plain or empty)
ReplayWriter & operator=(const ReplayWriter &)=delete