Enforce max out of order duration contract when writing logs.

Actively enforce this metric on the writer side by tracking the newest
message received and fetcher data for the current message being logged.
If max out of order duration is violated, rotate the part file and
double the max out of order duration value for the next part file.
Eventually we'll reach a satisfactory value and continue logging.

On the log reader side, choose the highest max out of order duration
value among all part files with the same part uuid. This ensures we have
sufficient messages in queue while reading to guarantee that max out of
order duration contract is satisfied.

Change-Id: I1666ed54acfcbc59cb9aedbe2f0dee979ceca095
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/events/logging/logfile_utils.cc b/aos/events/logging/logfile_utils.cc
index ec6bff3..133bb79 100644
--- a/aos/events/logging/logfile_utils.cc
+++ b/aos/events/logging/logfile_utils.cc
@@ -1598,7 +1598,9 @@
 
 PartsMessageReader::PartsMessageReader(LogPartsAccess log_parts_access)
     : log_parts_access_(std::move(log_parts_access)),
-      message_reader_(MakeSpanReader(log_parts_access_, 0)) {
+      message_reader_(MakeSpanReader(log_parts_access_, 0)),
+      max_out_of_order_duration_(
+          log_parts_access_.max_out_of_order_duration()) {
   if (log_parts_access_.size() >= 2) {
     next_message_reader_.emplace(MakeSpanReader(log_parts_access_, 1));
   }