Kategorie: SDK Implementation
Version: v1.3.0
Status: ✅ Produktionsreif
Letztes Update: 22. Dezember 2025
- Übersicht
- Features & Highlights
- 🚀 Schnellstart
- Detaillierte Dokumentation
- Best Practices
- Troubleshooting
- Siehe auch
- Changelog
Das Rust-SDK (themisdb_sdk) bietet type-safe und zero-copy Zugriff auf ThemisDB mit vollständiger async/await Unterstützung. Das SDK befindet sich im Alpha-Status Breaking Changes sind möglich.
- Rust Systems Programmierer
- Performance-kritische Anwendungen
- Embedded Systems Entwickler
- CLI Tool Entwickler
- Rust stable toolchain mit
cargo - ThemisDB-Endpunkt (z.B.
http://127.0.0.1:8765) - Optional: Topologie-Endpunkt
| Feature | Beschreibung | Status |
|---|---|---|
| CRUD Operations | Type-safe get, put, delete | Stabil |
| AQL Queries | Generic query execution | Stabil |
| Vector Search | Similarity search | Stabil |
| Graph Traversal | Graph operations | Stabil |
| Batch Operations | Parallel batch processing | Stabil |
| Cursor Pagination | Efficient large datasets | Stabil |
| Topology-Aware | Automatic shard routing | Stabil |
| Retry Logic | Configurable retries | Stabil |
- Type Safety - Compile-time type checking
- Zero-Copy - Optimierte Performance
- Async/Await - Tokio-basiert
- Error Handling - Result<T, ThemisError>
- Ownership - Rust memory safety
# Cargo.toml
[dependencies]
themisdb_sdk = { path = "../ThemisDB/clients/rust" }
# Oder via Git
themisdb_sdk = { git = "https://github.com/themisdb/themisdb-rust" }use themisdb_sdk::{ThemisClient, ThemisClientConfig};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let client = ThemisClient::new(ThemisClientConfig {
endpoints: vec!["http://127.0.0.1:8765".into()],
namespace: "default".into(),
metadata_endpoint: Some("/_admin/cluster/topology".into()),
..Default::default()
})?;
let health = client.health().await?;
println!("{:?}", health);
Ok(())
}let client = ThemisClient::new(ThemisClientConfig {
endpoints: vec!["http://shard-1:8765".into()],
namespace: "production".into(),
metadata_endpoint: Some("http://etcd:2379/topology".into()),
timeout_ms: 60000,
max_retries: 5,
..Default::default()
})?;| Feld | Typ | Beschreibung | Default |
|---|---|---|---|
endpoints |
Vec<String> |
Bootstrap HTTP bases | Required |
namespace |
String |
Namespace for URNs | "default" |
metadata_endpoint |
Option<String> |
Topology service | Some("/_admin...") |
timeout_ms |
u64 |
Request timeout (ms) | 30000 |
max_retries |
u32 |
Retry count for 5xx | 3 |
let user_id = "550e8400-e29b-41d4-a716-446655440000";
// CREATE / UPDATE
client.put("relational", "users", user_id,
&serde_json::json!({"name": "Alice", "age": 30})
).await?;
// READ
if let Some(user) = client.get::<serde_json::Value>("relational", "users", user_id).await? {
println!("{}", user);
}
// DELETE
let removed = client.delete("relational", "users", user_id).await?;let batch = client.batch_get::<serde_json::Value>(
"relational",
"users",
&["1".into(), "2".into(), "404".into()]
).await?;
println!("Found {} users", batch.found.len());use themisdb_sdk::QueryOptions;
let page = client.query::<serde_json::Value>(
"FOR u IN users RETURN u",
QueryOptions {
use_cursor: true,
batch_size: Some(100),
..Default::default()
}
).await?;
if page.has_more {
if let Some(cursor) = page.next_cursor {
let next = client.query::<serde_json::Value>(
"FOR u IN users RETURN u",
QueryOptions {
use_cursor: true,
cursor: Some(cursor),
..Default::default()
}
).await?;
}
}let result = client.vector_search(
&[0.12, -0.04, 0.9],
Some(serde_json::json!({"namespace": "docs"})),
Some(5)
).await?;#[derive(Deserialize)]
struct User {
name: String,
email: String,
age: u32,
}
let user: Option<User> = client.get("relational", "users", id).await?;match client.get::<User>("relational", "users", id).await {
Ok(Some(user)) => println!("Found: {}", user.name),
Ok(None) => println!("Not found"),
Err(ThemisError::Http(status, body)) => eprintln!("HTTP {}: {}", status, body),
Err(e) => eprintln!("Error: {}", e),
}Problem: Type mismatch errors
Lösung:
cargo clean
cargo buildProblem: Cannot connect to ThemisDB
Lösung:
let client = ThemisClient::new(ThemisClientConfig {
endpoints: vec!["http://localhost:8765".into()],
timeout_ms: 60000,
max_retries: 5,
..Default::default()
})?;- Aktualisierung auf v1.3.0 Template
- Erweiterte Code-Beispiele
- Best Practices hinzugefügt
- Alle Links aktualisiert
- Alpha Release
- Full async/await support
- Type-safe operations