Redis adapter v1 — request blobs (X7RO/X7RQ/X7RX + X7RV)
Status: implemented in this repo via os.db.redis.* (native backend: crates/x07-ext-db-redis-native/).
Worlds: run-os, run-os-sandboxed.
This document pins the Redis v1 request formats used by std.db.redis.
Shared contracts:
X7DBresponses andX7DCcaps: DB v1
Builtins required (runner/toolchain)
Only available in standalone worlds (run-os, run-os-sandboxed):
os.db.redis.open_v1(req: bytes, caps: bytes) -> bytes(X7DB)os.db.redis.cmd_v1(req: bytes, caps: bytes) -> bytes(X7DB)os.db.redis.close_v1(req: bytes, caps: bytes) -> bytes(X7DB)
The X07 wrappers are in:
packages/ext/x07-ext-db-redis/0.1.3/modules/std/db/redis.x07.jsonpackages/ext/x07-ext-db-redis/0.1.3/modules/std/db/redis/spec.x07.jsonpackages/ext/x07-ext-db-redis/0.1.3/modules/std/db/redis/argv.x07.json
RedisOpenReqV1 (X7RO)
Produced by:
std.db.redis.spec.open_req_tcp_v1(host, port, user, pass, db, flags) -> bytesstd.db.redis.spec.open_req_unix_v1(path, user, pass, db, flags) -> bytes
The X7RO request encodes a tagged union:
- TCP: host/port
- Unix: path
All integers are u32 little-endian.
RedisCmdReqV1 (X7RQ)
Produced by: std.db.redis.spec.cmd_req_v1(conn_id, argv_table, flags) -> bytes
argv_table is a deterministic bytes table (X7RV, see below).
RedisCloseReqV1 (X7RX)
Produced by: std.db.redis.spec.close_req_v1(conn_id, flags) -> bytes
RedisArgvTableV1 (X7RV)
std.db.redis.argv provides helpers to build an argv table as bytes:
std.db.redis.argv.empty_v1() -> bytesstd.db.redis.argv.from1_v1(a0) -> bytes,from2_v1(a0,a1) -> bytes, ...std.db.redis.argv.push_v1(argv, arg) -> bytes
Each arg is raw bytes (UTF-8 recommended; not required).
Response payload (Redis v1)
os.db.redis.cmd_v1 returns an X7DB response.
On success, the X7DB OK payload is a DataModel doc_ok whose root value is a single DataModel value:
null/bool/number/stringseq(for arrays/sets)map
RESP3 mapping used by the native backend:
- RESP3
null→ DataModelnull - RESP3
bool→ DataModelbool - RESP3
number→ DataModelnumber(ASCII) - RESP3
string/blob→ DataModelstring(raw bytes) - RESP3
array→ DataModelseq - RESP3
map→ DataModelmap(string/number/bool keys only) - RESP3
set→ DataModelseqwith items sorted (deterministic)
Policy (run-os-sandboxed)
Sandboxed runs enforce the db section of schemas/run-os-policy.schema.json.
Minimum policy requirements for Redis TCP:
db.enabled = truedb.drivers.redis = truedb.net.allow_portscontains the target port (e.g.6379)- either
db.net.allow_dnscontains the hostname, ordb.net.allow_cidrscontains the IP range
If you are connecting to local docker fixtures without TLS, set:
db.net.require_tls = falsedb.net.require_verify = false