[][src]Struct etcd_client::Client

pub struct Client { /* fields omitted */ }

Asynchronous etcd client using v3 API.

Implementations

impl Client[src]

pub async fn connect<E: AsRef<str>, S: AsRef<[E]>>(
    endpoints: S,
    options: Option<ConnectOptions>
) -> Result<Self, Error>
[src]

Connect to etcd servers from given endpoints.

pub async fn put(
    &mut self,
    key: impl Into<Vec<u8>>,
    value: impl Into<Vec<u8>>,
    options: Option<PutOptions>
) -> Result<PutResponse, Error>
[src]

Put the given key into the key-value store. A put request increments the revision of the key-value store and generates one event in the event history.

pub async fn get(
    &mut self,
    key: impl Into<Vec<u8>>,
    options: Option<GetOptions>
) -> Result<GetResponse, Error>
[src]

Gets the key from the key-value store.

pub async fn delete(
    &mut self,
    key: impl Into<Vec<u8>>,
    options: Option<DeleteOptions>
) -> Result<DeleteResponse, Error>
[src]

Deletes the given key from the key-value store.

pub async fn compact(
    &mut self,
    revision: i64,
    options: Option<CompactionOptions>
) -> Result<CompactionResponse, Error>
[src]

Compacts the event history in the etcd key-value store. The key-value store should be periodically compacted or the event history will continue to grow indefinitely.

pub async fn txn(&mut self, txn: Txn) -> Result<TxnResponse, Error>[src]

Processes multiple operations in a single transaction. A txn request increments the revision of the key-value store and generates events with the same revision for every completed operation. It is not allowed to modify the same key several times within one txn.

pub async fn watch(
    &mut self,
    key: impl Into<Vec<u8>>,
    options: Option<WatchOptions>
) -> Result<(Watcher, WatchStream), Error>
[src]

Watches for events happening or that have happened. Both input and output are streams; the input stream is for creating and canceling watcher and the output stream sends events. The entire event history can be watched starting from the last compaction revision.

pub async fn lease_grant(
    &mut self,
    ttl: i64,
    options: Option<LeaseGrantOptions>
) -> Result<LeaseGrantResponse, Error>
[src]

Creates a lease which expires if the server does not receive a keepAlive within a given time to live period. All keys attached to the lease will be expired and deleted if the lease expires. Each expired key generates a delete event in the event history.

pub async fn lease_revoke(
    &mut self,
    id: i64
) -> Result<LeaseRevokeResponse, Error>
[src]

Revokes a lease. All keys attached to the lease will expire and be deleted.

pub async fn lease_keep_alive(
    &mut self,
    id: i64
) -> Result<(LeaseKeeper, LeaseKeepAliveStream), Error>
[src]

Keeps the lease alive by streaming keep alive requests from the client to the server and streaming keep alive responses from the server to the client.

pub async fn lease_time_to_live(
    &mut self,
    id: i64,
    options: Option<LeaseTimeToLiveOptions>
) -> Result<LeaseTimeToLiveResponse, Error>
[src]

Retrieves lease information.

pub async fn leases(&mut self) -> Result<LeaseLeasesResponse, Error>[src]

Lists all existing leases.

pub async fn lock(
    &mut self,
    name: impl Into<Vec<u8>>,
    options: Option<LockOptions>
) -> Result<LockResponse, Error>
[src]

Lock acquires a distributed shared lock on a given named lock. On success, it will return a unique key that exists so long as the lock is held by the caller. This key can be used in conjunction with transactions to safely ensure updates to etcd only occur while holding lock ownership. The lock is held until Unlock is called on the key or the lease associate with the owner expires.

pub async fn unlock(
    &mut self,
    key: impl Into<Vec<u8>>
) -> Result<UnlockResponse, Error>
[src]

Unlock takes a key returned by Lock and releases the hold on lock. The next Lock caller waiting for the lock will then be woken up and given ownership of the lock.

pub async fn auth_enable(&mut self) -> Result<AuthEnableResponse, Error>[src]

Enables authentication.

pub async fn auth_disable(&mut self) -> Result<AuthDisableResponse, Error>[src]

Disables authentication.

pub async fn role_add(
    &mut self,
    name: impl Into<String>
) -> Result<RoleAddResponse, Error>
[src]

Adds role.

pub async fn role_delete(
    &mut self,
    name: impl Into<String>
) -> Result<RoleDeleteResponse, Error>
[src]

Deletes role.

pub async fn role_get(
    &mut self,
    name: impl Into<String>
) -> Result<RoleGetResponse, Error>
[src]

Gets role.

pub async fn role_list(&mut self) -> Result<RoleListResponse, Error>[src]

Lists role.

pub async fn role_grant_permission(
    &mut self,
    name: impl Into<String>,
    perm: Permission
) -> Result<RoleGrantPermissionResponse, Error>
[src]

