[][src]Crate etcdv3client

A etcdv3 client written in Rust-lang.

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(())
}

Modules

pb

Structs

EtcdClient
KvClient
LeaseClient
LeaseKeepAliver
WatchClient
Watcher

Enums

EtcdClientError