Skip to content

Commit 049e97f

Browse files
Istrate Andrei-EduardIstrate Andrei-Eduard
authored andcommitted
Added the official rust sdk to the readme
1 parent d2f32a5 commit 049e97f

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ DynaRust is a high-performance, distributed key-value store built in Rust. Desig
44

55
Optimized for modern hardware, a single node can sustain peak traffic of up to **10,000+ live connections** with sub-5 ms latency for real-time updates. Cluster capacity scales linearly by adding more nodes.
66

7+
78
## 📊 Performance (v2)
89

910
| Metric | Implementation Details |
@@ -51,6 +52,56 @@ Security is enforced from user access down to node-to-node transport:
5152

5253
-----
5354

55+
56+
## 📦 Official Rust Client SDK
57+
58+
We provide an official, highly-optimized async Rust client for seamlessly interacting with your DynaRust cluster: [**`dynarust_client` on crates.io**](https://www.google.com/search?q=%5Bhttps://crates.io/crates/dynarust_client%5D\(https://crates.io/crates/dynarust_client\)).
59+
60+
The SDK provides a wrapper around the REST API, allowing you to interact with the cluster using strongly-typed Rust structs, automatic JSON deserialization, and async/await syntax. It includes built-in JWT authentication management and native streaming for Server-Sent Events (SSE).
61+
62+
**Installation:**
63+
64+
```bash
65+
cargo add dynarust_client
66+
```
67+
68+
**Quick Usage Example:**
69+
70+
```rust
71+
use dynarust_client::models::{DynaClient, DynaError};
72+
use serde::{Deserialize, Serialize};
73+
74+
#[derive(Debug, Serialize, Deserialize, Clone)]
75+
struct UserProfile {
76+
username: String,
77+
level: u32,
78+
is_active: bool,
79+
}
80+
81+
#[tokio::main]
82+
async fn main() -> Result<(), DynaError> {
83+
let client = DynaClient::new("http://localhost:6660");
84+
85+
// Authenticate (auto-saves JWT for future requests)
86+
client.auth("player_1", "super_secret_password").await?;
87+
88+
// Write Data (PUT)
89+
let profile = UserProfile {
90+
username: "player_1".to_string(),
91+
level: 42,
92+
is_active: true,
93+
};
94+
client.put_value("users", "profile_data", &profile).await?;
95+
96+
// Read Data (GET) - Deserializes directly into your custom struct
97+
let fetched = client.get_value::<UserProfile>("users", "profile_data").await?;
98+
println!("Fetched level: {}", fetched.value.level);
99+
100+
Ok(())
101+
}
102+
```
103+
104+
54105
## 🧠 Architecture Overview
55106

56107
DynaRust guarantees eventual consistency via asynchronous state synchronization. Requests are processed locally in memory, persisted to disk, and fanned out to peer nodes.

0 commit comments

Comments
 (0)