VLink  2.0.0
A high-performance communication middleware
vdb_writer.h 文件参考

SQLite-backed recorder that produces .vdb / .vdbx bag files with batched WAL commits. 更多...

#include <memory>
#include <string>
#include "./bag_writer.h"
vdb_writer.h 的引用(Include)关系图:

浏览源代码.

class  vlink::VDBWriter
 Concrete SQLite-backed BagWriter implementation with WAL caching and batch commits. 更多...
 

命名空间

 

详细描述

SQLite-backed recorder that produces .vdb / .vdbx bag files with batched WAL commits.

VDBWriter materialises BagWriter on top of SQLite. Messages are accumulated in an in-memory cache and flushed to disk in WAL-mode transactions so that the write amplification remains bounded even at high publish rates; outstanding writes are committed during close() and an optional VACUUM step compacts the file on exit.

VDB schema
Table Purpose
messages (id, url_id, ts_us, action, data) – one row per recorded message
urls (id, url, ser_type, schema_type) – topic dictionary
schemas (id, ser_type, schema_type, blob) – embedded schema descriptors
metadata (key, value) – tag, machine name, vlink version, capture time
stats (url_id, count, bytes, loss) – per-URL aggregates updated on flush
Writer states
+----------+ on_begin() +---------+ push()/push_schema() +-----------+
| closed | -----------------> | opening | -----------------------> | recording |
+----------+ +---------+ +-----------+
^ |
| v cache full / split
| +------------+
| | committing |
| | WAL flush |
| +------------+
| |
+-------------------- on_end() / dtor ----------------------- finalising
|
v
(optional)
vacuum
Example
cfg.wal_mode = true;
auto writer = vlink::BagWriter::create("/data/recording.vdb", cfg);
writer->async_run();
frame.timestamp = -1; // < 0 => writer auto-assigns from its clock (0 is recorded verbatim)
frame.url = "dds://lidar/front";
frame.ser_type = "demo.proto.PointCloud";
frame.data = serialized_bytes;
writer->push(frame);
参见
BagWriter, VCAPWriter