16 releases

0.6.3 May 3, 2021
0.6.2 Mar 26, 2021
0.6.1 Feb 9, 2021
0.5.4 Oct 23, 2020
0.1.1 Mar 28, 2020

#4 in Authentication

Download history 959/week @ 2021-01-21 927/week @ 2021-01-28 645/week @ 2021-02-04 1090/week @ 2021-02-11 702/week @ 2021-02-18 421/week @ 2021-02-25 790/week @ 2021-03-04 197/week @ 2021-03-11 167/week @ 2021-03-18 243/week @ 2021-03-25 163/week @ 2021-04-01 400/week @ 2021-04-08 621/week @ 2021-04-15 708/week @ 2021-04-22 1097/week @ 2021-04-29 1853/week @ 2021-05-06

2,198 downloads per month
Used in 3 crates

MIT license

210KB
5K SLoC

etcd-client

MIT licensed Minimum rustc version Crate API

An etcd v3 API client for Rust. It provides asynchronous client backed by tokio and tonic.

Features

  • etcd API v3
  • asynchronous

Supported APIs

  • KV
  • Watch
  • Lease
  • Auth
  • Maintenance
  • Cluster
  • Lock
  • Election

Usage

Add this to your Cargo.toml:

[dependencies]
etcd-client = "0.6"
tokio = { version = "1.0", features = ["full"] }

To get started using etcd-client:

use etcd_client::{Client, Error};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let mut client = Client::connect(["localhost:2379"], None).await?;
    // put kv
    client.put("foo", "bar", None).await?;
    // get kv
    let resp = client.get("foo", None).await?;
    if let Some(kv) = resp.kvs().first() {
        println!("Get kv: {{{}: {}}}", kv.key_str()?, kv.value_str()?);
    }

    Ok(())
}

Examples

Examples can be found in examples.

Feature Flags

  • tls: Enables the rustls-based TLS connection. Not enabled by default.
  • tls-roots: Adds system trust roots to rustls-based TLS connection using the rustls-native-certs crate. Not enabled by default.

Test

We test this library with etcd 3.4.

Notes that we use a fixed etcd server URI (localhost:2379) to connect to etcd server.

Rust version requirements

The minimum supported version is 1.45. The current etcd-client version is not guaranteed to build on Rust versions earlier than the minimum supported version.

License

This project is licensed under the MIT license (LICENSE or http://opensource.org/licenses/MIT).

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in etcd-client by you, shall be licensed as MIT, without any additional terms or conditions.

Dependencies

~5–9MB
~159K SLoC