Struct etcd_client::Client [−][src]
pub struct Client { /* fields omitted */ }
Expand description
Asynchronous etcd
client using v3 API.
Implementations
Connect to etcd
servers from given endpoints
.
Gets a watch client.
Gets a lease client.
Gets an auth client.
Gets a maintenance client.
Gets a cluster client.
Gets a lock client.
Gets a election client.
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>
pub async fn get(
&mut self,
key: impl Into<Vec<u8>>,
options: Option<GetOptions>
) -> Result<GetResponse, Error>
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>
pub async fn delete(
&mut self,
key: impl Into<Vec<u8>>,
options: Option<DeleteOptions>
) -> Result<DeleteResponse, Error>
Deletes the given key from the key-value store.
pub async fn compact(
&mut self,
revision: i64,
options: Option<CompactionOptions>
) -> Result<CompactionResponse, Error>
pub async fn compact(
&mut self,
revision: i64,
options: Option<CompactionOptions>
) -> Result<CompactionResponse, Error>
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.
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.
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>
pub async fn lease_grant(
&mut self,
ttl: i64,
options: Option<LeaseGrantOptions>
) -> Result<LeaseGrantResponse, Error>
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.
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>
pub async fn lease_keep_alive(
&mut self,
id: i64
) -> Result<(LeaseKeeper, LeaseKeepAliveStream), Error>
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>
pub async fn lease_time_to_live(
&mut self,
id: i64,
options: Option<LeaseTimeToLiveOptions>
) -> Result<LeaseTimeToLiveResponse, Error>
Retrieves lease information.
Lists all existing leases.
pub async fn lock(
&mut self,
name: impl Into<Vec<u8>>,
options: Option<LockOptions>
) -> Result<LockResponse, Error>
pub async fn lock(
&mut self,
name: impl Into<Vec<u8>>,
options: Option<LockOptions>
) -> Result<LockResponse, Error>
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.
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.
Enables authentication.
Disables authentication.
Adds role.
pub async fn role_delete(
&mut self,
name: impl Into<String>
) -> Result<RoleDeleteResponse, Error>
pub async fn role_delete(
&mut self,
name: impl Into<String>
) -> Result<RoleDeleteResponse, Error>
Deletes role.
Gets role.
Lists role.
pub async fn role_grant_permission(
&mut self,
name: impl Into<String>,
perm: Permission
) -> Result<RoleGrantPermissionResponse, Error>
pub async fn role_grant_permission(
&mut self,
name: impl Into<String>,
perm: Permission
) -> Result<RoleGrantPermissionResponse, Error>
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>
pub async fn role_revoke_permission(
&mut self,
name: impl Into<String>,
key: impl Into<Vec<u8>>,
options: Option<RoleRevokePermissionOptions>
) -> Result<RoleRevokePermissionResponse, Error>
Revokes role permission.
Add an user.
Gets the user info by the user name.
Lists all users.
pub async fn user_delete(
&mut self,
name: impl Into<String>
) -> Result<UserDeleteResponse, Error>
pub async fn user_delete(
&mut self,
name: impl Into<String>
) -> Result<UserDeleteResponse, Error>
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>
pub async fn user_change_password(
&mut self,
name: impl Into<String>,
password: impl Into<String>
) -> Result<UserChangePasswordResponse, Error>
Change password for an user.
pub async fn user_grant_role(
&mut self,
user: impl Into<String>,
role: impl Into<String>
) -> Result<UserGrantRoleResponse, Error>
pub async fn user_grant_role(
&mut self,
user: impl Into<String>,
role: impl Into<String>
) -> Result<UserGrantRoleResponse, Error>
Grant role for an user.
pub async fn user_revoke_role(
&mut self,
user: impl Into<String>,
role: impl Into<String>
) -> Result<UserRevokeRoleResponse, Error>
pub async fn user_revoke_role(
&mut self,
user: impl Into<String>,
role: impl Into<String>
) -> Result<UserRevokeRoleResponse, Error>
Revoke role for an user.
pub async fn alarm(
&mut self,
alarm_action: AlarmAction,
alarm_type: AlarmType,
options: Option<AlarmOptions>
) -> Result<AlarmResponse, Error>
pub async fn alarm(
&mut self,
alarm_action: AlarmAction,
alarm_type: AlarmType,
options: Option<AlarmOptions>
) -> Result<AlarmResponse, Error>
Maintain(get, active or inactive) alarms of members.
Gets the status of a member.
Defragments a member’s backend database to recover storage space.
Computes the hash of whole backend keyspace. including key, lease, and other buckets in storage. This is designed for testing ONLY!
Computes the hash of all MVCC keys up to a given revision. It only iterates "key" bucket in backend storage.
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>
pub async fn member_add<E: AsRef<str>, S: AsRef<[E]>>(
&mut self,
urls: S,
options: Option<MemberAddOptions>
) -> Result<MemberAddResponse, Error>
Adds current connected server as a member.
Remove a member.
pub async fn member_update(
&mut self,
id: u64,
url: impl Into<Vec<String>>
) -> Result<MemberUpdateResponse, Error>
pub async fn member_update(
&mut self,
id: u64,
url: impl Into<Vec<String>>
) -> Result<MemberUpdateResponse, Error>
Updates the member.
Promotes the member.
Lists members.
Moves the current leader node to target node.
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>
pub async fn proclaim(
&mut self,
value: impl Into<Vec<u8>>,
options: Option<ProclaimOptions>
) -> Result<ProclaimResponse, Error>
Lets the leader announce a new value without another election.
Returns the leader value for the current election.
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>
pub async fn resign(
&mut self,
option: Option<ResignOptions>
) -> Result<ResignResponse, Error>
Releases election leadership and then start a new election
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl !UnwindSafe for Client
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Wrap the input message T
in a tonic::Request
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more