Add library function to lookup storage duration per channel
This sets us up to actually add configuration per channel and have all
the call sites automatically update.
Change-Id: I1c1fe11b2096d6e2bdf578902e609b718c3bcb5c
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/configuration.cc b/aos/configuration.cc
index d100321..e674a75 100644
--- a/aos/configuration.cc
+++ b/aos/configuration.cc
@@ -367,7 +367,7 @@
std::numeric_limits<uint16_t>::max())
<< ": More messages/second configured than the queue can hold on "
<< CleanedChannelToString(c) << ", " << c->frequency() << "hz for "
- << config.message().channel_storage_duration() << "ns";
+ << ChannelStorageDuration(&config.message(), c).count() << "ns";
if (c->has_logger_nodes()) {
// Confirm that we don't have duplicate logger nodes.
@@ -1609,9 +1609,15 @@
return result;
}
+chrono::nanoseconds ChannelStorageDuration(const Configuration *config,
+ const Channel *channel) {
+ CHECK(channel != nullptr);
+ return chrono::nanoseconds(config->channel_storage_duration());
+}
+
int QueueSize(const Configuration *config, const Channel *channel) {
return QueueSize(channel->frequency(),
- chrono::nanoseconds(config->channel_storage_duration()));
+ ChannelStorageDuration(config, channel));
}
int QueueSize(size_t frequency, chrono::nanoseconds channel_storage_duration) {