Module client

Module client 

Source
Expand description

Client module for distributed consensus system

Provides core components for interacting with the d_engine cluster:

§Basic Usage

use d_engine::client::{Client, ClientBuilder};
use std::time::Duration;
use core::error::Error;

#[tokio::main(flavor = "current_thread")]
async fn main(){
    // Initialize client with automatic cluster discovery
    let client = Client::builder(vec![
        "http://node1:9081".into(),
        "http://node2:9082".into()
    ])
    .connect_timeout(Duration::from_secs(3))
    .request_timeout(Duration::from_secs(1))
    .enable_compression(true)
    .build()
    .await
    .unwrap();

    // Execute key-value operations
    client.kv().put("user:1001", "Alice").await.unwrap();

    let value = client.kv().get("user:1001", false).await.unwrap();

    println!("User data: {:?}", value);

    // Perform cluster management
    let members = client.cluster().list_members().await.unwrap();
    println!("Cluster members: {:?}", members);

}

Structs§

Client
Main entry point for interacting with the d_engine cluster
ClientBuilder
Configurable builder for Client instances
ClientConfig
Client configuration parameters for network connection management
ClientInner
ClusterClient
Cluster administration interface
ConnectionPool
Manages connections to cluster nodes
KvClient
Key-value store client interface
LeaderInfo

Enums§

BusinessErrorType
ClientApiError
GeneralErrorType
NetworkErrorType
ProtocolErrorType
StorageErrorType