11 stable releases

Uses new Rust 2024

1.3.5 Apr 21, 2026
1.3.3 Mar 19, 2026
1.3.1 Oct 16, 2025
1.2.3 Mar 27, 2025
1.2.0 Jul 9, 2024

#740 in Asynchronous

MIT license

77KB
2K SLoC

yet another etcd client for Rust

github crates.io docs.rs build status dependency status

An etcd (API v3) client for Rust backed by tokio and tonic.

Supported APIs

  • KV
    • Put
    • Range
    • Delete
    • Transaction
    • Compact
  • Lease
    • Grant
    • Revoke
    • KeepAlive
    • TimeToLive
  • Watch
    • WatchCreate
    • WatchCancel
  • Auth
    • Authenticate
    • AuthStatus
    • AuthEnable
    • AuthDisable
    • RoleAdd
    • RoleDelete
    • RoleList
    • RoleGrantPermission
    • UserAdd
    • UserDelete
    • UserGrantRole
  • Cluster
    • MemberAdd
    • MemberRemove
    • MemberUpdate
    • MemberList
  • Maintenance
    • Alarm
    • Status
    • Defragment
    • Hash
    • Snapshot
    • MoveLeader

MSRV

  • 1.1.0 to 1.3.5 - Rust 1.75

Usage

Add following dependencies in your project cargo.toml:

[dependencies]
ya-etcd-rs = "1.3"
use ya_etcd_rs::{Client, ClientConfig, KeyValueOp, Result};

#[tokio::main]
async fn main() -> Result<()> {
    let cli = Client::new(ClientConfig::new([
        "http://127.0.0.1:12379".into(),
        "http://127.0.0.1:22379".into(),
        "http://127.0.0.1:32379".into(),
    ]))
    .await?;

    cli.put(("foo", "bar")).await.expect("put kv");

    let kvs = cli.get("foo").await.expect("get kv").kvs;
    assert_eq!(kvs.len(), 1);
    Ok(())
}

Development

requirements:

  • Makefile
  • docker
  • docker compose

Start local etcd cluster

make setup-etcd-cluster

stop cluster

make teardown-etcd-cluster

for specified case:

TEST_CASE=test_put_error make test-one

License

This project is licensed under the MIT license.

Dependencies

~10–24MB
~251K SLoC