Expand description
An etcd v3 API client for Rust. It provides asynchronous client backed by tokio and tonic.
§Supported APIs
- KV
- Watch
- Lease
- Auth
- Maintenance
- Cluster
- Lock
- Election
§Usage
Add this to your Cargo.toml:
[dependencies]
etcd-client = "0.14"
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 etcd-client/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-certscrate. Not enabled by default.
- pub-response-field: Exposes structs used to create regular- etcd-clientresponses including internal protobuf representations. Useful for mocking. Not enabled by default.
Structs§
- AlarmMember 
- Alarm member of respond.
- AlarmOptions 
- Options for alarmoperation.
- AlarmResponse 
- Response for alarmoperation.
- AuthClient 
- Client for Auth operations.
- AuthDisable Response 
- Response for AuthDisableoperation.
- AuthEnable Response 
- Response for AuthEnableoperation.
- AuthenticateResponse 
- Response for Authenticateoperation.
- CampaignResponse 
- Response for Campaignoperation.
- Certificatetls
- Represents a X509 certificate.
- Client
- Asynchronous etcdclient using v3 API.
- ClusterClient 
- Client for Cluster operations.
- CompactionOptions 
- Options for Compactoperation.
- CompactionResponse 
- Response for Compactoperation.
- Compare
- Transaction comparison.
- ConnectOptions 
- Options for Connectoperation.
- DefragmentResponse 
- Response for defragmentoperation.
- DeleteOptions 
- Options for Deleteoperation.
- DeleteResponse 
- Response for Deleteoperation.
- ElectionClient 
- Client for Elect operations.
- Event
- Watching event.
- GetOptions
- Options for Getoperation.
- GetResponse
- Response for Getoperation.
- HashKvResponse 
- Response for hash_kvoperation.
- HashResponse 
- Response for hashoperation.
- Identitytls
- Represents a private key and X509 certificate.
- KeyValue
- Key-value pair.
- KvClient
- Client for KV operations.
- KvClientPrefix 
- LeaderKey 
- Leader key of election
- LeaderResponse 
- Response for Leaderoperation.
- LeaseClient 
- Client for lease operations.
- LeaseClient Prefix 
- LeaseGrant Options 
- Options for Grantoperation.
- LeaseGrant Response 
- Response for Grantoperation.
- LeaseKeep Alive Response 
- Response for KeepAliveoperation.
- LeaseKeep Alive Stream 
- The lease keep alive response stream.
- LeaseKeeper 
- The lease keep alive handle.
- LeaseLeases Response 
- Response for Leasesoperation.
- LeaseRevoke Response 
- Response for Revokeoperation.
- LeaseStatus 
- Lease status.
- LeaseTime ToLive Options 
- Options for TimeToLiveoperation.
- LeaseTime ToLive Response 
- Response for TimeToLiveoperation.
- LockClient 
- Client for Lock operations.
- LockOptions 
- Options for Lockoperation.
- LockResponse 
- Response for Lockoperation.
- MaintenanceClient 
- Client for maintenance operations.
- Member
- Cluster member.
- MemberAddOptions 
- Options for MemberAddoperation.
- MemberAddResponse 
- Response for MemberAddoperation.
- MemberList Response 
- Response for MemberListoperation.
- MemberPromote Response 
- Response for MemberPromoteoperation.
- MemberRemove Response 
- Response for MemberRemoveoperation.
- MemberUpdate Response 
- Response for MemberUpdateoperation.
- MoveLeader Response 
- Response for MoveLeaderoperation.
- ObserveStream 
- Response for Observeoperation.
- Permission
- Role access permission.
- ProclaimOptions 
- Options for proclaimoperation.
- ProclaimResponse 
- Response for Proclaimoperation.
- PutOptions
- Options for Putoperation.
- PutResponse
- Response for Putoperation.
- ResignOptions 
- Options for resignoperation.
- ResignResponse 
- Response for Resignoperation.
- ResponseHeader 
- General etcdresponse header.
- RoleAddResponse 
- Response for role add operation.
- RoleDelete Response 
- Response for delete role operation.
- RoleGetResponse 
- Response for get role operation.
- RoleGrant Permission Response 
- Response for grant role permission operation.
- RoleList Response 
- Response for list role operation.
- RoleRevoke Permission Options 
- Options for grant role permission operation.
- RoleRevoke Permission Response 
- Response for revoke role permission operation.
- SnapshotResponse 
- Response for snapshotoperation.
- SnapshotStreaming 
- Response for snapshotoperation.
- StatusResponse 
- Response for statusoperation.
- TlsOptionstls
- Configures TLS settings for endpoints.
- Txn
- Transaction of multiple operations.
- TxnOp
- Transaction operation.
- TxnResponse
- Response for Txnoperation.
- UnlockResponse 
- Response for Unlockoperation.
- UserAddOptions 
- Options for UserAddoperation.
- UserAddResponse 
- Response for use add operation.
- UserChange Password Response 
- Response for change user’s password operation.
- UserDelete Response 
- Response for delete user operation.
- UserGetResponse 
- Response for get user operation.
- UserGrant Role Response 
- Response for grant role for an user operation.
- UserList Response 
- Response for list user operation.
- UserRevoke Role Response 
- Response for revoke role for an user operation.
- WatchClient 
- Client for watch operations.
- WatchOptions 
- Options for Watchoperation.
- WatchResponse 
- Response for Watchoperation.
- WatchStream 
- The watch response stream.
- Watcher
- The watching handle.
Enums§
- AlarmAction 
- Alarm action.
- AlarmType 
- Alarm type.
- CompareOp 
- Logical comparison operation.
- Error
- The error type for etcdclient.
- EventType 
- The kind of event.
- PermissionType 
- SortOrder 
- The ordering for sorted requests.
- SortTarget 
- The key-value field to sort.
- TxnOpResponse 
- Transaction operation response.
- WatchFilter Type 
- Watch filter type.