Add SurrealDB backend#17
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
backend-surrealdbbackend 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 avaluefield and an optionallive_untilfield is used for TTL emulation.surrealdb://[user:pass@]host[:port]/namespace/database[?table=...](usesurrealdbs://for WSS/TLS). The table name defaults tocuttlestore.surrealdbcrate's default features are pure-Rust (tokio-tungstenite+rustls), so the backend is enabled by default — no C dependencies pulled in.requires_cleaner() = true).tests/surrealdb.rs) that runs against a real SurrealDB instance.docker run(the official image requires a command argument that GitHub Actions service containers cannot supply).Closes #12
Test plan
cargo test --test surrealdbpasses locally against a realsurrealdb start --user root --pass root memoryinstancecargo clippy --all-targets -- -D warningsis cleancargo check --no-default-features --features 'backend-redis,backend-filesystem,backend-in-memory,backend-sqlite-rustls,backend-dynamodb,backend-couchdb-rustls,backend-surrealdb'compileshttps://claude.ai/code/session_01MCge1kQH7aDevtDtnN7AwJ
Generated by Claude Code