Crates.io | etcd-rs |
lib.rs | etcd-rs |
version | 1.0.1 |
source | src |
created_at | 2018-11-27 07:21:46.536743 |
updated_at | 2023-04-10 15:40:44.35622 |
description | etcd client for rust |
homepage | https://github.com/lodrem/etcd-rs |
repository | https://github.com/lodrem/etcd-rs |
max_upload_size | |
id | 98886 |
size | 177,019 |
An etcd (API v3) client for Rust backed by tokio and tonic.
Add following dependencies in your project cargo.toml
:
[dependencies]
etcd-rs = "1.0"
use etcd_rs::Client;
#[tokio::main]
async fn main() {
let cli = Client::connect(ClientConfig {
endpoints: [
"http://127.0.0.1:12379",
"http://127.0.0.1:22379",
"http://127.0.0.1:32379",
],
..Default::default()
}).await;
cli.put(("foo", "bar")).await.expect("put kv");
let kvs = cli.get("foo").await.expect("get kv").take_kvs();
assert_eq!(kvs.len(), 1);
}
requirements:
make setup-etcd-cluster
stop cluster
make teardown-etcd-cluster
make test
for specified case:
TEST_CASE=test_put_error make test-one
This project is licensed under the MIT license.