VLink  2.0.0
A high-performance communication middleware
vlink::VCAPWriter Class Referencefinal

Concrete MCAP-format BagWriter implementation with optional Zstd compression. More...

#include <vcap_writer.h>

Inheritance diagram for vlink::VCAPWriter:
Collaboration diagram for vlink::VCAPWriter:

Public Member Functions

 VCAPWriter (const std::string &path, const Config &config={})
 Opens or creates an MCAP file for recording. More...
 
 ~VCAPWriter () override
 Finalises the MCAP footer and flushes outstanding writes. More...
 
void register_split_callback (SplitCallback &&callback, bool before) override
 Registers a callback invoked at each file-split boundary. More...
 
void register_schema_callback (SchemaCallback &&callback) override
 Registers a resolver that maps a serialisation-type string to SchemaData. More...
 
bool push_schema (const SchemaData &schema_data, bool immediate=false) override
 Embeds schema_data in the MCAP file for offline introspection. More...
 
bool is_dumping () const override
 Returns the current value of the internal dumping flag. More...
 
bool is_split_mode () const override
 Reports whether split-file recording is active. More...
 
int get_split_index () const override
 Returns the index of the split part currently being written. More...
 

Protected Member Functions

int64_t record (const Frame &frame, bool immediate) override
 
int64_t get_record_timestamp () const override
 
size_t get_max_task_count () const override
 Returns the maximum queue depth. More...
 
void on_begin () override
 Hook invoked once on the loop thread before the first task runs. More...
 
void on_end () override
 Hook invoked once on the loop thread after the last task runs. More...
 

Additional Inherited Members

 Compression codec selector understood by the writer backends. More...
 Internal queue implementation type. More...
 Back-pressure strategy applied when the bounded queue is at capacity. More...
 Built-in priority levels for kPriorityType loops; higher values dispatch first. More...

Detailed Description

Concrete MCAP-format BagWriter implementation with optional Zstd compression.

Prefer BagWriter::create() for format-agnostic instantiation; instantiate this class directly when an MCAP-specific feature is required.

Constructor & Destructor Documentation

◆ VCAPWriter()

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

Opens or creates an MCAP file for recording.

Parameters
pathFilesystem path of the .vcap or .vcapx target.
configRecording configuration (split policy, compression, etc.).

◆ ~VCAPWriter()

vlink::VCAPWriter::~VCAPWriter ( )
override

Finalises the MCAP footer and flushes outstanding writes.

Member Function Documentation

◆ get_max_task_count()

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

Returns the maximum queue depth.

Returns
kMaxTaskSize (10000) by default.

Reimplemented from vlink::MessageLoop.

◆ get_record_timestamp()

int64_t vlink::VCAPWriter::get_record_timestamp ( ) const
overrideprotectedvirtual

Implements vlink::BagWriter.

◆ get_split_index()

int vlink::VCAPWriter::get_split_index ( ) const
overridevirtual

Returns the index of the split part currently being written.

Returns
Zero-based split index.

Implements vlink::BagWriter.

◆ is_dumping()

bool vlink::VCAPWriter::is_dumping ( ) const
overridevirtual

Returns the current value of the internal dumping flag.

Returns
true while messages are actively being persisted.

Implements vlink::BagWriter.

◆ is_split_mode()

bool vlink::VCAPWriter::is_split_mode ( ) const
overridevirtual

Reports whether split-file recording is active.

Returns
true when emitting a .vcapx manifest with multiple parts.

Implements vlink::BagWriter.

◆ on_begin()

void vlink::VCAPWriter::on_begin ( )
overrideprotectedvirtual

Hook invoked once on the loop thread before the first task runs.

Subclasses override to perform per-thread initialisation.

Reimplemented from vlink::MessageLoop.

◆ on_end()

void vlink::VCAPWriter::on_end ( )
overrideprotectedvirtual

Hook invoked once on the loop thread after the last task runs.

Subclasses override to perform per-thread cleanup.

Reimplemented from vlink::MessageLoop.

◆ push_schema()

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

Embeds schema_data in the MCAP file for offline introspection.

Parameters
schema_dataSchema descriptor to embed.
immediatetrue merges synchronously; false enqueues the write.
Returns
false only when an immediate merge failed.

Implements vlink::BagWriter.

◆ record()

int64_t vlink::VCAPWriter::record ( const Frame frame,
bool  immediate 
)
overrideprotectedvirtual

Implements vlink::BagWriter.

◆ register_schema_callback()

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

Registers a resolver that maps a serialisation-type string to SchemaData.

Parameters
callbackFunction consulted before writing a channel record.

Implements vlink::BagWriter.

◆ register_split_callback()

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

Registers a callback invoked at each file-split boundary.

Parameters
callbackReceives (split_index, filename) before or after the split.
beforetrue fires before the new file is opened; false fires after.

Implements vlink::BagWriter.


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