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

Concrete SQLite-backed BagWriter implementation with WAL caching and batch commits. More...

#include <vdb_writer.h>

Inheritance diagram for vlink::VDBWriter:
Collaboration diagram for vlink::VDBWriter:

Public Member Functions

 VDBWriter (const std::string &path, const Config &config={})
 Opens or creates a SQLite bag file for recording. More...
 
 ~VDBWriter () override
 Commits any cached writes and closes the SQLite database. 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 schemas table 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 SQLite-backed BagWriter implementation with WAL caching and batch commits.

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

Constructor & Destructor Documentation

◆ VDBWriter()

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

Opens or creates a SQLite bag file for recording.

Parameters
pathFilesystem path of the .vdb or .vdbx target.
configRecording configuration (split policy, compression, cache thresholds).

◆ ~VDBWriter()

vlink::VDBWriter::~VDBWriter ( )
override

Commits any cached writes and closes the SQLite database.

Member Function Documentation

◆ get_max_task_count()

size_t vlink::VDBWriter::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::VDBWriter::get_record_timestamp ( ) const
overrideprotectedvirtual

Implements vlink::BagWriter.

◆ get_split_index()

int vlink::VDBWriter::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::VDBWriter::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::VDBWriter::is_split_mode ( ) const
overridevirtual

Reports whether split-file recording is active.

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

Implements vlink::BagWriter.

◆ on_begin()

void vlink::VDBWriter::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::VDBWriter::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::VDBWriter::push_schema ( const SchemaData schema_data,
bool  immediate = false 
)
overridevirtual

Embeds schema_data in the schemas table 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::VDBWriter::record ( const Frame frame,
bool  immediate 
)
overrideprotectedvirtual

Implements vlink::BagWriter.

◆ register_schema_callback()

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

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

Parameters
callbackFunction consulted before inserting a URL row.

Implements vlink::BagWriter.

◆ register_split_callback()

void vlink::VDBWriter::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: