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

Concrete SQLite-backed BagReader implementation with full random-access support. More...

#include <vdb_reader.h>

Inheritance diagram for vlink::VDBReader:
Collaboration diagram for vlink::VDBReader:

Public Member Functions

 VDBReader (const std::string &path, bool read_only=true, bool try_to_fix=false)
 Opens a SQLite bag file for playback. More...
 
 ~VDBReader () override
 Stops playback and closes the SQLite database handle. More...
 
void bind_plugin_interface (const std::shared_ptr< BagPluginInterface > &plugin_interface) override
 Attaches a BagPluginInterface for custom URL or type rewriting. More...
 
void register_status_callback (StatusCallback &&status_callback) override
 Registers a callback invoked on every playback state transition. More...
 
void register_ready_callback (ReadyCallback &&ready_callback) override
 Registers a callback fired once the database is open and parsed. More...
 
void register_finish_callback (FinishCallback &&finish_callback) override
 Registers a callback fired when playback ends naturally or is interrupted. More...
 
void register_output_callback (OutputCallback &&output_callback) override
 Registers the message-delivery callback consumed during playback. More...
 
void play (const Config &config) override
 Starts playback with the given configuration. More...
 
void stop () override
 Stops playback and rewinds to the recording start. More...
 
void pause () override
 Pauses playback at the current position. More...
 
void resume () override
 Resumes paused playback from the current position. More...
 
void pause_to_next () override
 Emits one more message and then pauses again. More...
 
void jump (int64_t begin_time, double rate, int times, bool force_to_play=false) override
 Seeks to begin_time and resumes playback at the new position. More...
 
std::future< bool > check () override
 Verifies the integrity of the SQLite bag file asynchronously. More...
 
std::future< bool > reindex () override
 Rebuilds the SQLite index tables asynchronously. More...
 
std::future< bool > fix (bool rebuild=false) override
 Repairs a corrupt SQLite bag file asynchronously. More...
 
void tag (const std::string &tag_name) override
 Updates the tag column in the metadata table. More...
 
int64_t get_timestamp () const override
 Returns the current playback cursor in milliseconds. More...
 
int64_t get_real_timestamp () const override
 Returns the timestamp of the last delivered message. More...
 
Status get_status () const override
 Returns the playback status. More...
 
const Infoget_info () const override
 Returns the bag metadata populated when the file was opened. More...
 
std::vector< SchemaDatadetect_schema () override
 Enumerates every schema embedded in the schemas table. More...
 
bool is_split_mode () const override
 Reports whether the bag is split across multiple .vdb files. More...
 
int get_split_index () const override
 Returns the index of the split part currently under playback. More...
 
bool is_jumping () const override
 Reports whether a jump() seek is currently being processed. More...
 

Protected Member Functions

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...
 
bool do_open_cursor (const Config &config) override
 
bool do_read_next (Frame &out, bool &is_error) override
 

Additional Inherited Members

 Coarse playback state observable through get_status(). 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 BagReader implementation with full random-access support.

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

Constructor & Destructor Documentation

◆ VDBReader()

vlink::VDBReader::VDBReader ( const std::string &  path,
bool  read_only = true,
bool  try_to_fix = false 
)
explicit

Opens a SQLite bag file for playback.

Parameters
pathFilesystem path of the .vdb or .vdbx file.
read_onlytrue opens the database without write capability (default).
try_to_fixReserved hook for table-rebuild recovery when table checks are enabled.

◆ ~VDBReader()

vlink::VDBReader::~VDBReader ( )
override

Stops playback and closes the SQLite database handle.

Member Function Documentation

◆ bind_plugin_interface()

void vlink::VDBReader::bind_plugin_interface ( const std::shared_ptr< BagPluginInterface > &  plugin_interface)
overridevirtual

Attaches a BagPluginInterface for custom URL or type rewriting.

Parameters
plugin_interfacePlugin instance; pass nullptr to detach.

Reimplemented from vlink::BagReader.

◆ check()

std::future<bool> vlink::VDBReader::check ( )
overridevirtual

Verifies the integrity of the SQLite bag file asynchronously.

Returns
Future resolving to true when the file passes the integrity check.

Implements vlink::BagReader.

◆ detect_schema()

std::vector<SchemaData> vlink::VDBReader::detect_schema ( )
overridevirtual

Enumerates every schema embedded in the schemas table.

Returns
Vector of SchemaData descriptors.

Implements vlink::BagReader.

◆ do_open_cursor()

bool vlink::VDBReader::do_open_cursor ( const Config config)
overrideprotectedvirtual

Reimplemented from vlink::BagReader.

◆ do_read_next()

bool vlink::VDBReader::do_read_next ( Frame out,
bool &  is_error 
)
overrideprotectedvirtual

Reimplemented from vlink::BagReader.

◆ fix()

