Extract s3 file operations to separate file
Preparation for reading from memory. It will be called from log backend.
Change-Id: Ie2b6fff413fae08cc66afccb17d02b99a987847d
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/events/logging/s3_operations.cc b/aos/events/logging/s3_operations.cc
new file mode 100644
index 0000000..01b5dd2
--- /dev/null
+++ b/aos/events/logging/s3_operations.cc
@@ -0,0 +1,20 @@
+#include "aos/events/logging/s3_operations.h"
+
+#include "aos/events/logging/s3_fetcher.h"
+
+namespace aos::logger::internal {
+
+S3FileOperations::S3FileOperations(std::string_view url)
+ : object_urls_(ListS3Objects(url)) {}
+
+void S3FileOperations::FindLogs(std::vector<std::string> *files) {
+ // We already have a recursive listing, so just grab all the objects from
+ // there.
+ for (const std::string &object_url : object_urls_) {
+ if (IsValidFilename(object_url)) {
+ files->push_back(object_url);
+ }
+ }
+}
+
+} // namespace aos::logger::internal
\ No newline at end of file