//! The named-lock handle (ADR-019 §1; ADR-008 §7's locks guarantee row).
//!
//! Lock ops are not part of the tx seam — there is no `lock_tx`;
//! acquisition is a separate auto-commit op and the TTL discipline
//! governs.
use crate::Result;
use crate::future::BoxedFuture;
/// A held named lock.
pub trait Lock: Send {
/// The lock name the handle was constructed with (shared
/// namespace — validated at the constructor).
fn name(&self) -> &str;
/// Renew: a new **full** TTL window from now. `ttl` is a duration
/// argument (ADR-023 §2): `ttl <= 0` is a rejection (opaque `Err`,
/// never a silent immediately-expired lease). `false` = lost it
/// (expired and re-acquired elsewhere — exclusivity lapses
/// silently on expiry; no revocation event; ADR-008 §7). Holders
/// of long work must renew within TTL.
fn renew<'a>(&'a self, ttl: i64) -> BoxedFuture<'a, Result<bool>>;
/// Release the lock, consuming the handle (RAII shape). `true` =
/// it was still held (released now); `false` = already expired or
/// re-acquired — releasing then is a no-op, not an error.
fn release(self: Box<Self>) -> BoxedFuture<'static, Result<bool>>;
}