你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

ShareLeaseClient class

构造函数

ShareLeaseClient(ShareClient | ShareFileClient, string)

创建 ShareLeaseClient 的实例。

属性

leaseId

获取租约 ID。

url

获取 URL。

方法

acquireLease(number, LeaseOperationOptions)

建立和管理对文件、共享或共享快照的锁定,以便执行写入和删除作。

breakLease(LeaseOperationOptions)

强制结束租约。

changeLease(string, LeaseOperationOptions)

更改现有租约的 ID。

releaseLease(LeaseOperationOptions)

如果不再需要租约,则释放租约,以便另一个客户端可以立即获取租约。

renewLease(LeaseOperationOptions)

续订租约。 仅适用于共享或共享快照的租约。 请注意,即使该租约自该租约到期后尚未再次租用,该租约也可能续订。 续订租约时,租约持续时间时钟将重置。

构造函数详细信息

ShareLeaseClient(ShareClient | ShareFileClient, string)

创建 ShareLeaseClient 的实例。

new ShareLeaseClient(client: ShareClient | ShareFileClient, leaseId?: string)

参数

client

ShareClient | ShareFileClient

发出租约作请求的客户端。

leaseId

string

初始建议的租约 ID。

属性详细信息

leaseId

获取租约 ID。

string leaseId

属性值

string

url

获取 URL。

string url

属性值

string

方法详细信息

acquireLease(number, LeaseOperationOptions)

建立和管理对文件、共享或共享快照的锁定,以便执行写入和删除作。

function acquireLease(duration?: number, options?: LeaseOperationOptions): Promise<LeaseOperationResponse>

参数

duration

number

指定租约持续时间(以秒为单位)。 对于文件,对于永不过期的租约,唯一允许的值 -1。 对于共享,必须 -1 或介于 15 到 60 之间。

options
LeaseOperationOptions

租约管理作的选项。

返回

获取租约作的响应数据。

breakLease(LeaseOperationOptions)

强制结束租约。

function breakLease(options?: LeaseOperationOptions): Promise<LeaseOperationResponse>

参数

options
LeaseOperationOptions

租约管理作的选项。

返回

中断租约作的响应数据。

changeLease(string, LeaseOperationOptions)

更改现有租约的 ID。

function changeLease(proposedLeaseId: string, options?: LeaseOperationOptions): Promise<LeaseOperationResponse>

参数

proposedLeaseId

string

建议的新租约 ID。

options
LeaseOperationOptions

租约管理作的选项。

返回

更改租约作的响应数据。

releaseLease(LeaseOperationOptions)

如果不再需要租约,则释放租约,以便另一个客户端可以立即获取租约。

function releaseLease(options?: LeaseOperationOptions): Promise<LeaseOperationResponse>

参数

options
LeaseOperationOptions

租约管理作的选项。

返回

发布租约作的响应数据。

renewLease(LeaseOperationOptions)

续订租约。 仅适用于共享或共享快照的租约。 请注意,即使该租约自该租约到期后尚未再次租用,该租约也可能续订。 续订租约时,租约持续时间时钟将重置。

function renewLease(options?: LeaseOperationOptions): Promise<LeaseOperationResponse>

参数

options
LeaseOperationOptions

租约管理作的选项。

返回

续订租约作的响应数据。