Crates.io | ya-etcd-rs |
lib.rs | ya-etcd-rs |
version | 1.2.2 |
source | src |
created_at | 2024-07-01 03:10:49.752067 |
updated_at | 2024-09-14 09:05:10.72685 |
description | etcd client for rust |
homepage | https://github.com/Fiekers/etcd-rs |
repository | https://github.com/Fiekers/etcd-rs |
max_upload_size | |
id | 1288330 |
size | 151,679 |
An etcd (API v3) client for Rust backed by tokio and tonic.
ya-etcd-rs
's MSRV is 1.75
.
$ rustup update
$ cargo build
Add following dependencies in your project cargo.toml
:
[dependencies]
ya-etcd-rs = "1.2"
use ya_etcd_rs::{Client, ClientConfig, KeyValueOp, Result};
#[tokio::main]
async fn main() -> Result<()> {
let cli = Client::new(ClientConfig::new([
"http://127.0.0.1:12379".into(),
"http://127.0.0.1:22379".into(),
"http://127.0.0.1:32379".into(),
]))
.await?;
cli.put(("foo", "bar")).await.expect("put kv");
let kvs = cli.get("foo").await.expect("get kv").kvs;
assert_eq!(kvs.len(), 1);
Ok(())
}
requirements:
make setup-etcd-cluster
stop cluster
make teardown-etcd-cluster
for specified case:
TEST_CASE=test_put_error make test-one
This project is licensed under the MIT license.