VLink 2.0.0
A high-performance communication middleware
Loading...
Searching...
No Matches
vlink::BagReaderProcessor Class Reference

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

#include <bag_reader_processor.h>

Collaboration diagram for vlink::BagReaderProcessor:

Classes

struct  Config
 Configuration for the time-ordered message cache. More...

Public Types

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

Public Member Functions

 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.

Detailed Description

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

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

Member Typedef Documentation

◆ OutputCallback

Initial value:
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.

Constructor & Destructor Documentation

◆ BagReaderProcessor()

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

Constructs the processor with the given config.

Parameters
configCache time and size limits.

◆ ~BagReaderProcessor()

vlink::BagReaderProcessor::~BagReaderProcessor ( )

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

Member Function Documentation

◆ 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.

Parameters
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.

Parameters
output_callbackCallback invoked for each message in order.

The documentation for this class was generated from the following file: