Skip to main content

Crate reddb_client

Crate reddb_client 

Source
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:

URIBackendStatus
memory://Ephemeral in-memory
file:///abs/pathEmbedded engine on disk
grpc://host:portRemote tonic client
red://host:portRemote tonic client (default port 5050)
http://host:portREST client

§Cargo features

  • embedded (default) — pulls the entire RedDB engine in-process.
  • grpc — opt-in remote client over tonic. Pulls the engine for its RedDBClient type today; a thin proto-only client is tracked in PLAN_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 richer ConnectionTarget vocabulary onto the legacy Target enum exposed by this crate.
connector
Internal connector + REPL used by the red and red_client binaries (and by reddb-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-client does not force a serde version on consumers.

Structs§

BulkCreateStatus
ConfigClient
CreatedEntity
HealthStatus
KvClient
OperationStatus
QueryResponse
RedDBClient
VaultClient

Enums§

Reddb
Top-level client handle. Use Reddb::connect to get one.

Functions§

version
Crate version (matches the engine version when published in lockstep).