pub struct StepLease { /* private fields */ }Implementations§
Source§impl StepLease
impl StepLease
pub fn new( owner_id: LeaseOwnerId, idempotency_key: IdempotencyKey, acquired_at: OffsetDateTime, expires_at: OffsetDateTime, ) -> Result<Self, DomainError>
Sourcepub fn acquire(
owner_id: LeaseOwnerId,
idempotency_key: IdempotencyKey,
acquired_at: OffsetDateTime,
ttl: DurationMs,
) -> Result<Self, DomainError>
pub fn acquire( owner_id: LeaseOwnerId, idempotency_key: IdempotencyKey, acquired_at: OffsetDateTime, ttl: DurationMs, ) -> Result<Self, DomainError>
Acquire a lease that expires ttl after acquired_at.
Unlike StepLease::new, which takes an already-computed expiry
instant, this constructor derives the expiry from a typed
DurationMs and fails fast with DomainError::OutOfRange
when the requested lifetime cannot be honoured — either because it
exceeds the signed-millisecond range the clock accepts or because
adding it to acquired_at overflows the representable calendar.
The requested TTL is never silently clamped.
pub fn owner_id(&self) -> &LeaseOwnerId
pub fn idempotency_key(&self) -> &IdempotencyKey
pub fn acquired_at(&self) -> OffsetDateTime
pub fn expires_at(&self) -> OffsetDateTime
pub fn is_expired_at(&self, now: OffsetDateTime) -> bool
Trait Implementations§
Source§impl<'de> Deserialize<'de> for StepLease
impl<'de> Deserialize<'de> for StepLease
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
impl Eq for StepLease
impl StructuralPartialEq for StepLease
Auto Trait Implementations§
impl Freeze for StepLease
impl RefUnwindSafe for StepLease
impl Send for StepLease
impl Sync for StepLease
impl Unpin for StepLease
impl UnsafeUnpin for StepLease
impl UnwindSafe for StepLease
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