pub struct ManagedLockRevokeNotify { /* private fields */ }
Expand description
Used to notify when a lock is revoked.
Examples
use etcd_client::Client;
use rust_etcd_utils::{lease::ManagedLeaseFactory, lock::spawn_lock_manager, ManagedLock};
let etcd = Client::connect(["http://localhost:2379"], None).await.expect("failed to connect to etcd");
let managed_lease_factory = ManagedLeaseFactory::new(etcd.clone());
let (lock_man_handle, lock_man) = spawn_lock_manager(etcd.clone(), managed_lease_factory.clone());
// Do something with the lock manager
let managed_lock: ManagedLock = lock_man.try_lock("test").await.expect("failed to lock");
let revoke_notify = managed_lock.get_revoke_notify();
// Can be cloned
let revoke_notify2 = revoke_notify.clone();
// Can create multiple instances..
let revoke_notify3 = managed_lock.get_revoke_notify();
etcd.delete("test", None).await.expect("failed to delete");
revoke_notify.wait_for_revoke().await;
revoke_notify2.wait_for_revoke().await;
revoke_notify3.wait_for_revoke().await;
println!("All revoke notify received");
Implementations§
Source§impl ManagedLockRevokeNotify
impl ManagedLockRevokeNotify
Sourcepub async fn wait_for_revoke(self)
pub async fn wait_for_revoke(self)
Wait for the lock to be revoked.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ManagedLockRevokeNotify
impl RefUnwindSafe for ManagedLockRevokeNotify
impl Send for ManagedLockRevokeNotify
impl Sync for ManagedLockRevokeNotify
impl Unpin for ManagedLockRevokeNotify
impl UnwindSafe for ManagedLockRevokeNotify
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Wrap the input message
T
in a tonic::Request