SortParts is working with log backend

It is required for replay of logs from memory

Change-Id: I5c057efe9cc339953f3498f08413343c24936aee
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/events/logging/logfile_sorting.cc b/aos/events/logging/logfile_sorting.cc
index 5568770..582c3f5 100644
--- a/aos/events/logging/logfile_sorting.cc
+++ b/aos/events/logging/logfile_sorting.cc
@@ -1991,6 +1991,13 @@
   return sorter.SortParts();
 }
 
+std::vector<LogFile> SortParts(const LogSource &log_source) {
+  LogReadersPool readers(&log_source);
+  PartsSorter sorter;
+  sorter.PopulateFromFiles(&readers, log_source.ListFiles());
+  return sorter.SortParts();
+}
+
 std::vector<std::string> FindNodes(const std::vector<LogFile> &parts) {
   std::set<std::string> nodes;
   for (const LogFile &log_file : parts) {
diff --git a/aos/events/logging/logfile_sorting.h b/aos/events/logging/logfile_sorting.h
index 6f895f1..266619b 100644
--- a/aos/events/logging/logfile_sorting.h
+++ b/aos/events/logging/logfile_sorting.h
@@ -7,6 +7,7 @@
 #include <vector>
 
 #include "aos/configuration.h"
+#include "aos/events/logging/log_backend.h"
 #include "aos/time/time.h"
 #include "aos/uuid.h"
 
@@ -133,6 +134,9 @@
 // Takes a bunch of parts and sorts them based on part_uuid and part_index.
 std::vector<LogFile> SortParts(const std::vector<std::string> &parts);
 
+// Sort parts of a single log.
+std::vector<LogFile> SortParts(const LogSource &log_source);
+
 // Finds all the nodes which have parts logged from their point of view.
 std::vector<std::string> FindNodes(const std::vector<LogFile> &parts);
 // Finds all the parts which are from the point of view of a single node.