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>

source

pub fn client(&self) -> &'a Client

Underlying client.

source

pub fn lock_path(&self) -> &str

Lock path.

Caller can watch this path to detect external lock path deletion. See also ZOOKEEPER-91.

source

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.

source

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.

source

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.

source

pub fn new_check_writer(&self) -> CheckWriter<'a>

Similar to Client::new_check_writer with this lock path.

source

pub fn into_owned(self) -> OwnedLockClient

Converts to OwnedLockClient.

Trait Implementations§

source§

impl<'a> Debug for LockClient<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for LockClient<'_>

Deletes lock path in background.

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.