Files
sf_daq_buffer/sf-buffer/include/BufferBinaryWriter.hpp
T
babic_a 2bf658d30c Set the file size in advance on GPFS
When started to use the buffer on GPFS we notices an increase
of metadata access times on GPFS. To try to reduce the number
of metadata updates we set the file size at creation time.
2020-07-17 12:09:46 +02:00

37 lines
745 B
C++

#ifndef BINARYWRITER_HPP
#define BINARYWRITER_HPP
#include <string>
#include "formats.hpp"
class BufferBinaryWriter {
const size_t MAX_FILE_BYTES =
buffer_config::FILE_MOD * sizeof(BufferBinaryFormat);
const std::string root_folder_;
const std::string device_name_;
std::string latest_filename_;
std::string current_output_filename_;
int output_file_fd_;
void open_file(const std::string& filename);
void close_current_file();
public:
BufferBinaryWriter(
const std::string& root_folder,
const std::string& device_name);
virtual ~BufferBinaryWriter();
void write(const uint64_t pulse_id, const BufferBinaryFormat* buffer);
};
#endif //BINARYWRITER_HPP