wenxiangchao
4 天以前 2e889843b4c171f2d6ad8e0d53084040703d11f6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
namespace Aging.Infrastructure.Contracts
{
    /// <summary>
    /// 短期操作租约接口。
    /// 在执行具体硬件操作前获取,确保操作期间资源不被抢占。
    /// 支持同步和异步释放。
    /// </summary>
    public interface IOperationLease : IDisposable, IAsyncDisposable
    {
        /// <summary>
        /// 租约唯一标识
        /// </summary>
        string LeaseId { get; }
 
        /// <summary>
        /// 租约关联的资源键
        /// </summary>
        ResourceKey Resource { get; }
 
        /// <summary>
        /// 租约所有者令牌
        /// </summary>
        ResourceOwnerToken Owner { get; }
 
        /// <summary>
        /// 租约获取时间
        /// </summary>
        DateTime AcquiredAt { get; }
 
        /// <summary>
        /// 租约过期时间(可选)
        /// </summary>
        DateTime? ExpiresAt { get; }
 
        /// <summary>
        /// 租约是否仍然有效
        /// </summary>
        bool IsValid { get; }
    }
}