Skip to main content

Lock

Struct Lock 

Source
pub struct Lock<L: LockLayout = DefaultLockLayout> { /* private fields */ }
Expand description

Fleet-shared lock handle. Clones share one event cursor.

Implementations§

Source§

impl Lock<DefaultLockLayout>

Source

pub fn new(fleet: Arc<Fleet>) -> Result<Self>

Subscribe after all currently committed transition events.

Source

pub fn replay_retained(fleet: Arc<Fleet>) -> Result<Self>

Replay retained transitions. Intended for tests and diagnostics.

Source§

impl<L: LockLayout> Lock<L>

Source

pub fn with_layout(fleet: Arc<Fleet>) -> Result<Self>

Subscribe with a custom storage layout.

Source

pub fn replay_layout(fleet: Arc<Fleet>) -> Result<Self>

Replay retained transitions with a custom storage layout. Intended for tests and diagnostics.

Source

pub fn try_acquire( &self, key: &LockKey, owner: &LockOwner, ttl: Duration, ) -> Result<LockAcquire>

Source

pub fn renew( &self, lease: &LockLease, ttl: Duration, ) -> Result<Option<LockLease>>

Renew only if this exact tenure is still current.

Source

pub fn renew_owned( &self, key: &LockKey, owner: &LockOwner, ttl: Duration, ) -> Result<Option<LockLease>>

Renew by a caller-retained owner identity.

Source

pub fn release(&self, lease: &LockLease) -> Result<bool>

Release only if this exact tenure is still current.

Source

pub fn release_owned(&self, key: &LockKey, owner: &LockOwner) -> Result<bool>

Release only when the current owner bytes match.

Source

pub fn force_release(&self, key: &LockKey) -> Result<bool>

Release the current tenure without checking its owner.

This is the explicit administrative escape hatch required by lock providers such as Laravel’s forceRelease. Normal callers should use Self::release or Self::release_owned.

Source

pub fn current(&self, key: &LockKey) -> Result<Option<LockLease>>

Read authoritative current state for one key.

Source

pub fn restore( &self, key: &LockKey, owner: &LockOwner, ) -> Result<Option<LockLease>>

Restore the current tenure only when its owner bytes match.

Source

pub fn poll(&self) -> LockPoll

Drain every currently visible transition from all writer lanes.

Source

pub fn reset_transport(&self) -> Result<()>

Clear lock state and transition history during quiescent owner boot.

Remove the state and event SHM objects.

Source

pub fn event_fd(&self) -> Result<RingEventFd>

Create this process’ readiness fd for lock transitions.

Trait Implementations§

Source§

impl<L: Clone + LockLayout> Clone for Lock<L>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<L = DefaultLockLayout> !RefUnwindSafe for Lock<L>

§

impl<L = DefaultLockLayout> !UnwindSafe for Lock<L>

§

impl<L> Freeze for Lock<L>
where LockStateStore<L>: Freeze,

§

impl<L> Send for Lock<L>
where LockStateStore<L>: Send,

§

impl<L> Sync for Lock<L>
where LockStateStore<L>: Sync,

§

impl<L> Unpin for Lock<L>
where LockStateStore<L>: Unpin,

§

impl<L> UnsafeUnpin for Lock<L>
where LockStateStore<L>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.