pub struct Lock<L: LockLayout = DefaultLockLayout> { /* private fields */ }Expand description
Fleet-shared lock handle. Clones share one event cursor.
Implementations§
Source§impl Lock<DefaultLockLayout>
impl Lock<DefaultLockLayout>
Source§impl<L: LockLayout> Lock<L>
impl<L: LockLayout> Lock<L>
Sourcepub fn with_layout(fleet: Arc<Fleet>) -> Result<Self>
pub fn with_layout(fleet: Arc<Fleet>) -> Result<Self>
Subscribe with a custom storage layout.
Sourcepub fn replay_layout(fleet: Arc<Fleet>) -> Result<Self>
pub fn replay_layout(fleet: Arc<Fleet>) -> Result<Self>
Replay retained transitions with a custom storage layout. Intended for tests and diagnostics.
pub fn try_acquire( &self, key: &LockKey, owner: &LockOwner, ttl: Duration, ) -> Result<LockAcquire>
Sourcepub fn renew(
&self,
lease: &LockLease,
ttl: Duration,
) -> Result<Option<LockLease>>
pub fn renew( &self, lease: &LockLease, ttl: Duration, ) -> Result<Option<LockLease>>
Renew only if this exact tenure is still current.
Sourcepub fn renew_owned(
&self,
key: &LockKey,
owner: &LockOwner,
ttl: Duration,
) -> Result<Option<LockLease>>
pub fn renew_owned( &self, key: &LockKey, owner: &LockOwner, ttl: Duration, ) -> Result<Option<LockLease>>
Renew by a caller-retained owner identity.
Sourcepub fn release(&self, lease: &LockLease) -> Result<bool>
pub fn release(&self, lease: &LockLease) -> Result<bool>
Release only if this exact tenure is still current.
Sourcepub fn release_owned(&self, key: &LockKey, owner: &LockOwner) -> Result<bool>
pub fn release_owned(&self, key: &LockKey, owner: &LockOwner) -> Result<bool>
Release only when the current owner bytes match.
Sourcepub fn force_release(&self, key: &LockKey) -> Result<bool>
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.
Sourcepub fn current(&self, key: &LockKey) -> Result<Option<LockLease>>
pub fn current(&self, key: &LockKey) -> Result<Option<LockLease>>
Read authoritative current state for one key.
Sourcepub fn restore(
&self,
key: &LockKey,
owner: &LockOwner,
) -> Result<Option<LockLease>>
pub fn restore( &self, key: &LockKey, owner: &LockOwner, ) -> Result<Option<LockLease>>
Restore the current tenure only when its owner bytes match.
Sourcepub fn reset_transport(&self) -> Result<()>
pub fn reset_transport(&self) -> Result<()>
Clear lock state and transition history during quiescent owner boot.
Sourcepub fn event_fd(&self) -> Result<RingEventFd>
pub fn event_fd(&self) -> Result<RingEventFd>
Create this process’ readiness fd for lock transitions.