An etcd (API v3) client for Rust backed by tokio and tonic.
Add following dependencies in your project cargo.toml
:
toml
[dependencies]
etcd-rs = "1.0.0-alpha.0"
```rust use etcd_rs::Client;
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: - Makefile - docker - docker-compose
shell
make setup-etcd-cluster
stop cluster
shell
make teardown-etcd-cluster
shell
make test
for specified case:
shell
TEST_CASE=test_put_error make test-one
This project is licensed under the MIT license.