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 |
+----------+ +---------+ +-----------+
^ |
| +------------+
| | committing |
| | WAL flush |
| +------------+
| |
+-------------------- on_end() / dtor ----------------------- finalising
|
v
(optional)
vacuum
VLINK_EXPORT std::vector< std::string > split(const std::string &str, char f=',') noexcept
Splits a string by a single-character delimiter; empty parts are skipped.
- Example
writer->async_run();
frame.
url =
"dds://lidar/front";
frame.
ser_type =
"demo.proto.PointCloud";
frame.
data = serialized_bytes;
writer->push(frame);
@ kCompressLzav
Force LZAV codec where supported.
Definition: bag_writer.h:158
static std::shared_ptr< BagWriter > create(const std::string &path, const Config &config={})
Builds the concrete writer matching the extension of path.
@ kProtobuf
Decode through the Protocol Buffers stack.
@ kPublish
Message emitted by a Publisher node.
Recording behaviour, split policy and resource budgets.
Definition: bag_writer.h:168
CompressType compress
Compression codec selector.
Definition: bag_writer.h:170
bool wal_mode
Enable SQLite WAL for crash resilience.
Definition: bag_writer.h:171
One recorded or replayed message as it flows through the bag pipeline.
Definition: types.h:230
Bytes data
Serialised payload bytes.
Definition: types.h:236
SchemaType schema_type
Coarse schema family; reader fills it before user output.
Definition: types.h:234
ActionType action_type
Recorded action kind.
Definition: types.h:235
int64_t timestamp
Canonical time in microseconds (record / playback).
Definition: types.h:231
std::string ser_type
Serialisation type; reader fills it before user output.
Definition: types.h:233
std::string url
Topic URL.
Definition: types.h:232
- 参见
- BagWriter, VCAPWriter