Enforce that NodeMerger only operates on one boot

We want to introduce the idea that time can go backwards out a layer
since there is no way to overlap anything between boots when sorting.
CHECK in the constructor that we didn't muck that up.

While we are here, get rid of an un-necesary std::string copy that was
confusing.

Change-Id: Ic26900d5272986ac0c866c58b6b48fb4761e90c1
Signed-off-by: Austin Schuh <austin.schuh@bluerivertech.com>
diff --git a/aos/events/logging/logfile_utils.cc b/aos/events/logging/logfile_utils.cc
index b8b66a2..e01b4c6 100644
--- a/aos/events/logging/logfile_utils.cc
+++ b/aos/events/logging/logfile_utils.cc
@@ -662,16 +662,22 @@
 
 NodeMerger::NodeMerger(std::vector<LogParts> parts) {
   CHECK_GE(parts.size(), 1u);
-  const std::string part0_node = parts[0].node;
+  // Enforce that we are sorting things only from a single node from a single
+  // boot.
+  const std::string_view part0_node = parts[0].node;
+  const std::string_view part0_source_boot_uuid = parts[0].source_boot_uuid;
   for (size_t i = 1; i < parts.size(); ++i) {
     CHECK_EQ(part0_node, parts[i].node) << ": Can't merge different nodes.";
+    CHECK_EQ(part0_source_boot_uuid, parts[i].source_boot_uuid)
+        << ": Can't merge different boots.";
   }
+
+  node_ = configuration::GetNodeIndex(parts[0].config.get(), part0_node);
+
   for (LogParts &part : parts) {
     parts_sorters_.emplace_back(std::move(part));
   }
 
-  node_ = configuration::GetNodeIndex(configuration(), part0_node);
-
   monotonic_start_time_ = monotonic_clock::max_time;
   realtime_start_time_ = realtime_clock::max_time;
   for (const LogPartsSorter &parts_sorter : parts_sorters_) {