adamdebreceni commented on code in PR #1631:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1631#discussion_r1307425767
##########
libminifi/include/core/logging/internal/LogCompressorSink.h:
##########
@@ -57,26 +58,44 @@ class LogCompressorSink : public
spdlog::sinks::base_sink<std::mutex> {
~LogCompressorSink() override;
template<class Rep, class Period>
- std::unique_ptr<io::InputStream> getContent(const std::chrono::duration<Rep,
Period>& time, bool flush = false) {
+ std::vector<std::unique_ptr<io::InputStream>> getContent(const
std::chrono::duration<Rep, Period>& time, bool flush = false) {
if (flush) {
cached_logs_.commit();
compress(true);
}
- LogBuffer compressed;
- if (!compressed_logs_.tryDequeue(compressed, time) && flush) {
- return createEmptyArchive();
+
+ std::vector<std::unique_ptr<io::InputStream>> log_segments;
+ const auto segment_count = compressed_logs_.itemCount();
+ for (size_t i = 0; i < segment_count; ++i) {
+ LogBuffer compressed;
+ if (!compressed_logs_.tryDequeue(compressed, time) && flush) {
+ break;
+ }
+ log_segments.push_back(std::move(compressed.buffer_));
+ }
+
+ if (log_segments.empty()) {
+ log_segments.push_back(createEmptyArchive());
}
- return std::move(compressed.buffer_);
+ return log_segments;
}
size_t getMaxCacheSize() const {
return cached_logs_.getMaxSize();
}
+ size_t getMaxCacheSegmenSize() const {
Review Comment:
typo `getMaxCacheSegmentSize`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]