Struct zookeeper_client::LockClient
source · pub struct LockClient<'a> { /* private fields */ }
Expand description
Guard client writes by owned ZooKeeper lock path which will be deleted in background when dropped.
Implementations§
source§impl<'a> LockClient<'a>
impl<'a> LockClient<'a>
sourcepub fn lock_path(&self) -> &str
pub fn lock_path(&self) -> &str
Lock path.
Caller can watch this path to detect external lock path deletion. See also ZOOKEEPER-91.
sourcepub fn create(
&self,
path: &str,
data: &[u8],
options: &CreateOptions<'_>
) -> impl Future<Output = Result<(Stat, CreateSequence), Error>> + Send + 'a
pub fn create( &self, path: &str, data: &[u8], options: &CreateOptions<'_> ) -> impl Future<Output = Result<(Stat, CreateSequence), Error>> + Send + 'a
Similar to Client::create except Error::RuntimeInconsistent if lock lost.
BUG
Stat will be Stat::is_invalid due to bugs in ZooKeeper version before 3.7.2, 3.8.2 and 3.9.0. See ZOOKEEPER-4026 for reference.
sourcepub fn set_data(
&self,
path: &str,
data: &[u8],
expected_version: Option<i32>
) -> impl Future<Output = Result<Stat, Error>> + Send + 'a
pub fn set_data( &self, path: &str, data: &[u8], expected_version: Option<i32> ) -> impl Future<Output = Result<Stat, Error>> + Send + 'a
Similar to Client::set_data except Error::RuntimeInconsistent if lock lost.
sourcepub fn delete(
&self,
path: &str,
expected_version: Option<i32>
) -> impl Future<Output = Result<(), Error>> + Send + 'a
pub fn delete( &self, path: &str, expected_version: Option<i32> ) -> impl Future<Output = Result<(), Error>> + Send + 'a
Similar to Client::delete except Error::RuntimeInconsistent if lock lost.
sourcepub fn new_check_writer(&self) -> CheckWriter<'a>
pub fn new_check_writer(&self) -> CheckWriter<'a>
Similar to Client::new_check_writer with this lock path.
sourcepub fn into_owned(self) -> OwnedLockClient
pub fn into_owned(self) -> OwnedLockClient
Converts to OwnedLockClient.
Trait Implementations§
source§impl<'a> Debug for LockClient<'a>
impl<'a> Debug for LockClient<'a>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for LockClient<'a>
impl<'a> Send for LockClient<'a>
impl<'a> Sync for LockClient<'a>
impl<'a> Unpin for LockClient<'a>
impl<'a> !UnwindSafe for LockClient<'a>
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