pub struct Client { /* private fields */ }Implementations§
Source§impl Client
impl Client
pub fn new( peers: impl IntoIterator<Item = impl AsRef<str>> + ExactSizeIterator, endpoint_config: ClientEndpointConfig, ) -> Self
Sourcepub fn set_auth_token(&self, token: HeaderValue)
pub fn set_auth_token(&self, token: HeaderValue)
Updates the authentication token used by the client.
This token will be used for all future requests made by the client. This method can be used to do live token rotation, without having to create a new client.
Sourcepub fn clear_auth_token(&self)
pub fn clear_auth_token(&self)
Clears the authentication token used by the client.
This will cause the client to make requests without an authentication token.
Sourcepub fn watcher(&self) -> Arc<WatcherHandle>
pub fn watcher(&self) -> Arc<WatcherHandle>
Creates, or returns an existing [Watcher] that can be used to watch keys in etcd.
If there is already an existing watcher, this method will return a clone of it, otherwise it will create a new watcher. When all references to the watcher are dropped, the watcher will be dropped as well.
The watcher coalesces watch requests, so that multiple requests watching the same key will only result in a single watch request being made to etcd.
Sourcepub async fn grant_lease(&self, ttl: Duration) -> Result<LeaseHandle, Status>
pub async fn grant_lease(&self, ttl: Duration) -> Result<LeaseHandle, Status>
Acquires a lease with the given TTL, spawning a background worker to continue to keep-alive the lease
as long as the returned lease::LeaseHandle is alive.
The lease handle provides methods for checking if the lease is still valid.
ttl must be above 10 seconds.
Auto Trait Implementations§
impl !Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request