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> Freeze for LockClient<'a>
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
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more