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

Concrete MCAP-format bag file recorder. 更多...

#include <mcap_writer.h>

类 vlink::McapWriter 继承关系图:
vlink::McapWriter 的协作图:

Public 成员函数

 McapWriter (const std::string &path, const Config &config={})
 Constructs an McapWriter for the given path.
 ~McapWriter () override
 Destructor – finalises the MCAP file footer and flushes all pending writes.
void register_split_callback (SplitCallback &&callback, bool before) override
 Registers a callback invoked when a file split occurs.
void register_schema_callback (SchemaCallback &&callback) override
 Registers a callback that resolves serialisation type strings to SchemaData.
bool push_schema (const SchemaData &schema_data, bool immediate=false) override
 Embeds a SchemaData into the MCAP file for offline introspection.
int64_t push (const std::string &url, const std::string &ser_type, SchemaType schema_type, ActionType action_type, const Bytes &data, int64_t *microseconds_timestamp=nullptr, bool immediate=false) override
 Records one message to the MCAP file.
bool is_dumping () const override
 Returns true if the writer is actively recording to disk.
bool is_split_mode () const override
 Returns true if split-file mode is active.
int get_split_index () const override
 Returns the zero-based index of the current split file.
void set_url_loss (const std::string &url, double loss) override
 Sets the expected message loss ratio for a given URL.

Protected 成员函数

size_t get_max_task_count () const override
 Returns the maximum queue depth.
void on_begin () override
 Called from the loop thread just before the first task is processed.
void on_end () override
 Called from the loop thread just after the last task has been processed.

额外继承的成员函数

 Compression algorithm applied to each recorded payload. 更多...
 Queue implementation type. 更多...
 Idle strategy controlling CPU and latency trade-offs. 更多...
 Pre-defined task priority levels for kPriorityType loops. 更多...

详细描述

Concrete MCAP-format bag file recorder.

All virtual methods from BagWriter are implemented. Prefer using BagWriter::create() for format-agnostic construction.

构造及析构函数说明

◆ McapWriter()

vlink::McapWriter::McapWriter ( const std::string & path,
const Config & config = {} )
explicit

Constructs an McapWriter for the given path.

参数
pathPath to the output .vcap / .vcapx file. Created if it does not exist.
configRecording configuration.
这是这个函数的调用关系图:

◆ ~McapWriter()

vlink::McapWriter::~McapWriter ( )
override

Destructor – finalises the MCAP file footer and flushes all pending writes.

成员函数说明

◆ get_max_task_count()

size_t vlink::McapWriter::get_max_task_count ( ) const
overrideprotectedvirtual

Returns the maximum queue depth.

返回
kMaxTaskSize (10000) by default.

重载 vlink::MessageLoop .

◆ get_split_index()

int vlink::McapWriter::get_split_index ( ) const
nodiscardoverridevirtual

Returns the zero-based index of the current split file.

实现了 vlink::BagWriter.

◆ is_dumping()

bool vlink::McapWriter::is_dumping ( ) const
nodiscardoverridevirtual

Returns true if the writer is actively recording to disk.

实现了 vlink::BagWriter.

◆ is_split_mode()

bool vlink::McapWriter::is_split_mode ( ) const
nodiscardoverridevirtual

Returns true if split-file mode is active.

实现了 vlink::BagWriter.

◆ on_begin()

void vlink::McapWriter::on_begin ( )
overrideprotectedvirtual

Called from the loop thread just before the first task is processed.

Override in subclasses to perform per-thread initialisation.

重载 vlink::MessageLoop .

◆ on_end()

void vlink::McapWriter::on_end ( )
overrideprotectedvirtual

Called from the loop thread just after the last task has been processed.

Override in subclasses to perform per-thread cleanup.

重载 vlink::MessageLoop .

函数调用图:

◆ push()

int64_t vlink::McapWriter::push ( const std::string & url,
const std::string & ser_type,
SchemaType schema_type,
ActionType action_type,
const Bytes & data,
int64_t * microseconds_timestamp = nullptr,
bool immediate = false )
overridevirtual

Records one message to the MCAP file.

参数
urlVLink URL of the topic.
ser_typeSerialisation type string.
schema_typeCoarse schema family for the payload.
action_typeAction type (kPublish, kRequest, etc.).
dataSerialized payload bytes.
microseconds_timestampOptional custom timestamp in microseconds. nullptr means use the current system time.
immediateIf true, writes synchronously bypassing the queue.
返回
Sequence number of the recorded message, or a negative value on error.

实现了 vlink::BagWriter.

◆ push_schema()

bool vlink::McapWriter::push_schema ( const SchemaData & schema_data,
bool immediate = false )
overridevirtual

Embeds a SchemaData into the MCAP file for offline introspection.

参数
schema_dataSchema descriptor to store.
immediateIf true, merges synchronously; otherwise enqueues.
返回
false only when the immediate merge fails.

实现了 vlink::BagWriter.

◆ register_schema_callback()

void vlink::McapWriter::register_schema_callback ( SchemaCallback && callback)
overridevirtual

Registers a callback that resolves serialisation type strings to SchemaData.

参数
callbackFunction mapping (ser_type, schema_type) to SchemaData.

实现了 vlink::BagWriter.

◆ register_split_callback()

void vlink::McapWriter::register_split_callback ( SplitCallback && callback,
bool before )
overridevirtual

Registers a callback invoked when a file split occurs.

参数
callbackCalled with (split_index, new_filename) on each split.
beforeIf true, fires before the new file is opened; otherwise after.

实现了 vlink::BagWriter.

◆ set_url_loss()

void vlink::McapWriter::set_url_loss ( const std::string & url,
double loss )
overridevirtual

Sets the expected message loss ratio for a given URL.

参数
urlTopic URL.
lossLoss ratio in the range [0.0, 1.0].

实现了 vlink::BagWriter.


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