Add support for rotated log files
We want to be able to chunk log files. This adds read support for
chunking. Write support is only added to enable testing, and needs more
configuration to be useful.
Change-Id: I0c7bc9980438a934ac0f2692ef06caf2605bbc88
diff --git a/aos/events/logging/logger.h b/aos/events/logging/logger.h
index be9ea36..337109b 100644
--- a/aos/events/logging/logger.h
+++ b/aos/events/logging/logger.h
@@ -25,7 +25,13 @@
std::chrono::milliseconds polling_period =
std::chrono::milliseconds(100));
+ // Rotates the log file with the new writer. This writes out the header
+ // again, but keeps going as if nothing else happened.
+ void Rotate(DetachedBufferWriter *writer);
+
private:
+ void WriteHeader();
+
void DoLogData();
EventLoop *event_loop_;
@@ -51,6 +57,9 @@
// Last time that data was written for all channels to disk.
monotonic_clock::time_point last_synchronized_time_;
+ monotonic_clock::time_point monotonic_start_time_;
+ realtime_clock::time_point realtime_start_time_;
+
// Max size that the header has consumed. This much extra data will be
// reserved in the builder to avoid reallocating.
size_t max_header_size_ = 0;
@@ -65,6 +74,8 @@
// config did.
LogReader(std::string_view filename,
const Configuration *replay_configuration = nullptr);
+ LogReader(const std::vector<std::string> &filename,
+ const Configuration *replay_configuration = nullptr);
~LogReader();
// Registers all the callbacks to send the log file data out on an event loop