Add per channel storage durations
This lets us save images for less time than everything else, since they
are the main driver of queue memory usage.
Change-Id: I677791e20af6aedb0288d09cf5963b4dde30ecce
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/configuration.cc b/aos/configuration.cc
index e674a75..5afbee0 100644
--- a/aos/configuration.cc
+++ b/aos/configuration.cc
@@ -968,7 +968,7 @@
std::map<std::string_view, flatbuffers::Offset<reflection::Schema>>
schema_cache;
- CHECK_EQ(Channel::MiniReflectTypeTable()->num_elems, 13u)
+ CHECK_EQ(Channel::MiniReflectTypeTable()->num_elems, 14u)
<< ": Merging logic needs to be updated when the number of channel "
"fields changes.";
@@ -1065,6 +1065,10 @@
if (c->has_num_readers()) {
channel_builder.add_num_readers(c->num_readers());
}
+ if (c->has_channel_storage_duration()) {
+ channel_builder.add_channel_storage_duration(
+ c->channel_storage_duration());
+ }
channel_offsets.emplace_back(channel_builder.Finish());
}
channels_offset = fbb.CreateVector(channel_offsets);
@@ -1612,6 +1616,9 @@
chrono::nanoseconds ChannelStorageDuration(const Configuration *config,
const Channel *channel) {
CHECK(channel != nullptr);
+ if (channel->has_channel_storage_duration()) {
+ return chrono::nanoseconds(channel->channel_storage_duration());
+ }
return chrono::nanoseconds(config->channel_storage_duration());
}