public async Task <IUploadBlock> UploadBlock(IUpload upload, int number, Stream stream) { var partRequest = new UploadPartRequest(client.Region, upload, number); partRequest.SetStream(stream); return(await client.UploadPartAsync(partRequest).ConfigureAwait(false)); }
public async Task <UploadPartResult> UploadPartAsync(UploadPartRequest request) { using HttpResponseMessage response = await SendAsync2(request, request.CompletionOption).ConfigureAwait(false); return(new UploadPartResult( uploadId: request.UploadId, partNumber: request.PartNumber, eTag: response.Headers.ETag.Tag )); }
public async Task <UploadPartResult> UploadPartAsync(UploadPartRequest request) { using (var response = await SendAsync2(request).ConfigureAwait(false)) { return(new UploadPartResult( uploadId: request.UploadId, partNumber: request.PartNumber, eTag: response.Headers.ETag.Tag )); } }
public async Task <IUploadBlock> UploadBlock(IUpload upload, int number, Stream stream) { #region Preconditions if (upload == null) { throw new ArgumentNullException(nameof(upload)); } #endregion var request = new UploadPartRequest(client.Host, upload, number); request.SetStream(stream); return(await client.UploadPartAsync(request).ConfigureAwait(false)); }
public async Task <IUploadBlock> UploadPartAsync(IUpload upload, int number, Stream stream) { if (upload is null) { throw new ArgumentNullException(nameof(upload)); } var request = new UploadPartRequest( host: client.Host, bucketName: upload.BucketName, key: upload.ObjectName, uploadId: upload.UploadId, partNumber: number ); request.SetStream(stream); return(await client.UploadPartAsync(request).ConfigureAwait(false)); }
public async Task <IUploadBlock> UploadPartAsync(IUpload upload, int number, Stream stream) { if (upload is null) { throw new ArgumentNullException(nameof(upload)); } int retryCount = 0; Exception lastException; do { if (retryCount > 0) { await Task.Delay(retryPolicy.GetDelay(retryCount)).ConfigureAwait(false); } var request = new UploadPartRequest( host: client.Host, bucketName: upload.BucketName, key: upload.ObjectName, uploadId: upload.UploadId, partNumber: number ); request.SetStream(stream); try { return(await client.UploadPartAsync(request).ConfigureAwait(false)); } catch (S3Exception ex) when(ex.IsTransient) { lastException = ex; } stream.Position = 0; retryCount++; }while (retryPolicy.ShouldRetry(retryCount)); throw lastException; }