MMapping for flatbuffers
This lets us lazily load flatbuffers using mmap to both reduce memory
usage and to increase speed for use cases where we don't need to access
everything.
Change-Id: Ia271350b4c7cbb7a0a86ca094ef69c34716ba754
Signed-off-by: Austin Schuh <austin.schuh@bluerivertech.com>
diff --git a/aos/util/file.h b/aos/util/file.h
index 8089225..7c06ece 100644
--- a/aos/util/file.h
+++ b/aos/util/file.h
@@ -2,9 +2,12 @@
#define AOS_UTIL_FILE_H_
#include <sys/stat.h>
+
+#include <memory>
#include <string>
#include <string_view>
+#include "absl/types/span.h"
#include "glog/logging.h"
namespace aos {
@@ -32,6 +35,9 @@
// runs across.
void UnlinkRecursive(std::string_view path);
+// Maps file from disk into memory
+std::shared_ptr<absl::Span<uint8_t>> MMapFile(const std::string &path);
+
} // namespace util
} // namespace aos