Split configuration into a separate file.
This saves space and CPU. The configuration can't change (by design) in
a log file, so it was previously being duplicated. In some cases with
lots of forwarded messages and nodes, rotating was triggering
recompression of enough configuration information that we were falling
behind.
Note: on purpose, we aren't storing a link from the log file to the
header. We don't store links between parts either. It up to the user
to provide the config in the list of files and folders provided.
Change-Id: I2cd600ed76c5f6f4b2bd6ba77d49bc739227756f
diff --git a/aos/events/logging/log_namer.h b/aos/events/logging/log_namer.h
index 7e58152..2d4c23e 100644
--- a/aos/events/logging/log_namer.h
+++ b/aos/events/logging/log_namer.h
@@ -74,6 +74,11 @@
// Returns the node the logger is running on.
const Node *node() const { return node_; }
+ // Writes out the nested Configuration object to the config file location.
+ virtual void WriteConfiguration(
+ aos::SizePrefixedFlatbufferDetachedBuffer<LogFileHeader> *header,
+ std::string_view config_sha256) = 0;
+
protected:
// Modifies the header to have the provided UUID and part id.
void UpdateHeader(
@@ -115,6 +120,10 @@
DetachedBufferWriter *MakeForwardedTimestampWriter(
const Channel * /*channel*/, const Node * /*node*/) override;
+ void WriteConfiguration(
+ aos::SizePrefixedFlatbufferDetachedBuffer<LogFileHeader> *header,
+ std::string_view config_sha256) override;
+
private:
// Creates a new data writer with the new part number.
std::unique_ptr<DetachedBufferWriter> OpenDataWriter() {
@@ -181,6 +190,10 @@
aos::SizePrefixedFlatbufferDetachedBuffer<LogFileHeader> *header)
override;
+ void WriteConfiguration(
+ aos::SizePrefixedFlatbufferDetachedBuffer<LogFileHeader> *header,
+ std::string_view config_sha256) override;
+
DetachedBufferWriter *MakeWriter(const Channel *channel) override;
DetachedBufferWriter *MakeForwardedTimestampWriter(const Channel *channel,