Skip to content

Add SurrealDB backend#17

Merged
SeriousBug merged 4 commits into
mainfrom
claude/add-surrealdb-backend-asXXA
May 11, 2026
Merged

Add SurrealDB backend#17
SeriousBug merged 4 commits into
mainfrom
claude/add-surrealdb-backend-asXXA

Conversation

@SeriousBug
Copy link
Copy Markdown
Owner

@SeriousBug SeriousBug commented May 11, 2026

Summary

  • Adds a new backend-surrealdb backend that talks to a SurrealDB server over its WebSocket RPC protocol. Each Cuttlestore key becomes a record in a single table; the bytes live on a value field and an optional live_until field is used for TTL emulation.
  • Connection string format: surrealdb://[user:pass@]host[:port]/namespace/database[?table=...] (use surrealdbs:// for WSS/TLS). The table name defaults to cuttlestore.
  • The surrealdb crate's default features are pure-Rust (tokio-tungstenite + rustls), so the backend is enabled by default — no C dependencies pulled in.
  • SurrealDB does not have native per-record TTL, so the existing external cleaner is used (requires_cleaner() = true).
  • Includes an integration test (tests/surrealdb.rs) that runs against a real SurrealDB instance.
  • CI starts a real SurrealDB container with docker run (the official image requires a command argument that GitHub Actions service containers cannot supply).
  • Readme updated with a backend table row and a new "SurrealDB" details section.

Closes #12

Test plan

  • cargo test --test surrealdb passes locally against a real surrealdb start --user root --pass root memory instance
  • cargo clippy --all-targets -- -D warnings is clean
  • cargo check --no-default-features --features 'backend-redis,backend-filesystem,backend-in-memory,backend-sqlite-rustls,backend-dynamodb,backend-couchdb-rustls,backend-surrealdb' compiles
  • CI green

https://claude.ai/code/session_01MCge1kQH7aDevtDtnN7AwJ


Generated by Claude Code

claude added 4 commits May 11, 2026 05:14
Adds a new backend that talks to a SurrealDB server over the WebSocket
RPC protocol. Each Cuttlestore key becomes a record in a single table,
with the bytes stored on a `value` field and an optional `live_until`
expiry timestamp used for TTL emulation.

Connection string format:
  surrealdb://[user:pass@]host[:port]/namespace/database[?table=...]
  surrealdbs://...   (wss/TLS)

SurrealDB has no built-in per-record TTL, so the backend uses the
existing external cleaner. The backend is pure Rust (rustls +
tokio-tungstenite via the surrealdb crate's default features), so it is
included in the default feature set.

Includes an integration test that runs against a real SurrealDB instance,
and CI is updated to start one with `docker run` since the official
image needs a command argument that GitHub Actions service containers
cannot supply.

Closes #12

https://claude.ai/code/session_01MCge1kQH7aDevtDtnN7AwJ
SurrealDB adds ~10 MB to a stripped release build (the basic example
goes from 6.3 MB to 15.8 MB), so the backend is opt-in.
@SeriousBug SeriousBug merged commit 57abdd5 into main May 11, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add surrealdb backend

2 participants