Expand description
std.ts.* — SQLite-backed time-series primitive.
This is the only storage bridge whose implementation is in-tree (mlua_batteries provides no TSDB module). DDL / append / query / last all live in this file.
Backend: single ts table in ts.sqlite (or :memory:).
Schema:
CREATE TABLE IF NOT EXISTS ts (
series TEXT NOT NULL,
ts INTEGER NOT NULL,
tags TEXT,
value TEXT NOT NULL
);
CREATE INDEX IF NOT EXISTS idx_ts_series_ts ON ts(series, ts);Column notes:
series: logical stream name (e.g."cpu_load","agent_events")ts: Unix timestamp in milliseconds (i64)tags: JSON object ({"task": "X", "phase": "Y"}) or NULL; filtered viajson_extractin queries — never compared as a serialised stringvalue: JSON-encoded payload; accepts both JSON numbers and JSON objects so that callers can append plain numeric metrics or structured MCP envelope payloads without loss (dual-type contract, Crux §3.8 C1)
See bridge/config.rs for the ENV → path mapping (AGENT_BLOCK_TS_PATH).
Functions§
- register
- Register the
std.tsbridge intolua.