IQ.Pilot Release Commit @ b6534c0
This commit is contained in:
29
iqpilot/system/loggerd/zstd_writer.h
Normal file
29
iqpilot/system/loggerd/zstd_writer.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include <zstd.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <capnp/common.h>
|
||||
|
||||
class ZstdFileWriter {
|
||||
public:
|
||||
ZstdFileWriter(const std::string &filename, int compression_level);
|
||||
~ZstdFileWriter();
|
||||
void write(void* data, size_t size);
|
||||
inline void write(kj::ArrayPtr<capnp::byte> array) { write(array.begin(), array.size()); }
|
||||
void durable_flush(bool force);
|
||||
|
||||
private:
|
||||
void flushCache(ZSTD_EndDirective mode);
|
||||
|
||||
size_t input_cache_capacity_ = 0;
|
||||
std::vector<char> input_cache_;
|
||||
std::vector<char> output_buffer_;
|
||||
ZSTD_CStream *cstream_;
|
||||
FILE* file_ = nullptr;
|
||||
off_t wb_synced_ = 0; // io_writeback.h cursors
|
||||
off_t wb_dropped_ = 0;
|
||||
double last_durable_ms_ = 0.; // io_writeback.h durable-checkpoint cursor
|
||||
};
|
||||
Reference in New Issue
Block a user