PIBinaryLog joinBinLogsSerial

correct timestamp wite with split
This commit is contained in:
Бычков Андрей
2022-07-22 15:24:07 +03:00
parent 7aa407264f
commit f5953a0ba7
2 changed files with 106 additions and 31 deletions

View File

@@ -28,7 +28,10 @@
#include "pifile.h"
//! \ingroup IO
//! \~\brief
//! \~english Binary log
//! \~russian Бинарный лог
class PIP_EXPORT PIBinaryLog: public PIIODevice
{
PIIODEVICE(PIBinaryLog, "binlog")
@@ -165,6 +168,11 @@ public:
//! Set pause while playing via \a threadedRead or writing via write
void setPause(bool pause);
//! Set function wich returns new binlog file path when using split mode.
//! Overrides internal file path generator (logdir() + prefix() + current_time()).
//! To restore internal file path generator set this function to "nullptr".
void setFuncGetNewFilePath(std::function<PIString()> f) {f_new_path = f;}
//! Write one record to BinLog file, with ID = id, id must be greather than 0
int writeBinLog(int id, PIByteArray data) {return writeBinLog(id, data.data(), data.size_s());}
@@ -285,8 +293,13 @@ public:
//! Get binlog info and statistic
static BinLogInfo getLogInfo(const PIString & path);
//! Create new binlog from part of "src" with allowed IDs and "from" to "to" file position
static bool cutBinLog(const BinLogInfo & src, const PIString & dst, int from, int to);
//! Create new binlog from serial splitted binlogs "src"
static bool joinBinLogsSerial(const PIStringList & src, const PIString & dst);
protected:
PIString constructFullPathDevice() const;
void configureFromFullPathDevice(const PIString & full_path);
@@ -314,7 +327,7 @@ private:
BinLogRecord readRecord();
static void parseLog(PIFile *f, BinLogInfo *info, PIVector<BinLogIndex> * index);
void moveIndex(int i);
PIString getLogfilePath() const;
static PIString getLogfilePath(const PIString & log_dir, const PIString & prefix);
PIVector<BinLogIndex> index;
PIMap<llong, int> index_pos;
@@ -331,6 +344,7 @@ private:
int write_count, split_count, default_id, current_index;
bool is_started, is_thread_ok, is_indexed, rapid_start, is_pause;
PIByteArray user_header;
std::function<PIString()> f_new_path;
};
//! \relatesalso PICout \brief Output operator PIBinaryLog::BinLogInfo to PICout