Plugins
VDB plugins are out-of-process programs, in any language that can read and write JSON over a Unix socket, that vdb-mysql launches from VDB_PLUGIN_DIR (default /var/lib/vdb/plugins) and talks to over JSON-RPC 2.0 on a Unix socket. None ship with VDB; the extension points are the pipelines and events.
Layout
Each plugin is a directory in VDB_PLUGIN_DIR with a manifest (manifest.json, manifest.yaml or manifest.yml):
{
"name": "my-plugin",
"version": "1.0.0",
"command": ["./my-plugin"],
"env": {"MY_SETTING": "value"}
}At start, VDB launches the command, waits for the plugin to connect and send a declare notification naming the pipeline points it handles and the events it subscribes to, and wires them in. A plugin that fails to start or declare is logged and skipped.
What plugins can do
- Rewrite statements at
vdb.query.received.intercept. - Refuse a connection (
vdb.connection.opened.accept) or a transaction (vdb.transaction.begin.authorize) by returning an error. - Transform rows at
vdb.records.source.transformandvdb.records.merged.transform. A plugin that changes column values (masking) declares them astransforms: ["db.table.column", ...]in itsdeclarenotification; VDB then never pushes conditions on those columns to the Source and reads their indexes unordered, so results stay correct. - Persist the Delta. A persistence plugin attaches to
vdb.transaction.commit.applybelow priority 10 and stores each committed change set (an error fails the commit); atvdb.server.start.configureit returns them in the payload'sRestorefield and VDB replays them before clients connect. - Observe every event: connections, transactions, writes, Source requests, schema changes, limits.
Handlers run in priority order; VDB's own handlers use priority 10. At shutdown each plugin receives a shutdown request before VDB stops.