GithubHelp home page GithubHelp logo

etcd-client's Introduction

etcd-client

Minimum rustc version Crate API

License: Apache OR License: MIT

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
  • Namespace

Usage

Add this to your Cargo.toml:

[dependencies]
etcd-client = "0.12"
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.
  • tls-openssl: Enables the openssl-based TLS connections. This would make your binary dynamically link to libssl.
  • tls-openssl-vendored: Like tls-openssl, however compile openssl from source code and statically link to it.

Test

We test this library with etcd 3.5.

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.64. The current etcd-client version is not guaranteed to build on Rust versions earlier than the minimum supported version.

License

Dual-licensed to be compatible with the Rust project.

Licensed under the Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0 or the MIT license http://opensource.org/licenses/MIT, at your option. This file may not be copied, modified, or distributed except according to those terms.

Contribution

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

etcd-client's People

Contributors

belltoy avatar davidli2010 avatar eaimty avatar easonchenys avatar g-murzik avatar h00448672 avatar harscoet avatar ivorhuang-hjd avatar jerry7x avatar jrb0001 avatar libinfeng-01 avatar liuyihua-cn avatar messense avatar nik-johnson-net avatar ocehwt avatar rex4539 avatar skyzh avatar ssebo avatar tennyzhuang avatar tisonkun avatar yeahlang avatar yiyuanliu avatar yotamofek avatar yujuncen avatar zoulianggang avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.