コード例 #1
0
        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)
コード例 #2
0
        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)
コード例 #3
0
        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);
        }