VLink 2.0.0
A high-performance communication middleware
载入中...
搜索中...
未找到
vlink::BagReaderProcessor类 参考

Time-sorted message relay that buffers and orders messages before delivery. 更多...

#include <bag_reader_processor.h>

vlink::BagReaderProcessor 的协作图:

struct  Config
 Configuration for the time-ordered message cache. 更多...

Public 类型

using OutputCallback
 Callback type fired for each message in timestamp order.

Public 成员函数

 BagReaderProcessor (const Config &config=Config())
 Constructs the processor with the given config.
 ~BagReaderProcessor ()
 Destructor – flushes remaining cached messages and stops the processing thread.
void register_output_callback (OutputCallback &&output_callback)
 Registers the callback that receives time-ordered messages.
void push (int64_t timestamp, const std::string &url, ActionType action_type, const Bytes &data)
 Pushes a message into the time-ordered cache.

详细描述

Time-sorted message relay that buffers and orders messages before delivery.

Thread-safe. Multiple threads may call push() concurrently.

成员类型定义说明

◆ OutputCallback

初始值:
std::function<void(int64_t timestamp, const std::string& url, ActionType action_type, const Bytes& data)>

Callback type fired for each message in timestamp order.

Called from an internal processing thread after the cache window has elapsed.

构造及析构函数说明

◆ BagReaderProcessor()

vlink::BagReaderProcessor::BagReaderProcessor ( const Config & config = Config())
explicit

Constructs the processor with the given config.

参数
configCache time and size limits.

◆ ~BagReaderProcessor()

vlink::BagReaderProcessor::~BagReaderProcessor ( )

Destructor – flushes remaining cached messages and stops the processing thread.

成员函数说明

◆ push()

void vlink::BagReaderProcessor::push ( int64_t timestamp,
const std::string & url,
ActionType action_type,
const Bytes & data )

Pushes a message into the time-ordered cache.

Thread-safe. The message is inserted into an internal sorted queue keyed by timestamp. Messages are delivered to the OutputCallback after the min_cache_time window has elapsed.

参数
timestampMessage timestamp in microseconds.
urlTopic URL string.
action_typeAction type.
dataSerialized payload bytes.

◆ register_output_callback()

void vlink::BagReaderProcessor::register_output_callback ( OutputCallback && output_callback)

Registers the callback that receives time-ordered messages.

Only one callback may be registered. A subsequent call replaces the previous one.

参数
output_callbackCallback invoked for each message in order.

该类的文档由以下文件生成: