Azure.Storage.Files.DataLake.DataLakeLeaseClient
The DataLakeLeaseClient allows you to manipulate Azure
Storage leases on paths.
The TimeSpan representing an infinite lease duration.
Gets the Lease ID for this lease.
Gets the URI of the object being leased.
protected DataLakeLeaseClient()
Initializes a new instance of the DataLakeLeaseClient class
for mocking.
Initializes a new instance of the DataLakeLeaseClient class.
Initializes a new instance of the DataLakeLeaseClient class.
public virtual Response<DataLakeLease> Acquire(TimeSpan duration, RequestConditions conditions = null, CancellationToken cancellationToken = default)
The Acquire operation acquires a lease on
the path or file system. The lease duration must
be between 15 to 60 seconds, or infinite (-1).
If the file system does not have an active lease, the Data Lake service
creates a lease on the path or file system and returns it. If the
file system has an active lease, you can only request a new lease
using the active lease ID as LeaseId, but you can
specify a new duration.
For more information, see
Lease Container.
public virtual Task<Response<DataLakeLease>> AcquireAsync(TimeSpan duration, RequestConditions conditions = null, CancellationToken cancellationToken = default)
The AcquireAsync operation acquires a lease on
the path or file system. The lease duration must
be between 15 to 60 seconds, or infinite (-1).
If the file system does not have an active lease, the Data Lake service
creates a lease on the file system or path and returns it. If the
file system has an active lease, you can only request a new lease
using the active lease ID as LeaseId, but you can
specify a new duration.
For more information, see
Lease Container.
public virtual Response<DataLakeLease> Break(TimeSpan? breakPeriod = default, RequestConditions conditions = null, CancellationToken cancellationToken = default)
The Break operation breaks the path or
file system'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. When a lease is broken, the lease
break breakPeriod is allowed to elapse,
during which time no lease operation except
Break and Release can be
performed on the path or file system. When a lease is successfully
broken, the response indicates the interval in seconds until a new
lease can be acquired.
A lease that has been broken can also be released. A client can
immediately acquire a path or file system lease that has been
released.
For more information, see
Lease Container.
public virtual Task<Response<DataLakeLease>> BreakAsync(TimeSpan? breakPeriod = default, RequestConditions conditions = null, CancellationToken cancellationToken = default)
The BreakAsync operation breaks the path or
file system'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. When a lease is broken, the lease
break breakPeriod is allowed to elapse,
during which time no lease operation except
BreakAsync and ReleaseAsync can be
performed on the path or file system. When a lease is successfully
broken, the response indicates the interval in seconds until a new
lease can be acquired.
A lease that has been broken can also be released. A client can
immediately acquire a path or file system lease that has been
released.
For more information, see
Lease Container.
public virtual Response<DataLakeLease> Change(string proposedId, RequestConditions conditions = null, CancellationToken cancellationToken = default)
The Change operation changes the lease
of an active lease. A change must include the current
LeaseId and a new proposedId.
For more information, see
Lease Container.
public virtual Task<Response<DataLakeLease>> ChangeAsync(string proposedId, RequestConditions conditions = null, CancellationToken cancellationToken = default)
The ChangeAsync operation changes the lease
of an active lease. A change must include the current
LeaseId and a new proposedId.
For more information, see
Lease Container.
public virtual Response<ReleasedObjectInfo> Release(RequestConditions conditions = null, CancellationToken cancellationToken = default)
The Release operation releases the
file system or path's previously-acquired lease.
The lease may be released if the LeaseId
matches that associated with the file system or path. Releasing the
lease allows another client to immediately acquire the lease for the
file system or path as soon as the release is complete.
For more information, see
Lease Container.
public virtual Task<Response<ReleasedObjectInfo>> ReleaseAsync(RequestConditions conditions = null, CancellationToken cancellationToken = default)
The ReleaseAsync operation releases the
file system or path's previously-acquired lease.
The lease may be released if the LeaseId
matches that associated with the file system or path. Releasing the
lease allows another client to immediately acquire the lease for the
file system or path as soon as the release is complete.
For more information, see
Lease Container.
public virtual Response<DataLakeLease> Renew(RequestConditions conditions = null, CancellationToken cancellationToken = default)
The Renew operation renews the path or
file system's previously-acquired lease.
The lease can be renewed if the leaseId
matches that associated with the path or file system. Note that the
lease may be renewed even if it has expired as long as the path or
file system has not been leased again since the expiration of that
lease. When you renew a lease, the lease duration clock resets.
For more information, see
Lease Container.
public virtual Task<Response<DataLakeLease>> RenewAsync(RequestConditions conditions = null, CancellationToken cancellationToken = default)
The RenewAsync operation renews the path or
file system's previously-acquired lease.
The lease can be renewed if the leaseId
matches that associated with the path or file system. Note that the
lease may be renewed even if it has expired as long as the path or
file system has not been leased again since the expiration of that
lease. When you renew a lease, the lease duration clock resets.
For more information, see
Lease Container.