Expand description
Official Rust client for RedDB.
One connection-string API. Pick your backend at runtime:
use reddb_client::{Reddb, JsonValue};
// Embedded: opens the engine in-process, no network.
let db = Reddb::connect("memory://").await?;
db.insert("users", &JsonValue::object([("name", JsonValue::string("Alice"))])).await?;
let result = db.query("SELECT * FROM users").await?;
println!("{} rows", result.rows.len());
db.close().await?;Accepted URIs:
| URI | Backend | Status |
|---|---|---|
memory:// | Ephemeral in-memory | ✅ |
file:///abs/path | Embedded engine on disk | ✅ |
grpc://host:port | Remote tonic client | ✅ |
red://host:port | Remote tonic client (default port 5050) | ✅ |
http://host:port | REST client | ✅ |
§Cargo features
embedded(default) — pulls the entire RedDB engine in-process.grpc— opt-in remote client over tonic. Pulls the engine for itsRedDBClienttype today; a thin proto-only client is tracked inPLAN_DRIVERS.md.http— REST client.redwire— RedWire native TCP client (no engine dep).
§Internal connector
The crate also hosts the gRPC connector + REPL used by the
red and red_client binaries via the connector module.
That layer is intentionally lighter than the published Reddb
API: it speaks tonic + ureq + serde_json only and never pulls
the engine in. It is exposed at the crate root as
RedDBClient and repl for back-compat with the previous
reddb-client-internal crate.
Re-exports§
pub use error::ClientError;pub use error::ErrorCode;pub use error::Result;pub use params::IntoParams;pub use params::IntoValue;pub use params::Value;pub use types::BulkInsertResult;pub use types::InsertResult;pub use types::JsonValue;pub use types::KvWatchEvent;pub use types::QueryResult;pub use types::ValueOut;pub use connector::repl;
Modules§
- connect
- Connection-string parser. Thin shim that delegates to
reddb_wire::conn_string(the canonical, workspace-shared parser) and projects its richerConnectionTargetvocabulary onto the legacyTargetenum exposed by this crate. - connector
- Internal connector + REPL used by the
redandred_clientbinaries (and byreddb-server’s rpc_stdio mode). - embedded
- Embedded backend — wraps the in-process RedDB engine.
- error
- Error type for
reddb-client. - params
- Driver-side parameter values for
query_with(sql, &[Value]). - topology
- Client-side topology consumer (issue #168, ADR 0008).
- types
- Public value types — kept dependency-free on purpose so that
reddb-clientdoes not force a serde version on consumers.
Structs§
- Bulk
Create Status - Config
Client - Created
Entity - Health
Status - KvClient
- Operation
Status - Query
Response - RedDB
Client - Vault
Client
Enums§
- Reddb
- Top-level client handle. Use
Reddb::connectto get one.
Functions§
- version
- Crate version (matches the engine version when published in lockstep).