Grants role permission.

pub async fn role_revoke_permission(
    &mut self,
    name: impl Into<String>,
    key: impl Into<Vec<u8>>,
    options: Option<RoleRevokePermissionOptions>
) -> Result<RoleRevokePermissionResponse, Error>
[src]

Revokes role permission.

pub async fn user_add(
    &mut self,
    name: impl Into<String>,
    password: impl Into<String>,
    options: Option<UserAddOptions>
) -> Result<UserAddResponse, Error>
[src]

Add an user.

pub async fn user_get(
    &mut self,
    name: impl Into<String>
) -> Result<UserGetResponse, Error>
[src]

Gets the user info by the user name.

pub async fn user_list(&mut self) -> Result<UserListResponse, Error>[src]

Lists all users.

pub async fn user_delete(
    &mut self,
    name: impl Into<String>
) -> Result<UserDeleteResponse, Error>
[src]

Deletes the given key from the key-value store.

pub async fn user_change_password(
    &mut self,
    name: impl Into<String>,
    password: impl Into<String>
) -> Result<UserChangePasswordResponse, Error>
[src]

Change password for an user.

pub async fn user_grant_role(
    &mut self,
    user: impl Into<String>,
    role: impl Into<String>
) -> Result<UserGrantRoleResponse, Error>
[src]

Grant role for an user.

pub async fn user_revoke_role(
    &mut self,
    user: impl Into<String>,
    role: impl Into<String>
) -> Result<UserRevokeRoleResponse, Error>
[src]

Revoke role for an user.

pub async fn alarm(
    &mut self,
    alarm_action: AlarmAction,
    alarm_type: AlarmType,
    options: Option<AlarmOptions>
) -> Result<AlarmResponse, Error>
[src]

Maintain(get, active or inactive) alarms of members.

pub async fn status(&mut self) -> Result<StatusResponse, Error>[src]

Gets the status of a member.

pub async fn defragment(&mut self) -> Result<DefragmentResponse, Error>[src]

Defragments a member's backend database to recover storage space.

pub async fn hash(&mut self) -> Result<HashResponse, Error>[src]

Computes the hash of whole backend keyspace. including key, lease, and other buckets in storage. This is designed for testing ONLY!

pub async fn hash_kv(&mut self, revision: i64) -> Result<HashKvResponse, Error>[src]

Computes the hash of all MVCC keys up to a given revision. It only iterates "key" bucket in backend storage.

pub async fn snapshot(&mut self) -> Result<SnapshotStreaming, Error>[src]

Gets a snapshot of the entire backend from a member over a stream to a client.

pub async fn member_add<E: AsRef<str>, S: AsRef<[E]>>(
    &mut self,
    urls: S,
    options: Option<MemberAddOptions>
) -> Result<MemberAddResponse, Error>
[src]

Adds current connected server as a member.

pub async fn member_remove(
    &mut self,
    id: u64
) -> Result<MemberRemoveResponse, Error>
[src]

Remove a member.

pub async fn member_update(
    &mut self,
    id: u64,
    url: impl Into<Vec<String>>
) -> Result<MemberUpdateResponse, Error>
[src]

Updates the member.

pub async fn member_promote(
    &mut self,
    id: u64
) -> Result<MemberPromoteResponse, Error>
[src]

Promotes the member.

pub async fn member_list(&mut self) -> Result<MemberListResponse, Error>[src]

Lists members.

pub async fn move_leader(
    &mut self,
    target_id: u64
) -> Result<MoveLeaderResponse, Error>
[src]

Moves the current leader node to target node.

pub async fn campaign(
    &mut self,
    name: impl Into<Vec<u8>>,
    value: impl Into<Vec<u8>>,
    lease: i64
) -> Result<CampaignResponse, Error>
[src]

Puts a value as eligible for the election on the prefix key. Multiple sessions can participate in the election for the same prefix, but only one can be the leader at a time.

pub async fn proclaim(
    &mut self,
    value: impl Into<Vec<u8>>,
    options: Option<ProclaimOptions>
) -> Result<ProclaimResponse, Error>
[src]

Lets the leader announce a new value without another election.

pub async fn leader(
    &mut self,
    name: impl Into<Vec<u8>>
) -> Result<LeaderResponse, Error>
[src]

Returns the leader value for the current election.

pub async fn observe(
    &mut self,
    name: impl Into<Vec<u8>>
) -> Result<ObserveStream, Error>
[src]

Returns a channel that reliably observes ordered leader proposals as GetResponse values on every current elected leader key.

pub async fn resign(
    &mut self,
    option: Option<ResignOptions>
) -> Result<ResignResponse, Error>
[src]

Releases election leadership and then start a new election

Trait Implementations

impl Clone for Client[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IntoRequest<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithSubscriber for T[src]