共用方式為


ShareLeaseClient Class

Definition

The ShareLeaseClient allows you to manipulate Azure Storage leases on files.

public class ShareLeaseClient
type ShareLeaseClient = class
Public Class ShareLeaseClient
Inheritance
ShareLeaseClient

Constructors

ShareLeaseClient()

Initializes a new instance of the ShareLeaseClient class for mocking.

ShareLeaseClient(ShareClient, String)

Initializes a new instance of the ShareLeaseClient class.

ShareLeaseClient(ShareFileClient, String)

Initializes a new instance of the ShareLeaseClient class.

Fields

InfiniteLeaseDuration

The TimeSpan representing an infinite lease duration.

Properties

FileClient

The ShareFileClient to manage leases for.

LeaseId

Gets the Lease ID for this lease.

ShareClient

The ShareClient to manage leases for.

Uri

Gets the URI of the object being leased.

Methods

Acquire(Nullable<TimeSpan>, CancellationToken)

The Acquire(Nullable<TimeSpan>, CancellationToken) operation acquires a lease on the file.

If the file does not have an active lease, the File service creates a lease on the file and returns it. If the file has an active lease, you can only request a new lease using the active lease ID as LeaseId

AcquireAsync(Nullable<TimeSpan>, CancellationToken)

The AcquireAsync(Nullable<TimeSpan>, CancellationToken) operation acquires a lease on the file.

If the file does not have an active lease, the File service creates a lease on the file and returns it. If the file has an active lease, you can only request a new lease using the active lease ID as LeaseId.

Break(CancellationToken)

The Break(CancellationToken) operation breaks the files's previously-acquired lease (if it exists).

Once a lease is broken, it cannot be renewed. Any authorized request can break the lease; the request is not required to specify a matching lease ID.

A lease that has been broken can also be released. A client can immediately acquire a file lease that has been released.

BreakAsync(CancellationToken)

The BreakAsync(CancellationToken) operation breaks the files's previously-acquired lease (if it exists).

Once a lease is broken, it cannot be renewed. Any authorized request can break the lease; the request is not required to specify a matching lease ID.

A lease that has been broken can also be released. A client can immediately acquire a file lease that has been released.

Change(String, CancellationToken)

The Change(String, CancellationToken) operation changes the lease of an active lease. A change must include the current LeaseId and a new proposedId.

ChangeAsync(String, CancellationToken)

The ChangeAsync(String, CancellationToken) operation changes the lease of an active lease. A change must include the current LeaseId and a new proposedId.

Release(CancellationToken)

The Release(CancellationToken) operation releases the files's previously-acquired lease.

The lease may be released if the LeaseId matches that associated with the file. Releasing the lease allows another client to immediately acquire the lease for the file as soon as the release is complete.

ReleaseAsync(CancellationToken)

The ReleaseAsync(CancellationToken) operation releases the files's previously-acquired lease.

The lease may be released if the LeaseId matches that associated with the file. Releasing the lease allows another client to immediately acquire the lease for the file as soon as the release is complete.

Renew(CancellationToken)

The Renew(CancellationToken) operation renews the shares's previously-acquired lease. This API does not support files.

The lease can be renewed if the leaseId matches that associated with the share. Note that the lease may be renewed even if it has expired as long as the share has not been leased again since the expiration of that lease. When you renew a lease, the lease duration clock resets.

RenewAsync(CancellationToken)

The RenewAsync(CancellationToken) operation renews the shares's previously-acquired lease. This API does not support files.

The lease can be renewed if the leaseId matches that associated with the share. Note that the lease may be renewed even if it has expired as long as the share has not been leased again since the expiration of that lease. When you renew a lease, the lease duration clock resets.

Applies to