private ItemRequestOptions CreateIfMatchOptions(DocumentServiceLease lease)
 {
     return(new ItemRequestOptions {
         IfMatchEtag = lease.ConcurrencyToken
     });
 }
 /// <summary>
 /// Checkpoint the lease.
 /// </summary>
 /// <param name="lease">Lease to renew</param>
 /// <param name="continuationToken">Continuation token</param>
 /// <returns>Updated renewed lease</returns>
 /// <exception cref="LeaseLostException">Thrown if other host acquired the lease or lease was deleted</exception>
 public abstract Task <DocumentServiceLease> CheckpointAsync(DocumentServiceLease lease, string continuationToken);
 private async Task <DocumentServiceLease> TryGetLeaseAsync(DocumentServiceLease lease)
 {
     return(await this.leaseContainer.TryGetItemAsync <DocumentServiceLease>(this.requestOptionsFactory.GetPartitionKey(lease.Id, lease.PartitionKey), lease.Id).ConfigureAwait(false));
 }
Пример #4
0
 public abstract Task <DocumentServiceLease> UpdateLeaseAsync(DocumentServiceLease cachedLease, string leaseId, object leasePartitionKey, Func <DocumentServiceLease, DocumentServiceLease> updateLease);
 /// <summary>
 /// Replace properties from the specified lease.
 /// </summary>
 /// <param name="leaseToUpdatePropertiesFrom">Lease containing new properties</param>
 /// <returns>Updated lease</returns>
 /// <exception cref="LeaseLostException">Thrown if other host acquired the lease</exception>
 public abstract Task <DocumentServiceLease> UpdatePropertiesAsync(DocumentServiceLease leaseToUpdatePropertiesFrom);
 /// <summary>
 /// Renew the lease. Leases are periodically renewed to prevent expiration.
 /// </summary>
 /// <param name="lease">Lease to renew</param>
 /// <returns>Updated renewed lease</returns>
 /// <exception cref="LeaseLostException">Thrown if other host acquired the lease or lease was deleted</exception>
 public abstract Task <DocumentServiceLease> RenewAsync(DocumentServiceLease lease);
 /// <summary>
 /// Release ownership of the lease.
 /// </summary>
 /// <param name="lease">Lease to acquire</param>
 /// <exception cref="LeaseLostException">Thrown if other host acquired the lease or lease was deleted</exception>
 public abstract Task ReleaseAsync(DocumentServiceLease lease);
 /// <summary>
 /// Acquire ownership of the lease.
 /// </summary>
 /// <param name="lease">Lease to acquire</param>
 /// <returns>Updated acquired lease</returns>
 /// <exception cref="LeaseLostException">Thrown if other host acquired concurrently</exception>
 public abstract Task <DocumentServiceLease> AcquireAsync(DocumentServiceLease lease);