VLink 2.0.0
A high-performance communication middleware
载入中...
搜索中...
未找到
bag_reader_processor.h 文件参考

Time-ordered message buffer for smoothing bag playback across split files. 更多...

#include <cstdint>
#include <functional>
#include <memory>
#include <mutex>
#include <string>
#include "../base/bytes.h"
#include "../impl/types.h"
bag_reader_processor.h 的引用(Include)关系图:

浏览该文件的源代码.

 Time-sorted message relay that buffers and orders messages before delivery. 更多...
 Configuration for the time-ordered message cache. 更多...

命名空间

详细描述

Time-ordered message buffer for smoothing bag playback across split files.

BagReaderProcessor accepts messages pushed from one or more BagReader instances and delivers them to an OutputCallback in ascending timestamp order. It uses a time-windowed cache to absorb out-of-order messages that can arise when reading consecutive split files concurrently.

The processor maintains an internal sorted queue. Messages are held for at least Config::min_cache_time milliseconds before being flushed, allowing late-arriving messages from the current split to be sorted before delivery.

Typical usage
processor.register_output_callback([](int64_t ts, const std::string& url,
vlink::ActionType action, const vlink::Bytes& data) {
// process in order
});
// Feed from multiple readers:
reader_a->register_output_callback([&](auto ts, auto& url, auto action, auto& data) {
processor.push(ts, url, action, data);
});
reader_b->register_output_callback([&](auto ts, auto& url, auto action, auto& data) {
processor.push(ts, url, action, data);
});