namespace Aging.Infrastructure.Contracts
{
///
/// 短期操作租约接口。
/// 在执行具体硬件操作前获取,确保操作期间资源不被抢占。
/// 支持同步和异步释放。
///
public interface IOperationLease : IDisposable, IAsyncDisposable
{
///
/// 租约唯一标识
///
string LeaseId { get; }
///
/// 租约关联的资源键
///
ResourceKey Resource { get; }
///
/// 租约所有者令牌
///
ResourceOwnerToken Owner { get; }
///
/// 租约获取时间
///
DateTime AcquiredAt { get; }
///
/// 租约过期时间(可选)
///
DateTime? ExpiresAt { get; }
///
/// 租约是否仍然有效
///
bool IsValid { get; }
}
}