pub struct LeaseGuard { /* private fields */ }Expand description
Proof of a won round, returned by ExportLease::try_acquire.
There is nothing to release — the round runs until the lease expires (that
is the round period). Call complete after the artifact
is safely uploaded to publish what was exported.
Implementations§
Source§impl LeaseGuard
impl LeaseGuard
Sourcepub fn record(&self) -> &LeaseRecord
pub fn record(&self) -> &LeaseRecord
The record this guard wrote when it won the round.
Sourcepub async fn abandon(self)
pub async fn abandon(self)
Give the round back early: a failed export/upload should not suppress the fleet for the rest of the ttl. CAS-deletes the lease (tombstone) against this guard’s version, so the next trigger on any node can win a fresh round immediately.
Best-effort: a CAS conflict (someone already took over) or write error is logged, not surfaced — worst case the round waits out its ttl, which is the no-abandon behavior anyway.
An unawaited abandon() does nothing (and would trip the Drop
warning); the future’s inherent #[must_use] plus this crate’s
deny(unused_must_use) make that a compile error, not a silent leak.
Sourcepub async fn complete(self, cursor: &WatchCursor) -> Result<(), KvError>
pub async fn complete(self, cursor: &WatchCursor) -> Result<(), KvError>
Publish the round’s outcome: rewrite the lease value with the exported cursor and completion time (expiry unchanged — the round still runs its full period).
Best-effort observability: a CAS conflict means the lease was already taken over (this round overran its ttl) and is logged, not surfaced — the artifact is already safe wherever the caller put it.
An unawaited complete() records nothing (and would trip the Drop
warning); the future’s inherent #[must_use] plus this crate’s
deny(unused_must_use) make that a compile error, not a silent leak.