private async Task <bool> ExistsOnCloudAsync(Sha1 objectId, ChasmRequestContext requestContext = default, CancellationToken cancellationToken = default) { requestContext = ChasmRequestContext.Ensure(requestContext); var opContext = new OperationContext { ClientRequestID = requestContext.CorrelationId, CustomUserAgent = requestContext.CustomUserAgent }; string blobName = DeriveBlobName(objectId); CloudBlobContainer objectsContainer = _objectsContainer.Value; CloudAppendBlob blobRef = objectsContainer.GetAppendBlobReference(blobName); bool exists = await blobRef.ExistsAsync(default, opContext, cancellationToken)
private async Task <bool> ExistsOnCloudAsync(Sha1 objectId, ChasmRequestContext requestContext = default, CancellationToken cancellationToken = default) { requestContext = ChasmRequestContext.Ensure(requestContext); var opContext = new OperationContext { ClientRequestID = requestContext.CorrelationId, CustomUserAgent = requestContext.CustomUserAgent }; CloudTable objectsTable = _objectsTable.Value; TableOperation op = DataEntity.BuildExistsOperation(objectId); try { TableResult result = await objectsTable.ExecuteAsync(op, default, opContext, cancellationToken)
public override async Task <bool> ExistsAsync(Sha1 objectId, ChasmRequestContext requestContext = default, CancellationToken cancellationToken = default) { requestContext = ChasmRequestContext.Ensure(requestContext); // Try disk repo first bool exists = await _diskRepo.ExistsAsync(objectId, requestContext, cancellationToken) .ConfigureAwait(false); // Else go to cloud if (!exists) { exists = await ExistsOnCloudAsync(objectId, requestContext, cancellationToken) .ConfigureAwait(false); } return(exists); }