Expand description
§d-engine-client
Client library for interacting with d-engine Raft clusters via gRPC
§⚠️ You Probably Don’t Need This Crate
Use d-engine instead:
[dependencies]
d-engine = { version = "0.2", features = ["client"] }This provides the same API with simpler dependency management. The d-engine-client crate
is automatically included when you enable the client feature.
§For Contributors
This crate exists for architectural reasons:
- Clean boundaries between client and server
- Faster builds during development
- Isolated client testing
§Quick Start
ⓘ
use d_engine_client::Client;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::connect(vec!["http://localhost:50051"]).await?;
// Write data
client.put(b"key".to_vec(), b"value".to_vec()).await?;
// Read data
if let Some(value) = client.get(b"key".to_vec()).await? {
println!("Value: {:?}", value);
}
Ok(())
}§Read Consistency
Choose consistency level based on your needs:
get_linearizable()- Strong consistency (read from Leader)get_eventual()- Fast local reads (stale OK)get_lease()- Optimized with leader lease
§Features
This crate provides:
Client- Main entry point; derefs toGrpcClientClientBuilder- Configurable client constructionClientApi- Unified client operations trait (put/get/delete/CAS/watch)
§Documentation
For comprehensive guides:
Modules§
- cluster_
types - Cluster management protocol types
- protocol
- Protocol types needed for client operations
Structs§
- Client
- Main entry point for interacting with the d-engine cluster.
- Client
Builder - Configurable builder for
Clientinstances - Client
Config - Client configuration parameters for network connection management
- Client
Inner - Connection
Pool - Manages connections to cluster nodes
- Grpc
Client - gRPC-based key-value store client
Enums§
Traits§
- Client
Api - Unified key-value store interface.
Functions§
- get_
duration_ since_ epoch - get_
now_ as_ u32 - Returns seconds since epoch as u32
Type Aliases§
- Client
ApiResult - Result type for KV operations