pub struct AdvisoryLocks { /* private fields */ }Expand description
Process-global table. One per runtime is enough; lock ids are a shared namespace across connections by PG semantics.
Implementations§
Source§impl AdvisoryLocks
impl AdvisoryLocks
Sourcepub fn try_acquire(&self, key: i64, conn: u64) -> bool
pub fn try_acquire(&self, key: i64, conn: u64) -> bool
Try to acquire key for conn. Returns true if the caller
now owns it (either fresh acquire or already holds it —
reentrant within the same connection, matching PG). Never
blocks.
Sourcepub fn acquire(&self, key: i64, conn: u64)
pub fn acquire(&self, key: i64, conn: u64)
Acquire key for conn, blocking until the current owner
(if any) releases. Reentrant within the same connection.
Sourcepub fn release(&self, key: i64, conn: u64) -> bool
pub fn release(&self, key: i64, conn: u64) -> bool
Release key for conn. Returns true if conn held the
lock. A mismatch returns false and leaves the table
untouched (PG behaviour: pg_advisory_unlock returns bool
without panicking on foreign locks).
Sourcepub fn release_all(&self, conn: u64) -> usize
pub fn release_all(&self, conn: u64) -> usize
Release every lock held by conn. Returns the number of
locks dropped. Call this on connection close.
Auto Trait Implementations§
impl !Freeze for AdvisoryLocks
impl !RefUnwindSafe for AdvisoryLocks
impl Send for AdvisoryLocks
impl Sync for AdvisoryLocks
impl Unpin for AdvisoryLocks
impl UnsafeUnpin for AdvisoryLocks
impl UnwindSafe for AdvisoryLocks
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 moreSource§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