pw_{log, log_rpc}: Remove optional from thread filter
- Remove `optional` from FilterRule thread_equals field.
- Use configuration module and name field sizes in
response buffer sizing.
Change-Id: I9bc8f21ff13d7ba5a2f45c9d404be31ece55b34a
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/98141
Commit-Queue: Carlos Chinchilla <cachinchilla@google.com>
Reviewed-by: Carlos Chinchilla <cachinchilla@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
diff --git a/pw_log/log.proto b/pw_log/log.proto
index aa45583..a1f4e70 100644
--- a/pw_log/log.proto
+++ b/pw_log/log.proto
@@ -201,7 +201,7 @@
Action action = 4;
// Condition 4: (thread_equals.size() == 0 || log.thread == thread_equals).
- optional bytes thread_equals = 5 [(tokenizer.format) = TOKENIZATION_OPTIONAL];
+ bytes thread_equals = 5 [(tokenizer.format) = TOKENIZATION_OPTIONAL];
}
// A filter is a series of rules. First matching rule wins.
diff --git a/pw_log_rpc/public/pw_log_rpc/log_filter_service.h b/pw_log_rpc/public/pw_log_rpc/log_filter_service.h
index bb074af..3532ef2 100644
--- a/pw_log_rpc/public/pw_log_rpc/log_filter_service.h
+++ b/pw_log_rpc/public/pw_log_rpc/log_filter_service.h
@@ -58,10 +58,12 @@
(protobuf::SizeOfFieldEnum(
log::FilterRule::Fields::LEVEL_GREATER_THAN_OR_EQUAL, 7) +
protobuf::SizeOfFieldBytes(log::FilterRule::Fields::MODULE_EQUALS,
- 6) +
+ cfg::kMaxModuleNameBytes) +
protobuf::SizeOfFieldUint32(log::FilterRule::Fields::ANY_FLAGS_SET,
1) +
- protobuf::SizeOfFieldEnum(log::FilterRule::Fields::ACTION, 2));
+ protobuf::SizeOfFieldEnum(log::FilterRule::Fields::ACTION, 2) +
+ protobuf::SizeOfFieldBytes(log::FilterRule::Fields::THREAD_EQUALS,
+ cfg::kMaxThreadNameBytes));
static constexpr size_t kFilterIdsResponseBufferSize =
kMinSupportedFilters *