Move log reader and writer over to split timestamp channels
Reuse TimestampChannel (and split it up further) to implement naming and
finding channels for log reader and writer. Test both the old and new
timestamp configuration.
Once the config changes go in for y2020, this should fix reading the log
file James broke.
Change-Id: I6b09eec69c064ded3b3c149e0fdf23162bd352cf
diff --git a/aos/events/logging/log_reader.h b/aos/events/logging/log_reader.h
index 875c90d..24ac5c9 100644
--- a/aos/events/logging/log_reader.h
+++ b/aos/events/logging/log_reader.h
@@ -288,7 +288,8 @@
// Returns the MessageHeader sender to log delivery timestamps to for the
// provided remote node.
- RemoteMessageSender *RemoteTimestampSender(const Node *delivered_node);
+ RemoteMessageSender *RemoteTimestampSender(const Channel *channel,
+ const Connection *connection);
// Converts a timestamp from the monotonic clock on this node to the
// distributed clock.
@@ -417,8 +418,16 @@
// channel) which correspond to the originating node.
std::vector<State *> channel_source_state_;
- std::map<const Node *, std::unique_ptr<RemoteMessageSender>>
- remote_timestamp_senders_map_;
+ // This is a cache for channel, connection mapping to the corresponding
+ // sender.
+ absl::btree_map<std::pair<const Channel *, const Connection *>,
+ std::shared_ptr<RemoteMessageSender>>
+ channel_timestamp_loggers_;
+
+ // Mapping from resolved RemoteMessage channel to RemoteMessage sender. This
+ // is the channel that timestamps are published to.
+ absl::btree_map<const Channel *, std::shared_ptr<RemoteMessageSender>>
+ timestamp_loggers_;
};
// Node index -> State.