#etcd #async

etcdv3client

a simple etcdv3 client

11 releases

0.2.1 Jan 23, 2021
0.2.0 Jan 23, 2021
0.1.2 Dec 23, 2020
0.1.1 Apr 22, 2020
0.1.0-alpha.2 Nov 22, 2019

#179 in Asynchronous

Download history 18/week @ 2021-04-04 18/week @ 2021-04-11 18/week @ 2021-04-18 4/week @ 2021-04-25 14/week @ 2021-05-02 2/week @ 2021-05-09 13/week @ 2021-05-16 2/week @ 2021-05-23 2/week @ 2021-05-30 13/week @ 2021-06-06 2/week @ 2021-06-13 1/week @ 2021-06-20 2/week @ 2021-06-27 3/week @ 2021-07-04 3/week @ 2021-07-11 13/week @ 2021-07-18

68 downloads per month

MIT license

155KB
3.5K SLoC

etcdv3client-rust

Crates.io Documentation Rust Crates.io

Overview

[etcdv3client] is a simple etcdv3 client in Rust-lang.

Example

A basic example:

use etcdv3client::{EtcdClient, EtcdClientError};

#[tokio::main]
async fn main() -> Result<(), EtcdClientError> {
    let endpoint = "http://localhost:2379";
    let auth: Option<(String, String)> = None;
    let mut client = EtcdClient::new(vec![endpoint], auth).await?;

    let key = "/hello";
    // use convenience api under EtcdClient.
    match client.get(key).await {
        Ok(v) => {
            println!("got `{}` => {:?}", key, String::from_utf8_lossy(&v));
        }
        Err(EtcdClientError::KeyNotFound) => {
            eprintln!("can not find `{}`", key);
        }
        Err(e) => {
            eprintln!("etcd get error: `{:?}`", e);
        }
    }

    Ok(())
}

More examples can be found in [examples].

Support APIs

  • KV
  • Watch
  • Lease
  • Cluster
  • Maintenance
  • Auth

License

This project is licensed under the MIT license.

Dependencies

~5.5–8MB
~157K SLoC