21 releases

0.7.2 Sep 4, 2021
0.7.1 Jul 19, 2021
0.6.5 Jul 10, 2021
0.6.2 Mar 26, 2021
0.1.1 Mar 28, 2020

#9 in Authentication

Download history 1761/week @ 2021-07-03 2323/week @ 2021-07-10 2368/week @ 2021-07-17 1516/week @ 2021-07-24 1388/week @ 2021-07-31 2063/week @ 2021-08-07 1524/week @ 2021-08-14 1371/week @ 2021-08-21 1082/week @ 2021-08-28 1252/week @ 2021-09-04 2010/week @ 2021-09-11 2001/week @ 2021-09-18 1510/week @ 2021-09-25 2035/week @ 2021-10-02 2864/week @ 2021-10-09 1971/week @ 2021-10-16

7,658 downloads per month
Used in 5 crates

MIT license

215KB
5.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.7"
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.
  • pub-response-field: Exposes structs used to create regular etcd-client responses including internal protobuf representations. Useful for mocking. 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–9.5MB
~164K SLoC