Add helper classes for log reading
The goal is to inject span reader factory deep into the log reading
and sorting. LogFilesContainer encapsulates log files and provides
a couple of useful validations and abstractions to simplify log sorting.
It is the first part of change. Follow one will push SelectedLogParts
even deeper into the log reader.
Change-Id: Ic5253bd2b7c87fbbf55ad8d39a480af2871ddb71
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/events/logging/log_reader.h b/aos/events/logging/log_reader.h
index b691b30..0486665 100644
--- a/aos/events/logging/log_reader.h
+++ b/aos/events/logging/log_reader.h
@@ -9,6 +9,8 @@
#include <vector>
#include "flatbuffers/flatbuffers.h"
+#include "gflags/gflags.h"
+#include "glog/logging.h"
#include "aos/condition.h"
#include "aos/events/event_loop.h"
@@ -102,6 +104,9 @@
LogReader(std::vector<LogFile> log_files,
const Configuration *replay_configuration = nullptr,
const ReplayChannels *replay_channels = nullptr);
+ LogReader(LogFilesContainer log_files,
+ const Configuration *replay_configuration = nullptr,
+ const ReplayChannels *replay_channels = nullptr);
~LogReader();
// Registers all the callbacks to send the log file data out on an event loop
@@ -334,10 +339,7 @@
return event_loop_factory_;
}
- std::string_view name() const { return log_files_[0].name; }
- std::string_view log_event_uuid() const {
- return log_files_[0].log_event_uuid;
- }
+ std::string_view name() const { return log_files_.name(); }
// Set whether to exit the SimulatedEventLoopFactory when we finish reading
// the logfile.
@@ -420,7 +422,7 @@
// entire event loop once all nodes are stopped.
void NoticeRealtimeEnd();
- const std::vector<LogFile> log_files_;
+ const LogFilesContainer log_files_;
// Class to manage sending RemoteMessages on the provided node after the
// correct delay.