std::future<bool> vlink::VDBReader::fix ( bool  rebuild = false)
overridevirtual

Repairs a corrupt SQLite bag file asynchronously.

Parameters
rebuildtrue rebuilds the entire index from scratch.
Returns
Future resolving to true on success.

Implements vlink::BagReader.

◆ get_info()

const Info& vlink::VDBReader::get_info ( ) const
overridevirtual

Returns the bag metadata populated when the file was opened.

Returns
Const reference to the Info struct.

Implements vlink::BagReader.

◆ get_max_task_count()

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

Returns the maximum queue depth.

Returns
kMaxTaskSize (10000) by default.

Reimplemented from vlink::MessageLoop.

◆ get_real_timestamp()

int64_t vlink::VDBReader::get_real_timestamp ( ) const
overridevirtual

Returns the timestamp of the last delivered message.

Returns
Last data timestamp in milliseconds, or 0 when stopped.

Implements vlink::BagReader.

◆ get_split_index()

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

Returns the index of the split part currently under playback.

Returns
Zero-based split index.

Implements vlink::BagReader.

◆ get_status()

Status vlink::VDBReader::get_status ( ) const
overridevirtual

Returns the playback status.

Returns
One of kStopped, kPaused, or kPlaying.

Implements vlink::BagReader.

◆ get_timestamp()

int64_t vlink::VDBReader::get_timestamp ( ) const
overridevirtual

Returns the current playback cursor in milliseconds.

Returns
Position relative to the recording start.

Implements vlink::BagReader.

◆ is_jumping()

bool vlink::VDBReader::is_jumping ( ) const
overridevirtual

Reports whether a jump() seek is currently being processed.

Returns
true while a seek is in flight.

Implements vlink::BagReader.

◆ is_split_mode()

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

Reports whether the bag is split across multiple .vdb files.

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

Implements vlink::BagReader.

◆ jump()

void vlink::VDBReader::jump ( int64_t  begin_time,
double  rate,
int  times,
bool  force_to_play = false 
)
overridevirtual

Seeks to begin_time and resumes playback at the new position.

Parameters
begin_timeTarget timestamp in milliseconds, relative to recording start.
ratePlayback rate multiplier applied after the seek.
timesNumber of loop iterations after the jump.
force_to_playtrue forces play state even if currently paused.

Implements vlink::BagReader.

◆ on_begin()

void vlink::VDBReader::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::VDBReader::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.

◆ pause()

void vlink::VDBReader::pause ( )
overridevirtual

Pauses playback at the current position.

Implements vlink::BagReader.

◆ pause_to_next()

void vlink::VDBReader::pause_to_next ( )
overridevirtual

Emits one more message and then pauses again.

Implements vlink::BagReader.

◆ play()

void vlink::VDBReader::play ( const Config config)
overridevirtual

Starts playback with the given configuration.

Parameters
configPlayback configuration (start / end times, rate, filters, loop count).

Implements vlink::BagReader.

◆ register_finish_callback()

void vlink::VDBReader::register_finish_callback ( FinishCallback &&  finish_callback)
overridevirtual

Registers a callback fired when playback ends naturally or is interrupted.

Parameters
finish_callbackReceives a flag indicating whether playback was interrupted.

Reimplemented from vlink::BagReader.

◆ register_output_callback()

void vlink::VDBReader::register_output_callback ( OutputCallback &&  output_callback)
overridevirtual

Registers the message-delivery callback consumed during playback.

Parameters
output_callbackInvoked for each replayed message.

Reimplemented from vlink::BagReader.

◆ register_ready_callback()

void vlink::VDBReader::register_ready_callback ( ReadyCallback &&  ready_callback)
overridevirtual

Registers a callback fired once the database is open and parsed.

Parameters
ready_callbackInvoked when the reader transitions out of opening state.

Reimplemented from vlink::BagReader.

◆ register_status_callback()

void vlink::VDBReader::register_status_callback ( StatusCallback &&  status_callback)
overridevirtual

Registers a callback invoked on every playback state transition.

Parameters
status_callbackReceives the new Status value.

Reimplemented from vlink::BagReader.

◆ reindex()

std::future<bool> vlink::VDBReader::reindex ( )
overridevirtual

Rebuilds the SQLite index tables asynchronously.

Returns
Future resolving to true on success.

Implements vlink::BagReader.

◆ resume()

void vlink::VDBReader::resume ( )
overridevirtual

Resumes paused playback from the current position.

Implements vlink::BagReader.

◆ stop()

void vlink::VDBReader::stop ( )
overridevirtual

Stops playback and rewinds to the recording start.

Implements vlink::BagReader.

◆ tag()

void vlink::VDBReader::tag ( const std::string &  tag_name)
overridevirtual

Updates the tag column in the metadata table.

Parameters
tag_nameNew tag string.

Implements vlink::BagReader.


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