pub struct LockRecord {
pub lock_id: LockId,
pub tenant_id: TenantId,
pub resource_type: ResourceType,
pub resource_id: Uuid,
pub holder_agent_id: AgentId,
pub acquired_at: Timestamp,
pub expires_at: Timestamp,
pub mode: LockMode,
}Expand description
Internal data storage for a lock, independent of typestate. This is what gets persisted to the database.
Fields§
§lock_id: LockId§tenant_id: TenantId§resource_type: ResourceType§resource_id: UuidThe ID of the resource being locked (generic UUID since it can be any entity type)
holder_agent_id: AgentId§acquired_at: Timestamp§expires_at: Timestamp§mode: LockModeImplementations§
Source§impl LockRecord
impl LockRecord
Sourcepub fn is_expired(&self, now: Timestamp) -> bool
pub fn is_expired(&self, now: Timestamp) -> bool
Check if the lock has expired based on current time.
Sourcepub fn remaining_duration(&self, now: Timestamp) -> Option<Duration>
pub fn remaining_duration(&self, now: Timestamp) -> Option<Duration>
Calculate remaining duration until expiry.
Trait Implementations§
Source§impl Clone for LockRecord
impl Clone for LockRecord
Source§fn clone(&self) -> LockRecord
fn clone(&self) -> LockRecord
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl ComposeSchema for LockRecord
impl ComposeSchema for LockRecord
Source§impl Debug for LockRecord
impl Debug for LockRecord
Source§impl<'de> Deserialize<'de> for LockRecord
impl<'de> Deserialize<'de> for LockRecord
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for LockRecord
impl PartialEq for LockRecord
Source§impl Serialize for LockRecord
impl Serialize for LockRecord
Source§impl ToSchema for LockRecord
impl ToSchema for LockRecord
impl StructuralPartialEq for LockRecord
Auto Trait Implementations§
impl Freeze for LockRecord
impl RefUnwindSafe for LockRecord
impl Send for LockRecord
impl Sync for LockRecord
impl Unpin for LockRecord
impl UnwindSafe for LockRecord
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