Skip to content

Commit

Permalink
Address API Comments on Transfer Validation (#31759)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaschrep-msft authored Oct 12, 2022
1 parent ef716a3 commit f79d14c
Show file tree
Hide file tree
Showing 60 changed files with 275 additions and 297 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ await blockBlobClient.StageBlockAsync(
blockContentStream,
new BlockBlobStageBlockOptions
{
TransferValidationOptions = new UploadTransferValidationOptions
TransferValidation = new UploadTransferValidationOptions
{
ChecksumAlgorithm = StorageChecksumAlgorithm.MD5,
// a precalculated hash can be provided as follows,
Expand All @@ -703,7 +703,7 @@ Response<BlobDownloadStreamingResult> response = await blockBlobClient.DownloadS
{
// a range must be provided when requesting checksums; here we use transactional download max size
Range = new HttpRange(length: 4 * Constants.MB),
TransferValidationOptions = new DownloadTransferValidationOptions
TransferValidation = new DownloadTransferValidationOptions
{
ChecksumAlgorithm = StorageChecksumAlgorithm.MD5,
// SDK will validate against checksum for you
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public partial class AppendBlobAppendBlockOptions
public AppendBlobAppendBlockOptions() { }
public Azure.Storage.Blobs.Models.AppendBlobRequestConditions Conditions { get { throw null; } set { } }
public System.IProgress<long> ProgressHandler { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidation { get { throw null; } set { } }
}
public partial class AppendBlobCreateOptions
{
Expand All @@ -291,7 +291,7 @@ public AppendBlobOpenWriteOptions() { }
public long? BufferSize { get { throw null; } set { } }
public Azure.Storage.Blobs.Models.AppendBlobRequestConditions OpenConditions { get { throw null; } set { } }
public System.IProgress<long> ProgressHandler { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidation { get { throw null; } set { } }
}
public partial class AppendBlobRequestConditions : Azure.Storage.Blobs.Models.BlobRequestConditions
{
Expand Down Expand Up @@ -523,7 +523,7 @@ public BlobDownloadOptions() { }
public Azure.Storage.Blobs.Models.BlobRequestConditions Conditions { get { throw null; } set { } }
public System.IProgress<long> ProgressHandler { get { throw null; } set { } }
public Azure.HttpRange Range { get { throw null; } set { } }
public Azure.Storage.DownloadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
public Azure.Storage.DownloadTransferValidationOptions TransferValidation { get { throw null; } set { } }
}
public partial class BlobDownloadResult
{
Expand All @@ -544,7 +544,7 @@ public BlobDownloadToOptions() { }
public Azure.Storage.Blobs.Models.BlobRequestConditions Conditions { get { throw null; } set { } }
public System.IProgress<long> ProgressHandler { get { throw null; } set { } }
public Azure.Storage.StorageTransferOptions TransferOptions { get { throw null; } set { } }
public Azure.Storage.DownloadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
public Azure.Storage.DownloadTransferValidationOptions TransferValidation { get { throw null; } set { } }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct BlobErrorCode : System.IEquatable<Azure.Storage.Blobs.Models.BlobErrorCode>
Expand Down Expand Up @@ -822,7 +822,7 @@ public BlobOpenReadOptions(bool allowModifications) { }
public int? BufferSize { get { throw null; } set { } }
public Azure.Storage.Blobs.Models.BlobRequestConditions Conditions { get { throw null; } set { } }
public long Position { get { throw null; } set { } }
public Azure.Storage.DownloadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
public Azure.Storage.DownloadTransferValidationOptions TransferValidation { get { throw null; } set { } }
}
public partial class BlobOpenWriteOptions
{
Expand All @@ -833,7 +833,7 @@ public BlobOpenWriteOptions() { }
public Azure.Storage.Blobs.Models.BlobRequestConditions OpenConditions { get { throw null; } set { } }
public System.IProgress<long> ProgressHandler { get { throw null; } set { } }
public System.Collections.Generic.IDictionary<string, string> Tags { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidation { get { throw null; } set { } }
}
public partial class BlobProperties
{
Expand Down Expand Up @@ -1144,7 +1144,7 @@ public BlobUploadOptions() { }
public System.IProgress<long> ProgressHandler { get { throw null; } set { } }
public System.Collections.Generic.IDictionary<string, string> Tags { get { throw null; } set { } }
public Azure.Storage.StorageTransferOptions TransferOptions { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidation { get { throw null; } set { } }
}
public partial class BlockBlobOpenWriteOptions
{
Expand All @@ -1155,14 +1155,14 @@ public BlockBlobOpenWriteOptions() { }
public Azure.Storage.Blobs.Models.BlobRequestConditions OpenConditions { get { throw null; } set { } }
public System.IProgress<long> ProgressHandler { get { throw null; } set { } }
public System.Collections.Generic.IDictionary<string, string> Tags { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidation { get { throw null; } set { } }
}
public partial class BlockBlobStageBlockOptions
{
public BlockBlobStageBlockOptions() { }
public Azure.Storage.Blobs.Models.BlobRequestConditions Conditions { get { throw null; } set { } }
public System.IProgress<long> ProgressHandler { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidation { get { throw null; } set { } }
}
public partial class BlockInfo
{
Expand Down Expand Up @@ -1329,7 +1329,7 @@ public PageBlobOpenWriteOptions() { }
public Azure.Storage.Blobs.Models.PageBlobRequestConditions OpenConditions { get { throw null; } set { } }
public System.IProgress<long> ProgressHandler { get { throw null; } set { } }
public long? Size { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidation { get { throw null; } set { } }
}
public partial class PageBlobRequestConditions : Azure.Storage.Blobs.Models.BlobRequestConditions
{
Expand All @@ -1351,7 +1351,7 @@ public partial class PageBlobUploadPagesOptions
public PageBlobUploadPagesOptions() { }
public Azure.Storage.Blobs.Models.PageBlobRequestConditions Conditions { get { throw null; } set { } }
public System.IProgress<long> ProgressHandler { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidation { get { throw null; } set { } }
}
public partial class PageInfo
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public partial class AppendBlobAppendBlockOptions
public AppendBlobAppendBlockOptions() { }
public Azure.Storage.Blobs.Models.AppendBlobRequestConditions Conditions { get { throw null; } set { } }
public System.IProgress<long> ProgressHandler { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidation { get { throw null; } set { } }
}
public partial class AppendBlobCreateOptions
{
Expand All @@ -291,7 +291,7 @@ public AppendBlobOpenWriteOptions() { }
public long? BufferSize { get { throw null; } set { } }
public Azure.Storage.Blobs.Models.AppendBlobRequestConditions OpenConditions { get { throw null; } set { } }
public System.IProgress<long> ProgressHandler { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidation { get { throw null; } set { } }
}
public partial class AppendBlobRequestConditions : Azure.Storage.Blobs.Models.BlobRequestConditions
{
Expand Down Expand Up @@ -523,7 +523,7 @@ public BlobDownloadOptions() { }
public Azure.Storage.Blobs.Models.BlobRequestConditions Conditions { get { throw null; } set { } }
public System.IProgress<long> ProgressHandler { get { throw null; } set { } }
public Azure.HttpRange Range { get { throw null; } set { } }
public Azure.Storage.DownloadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
public Azure.Storage.DownloadTransferValidationOptions TransferValidation { get { throw null; } set { } }
}
public partial class BlobDownloadResult
{
Expand All @@ -544,7 +544,7 @@ public BlobDownloadToOptions() { }
public Azure.Storage.Blobs.Models.BlobRequestConditions Conditions { get { throw null; } set { } }
public System.IProgress<long> ProgressHandler { get { throw null; } set { } }
public Azure.Storage.StorageTransferOptions TransferOptions { get { throw null; } set { } }
public Azure.Storage.DownloadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
public Azure.Storage.DownloadTransferValidationOptions TransferValidation { get { throw null; } set { } }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct BlobErrorCode : System.IEquatable<Azure.Storage.Blobs.Models.BlobErrorCode>
Expand Down Expand Up @@ -822,7 +822,7 @@ public BlobOpenReadOptions(bool allowModifications) { }
public int? BufferSize { get { throw null; } set { } }
public Azure.Storage.Blobs.Models.BlobRequestConditions Conditions { get { throw null; } set { } }
public long Position { get { throw null; } set { } }
public Azure.Storage.DownloadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
public Azure.Storage.DownloadTransferValidationOptions TransferValidation { get { throw null; } set { } }
}
public partial class BlobOpenWriteOptions
{
Expand All @@ -833,7 +833,7 @@ public BlobOpenWriteOptions() { }
public Azure.Storage.Blobs.Models.BlobRequestConditions OpenConditions { get { throw null; } set { } }
public System.IProgress<long> ProgressHandler { get { throw null; } set { } }
public System.Collections.Generic.IDictionary<string, string> Tags { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidation { get { throw null; } set { } }
}
public partial class BlobProperties
{
Expand Down Expand Up @@ -1144,7 +1144,7 @@ public BlobUploadOptions() { }
public System.IProgress<long> ProgressHandler { get { throw null; } set { } }
public System.Collections.Generic.IDictionary<string, string> Tags { get { throw null; } set { } }
public Azure.Storage.StorageTransferOptions TransferOptions { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidation { get { throw null; } set { } }
}
public partial class BlockBlobOpenWriteOptions
{
Expand All @@ -1155,14 +1155,14 @@ public BlockBlobOpenWriteOptions() { }
public Azure.Storage.Blobs.Models.BlobRequestConditions OpenConditions { get { throw null; } set { } }
public System.IProgress<long> ProgressHandler { get { throw null; } set { } }
public System.Collections.Generic.IDictionary<string, string> Tags { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidation { get { throw null; } set { } }
}
public partial class BlockBlobStageBlockOptions
{
public BlockBlobStageBlockOptions() { }
public Azure.Storage.Blobs.Models.BlobRequestConditions Conditions { get { throw null; } set { } }
public System.IProgress<long> ProgressHandler { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidation { get { throw null; } set { } }
}
public partial class BlockInfo
{
Expand Down Expand Up @@ -1329,7 +1329,7 @@ public PageBlobOpenWriteOptions() { }
public Azure.Storage.Blobs.Models.PageBlobRequestConditions OpenConditions { get { throw null; } set { } }
public System.IProgress<long> ProgressHandler { get { throw null; } set { } }
public long? Size { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidation { get { throw null; } set { } }
}
public partial class PageBlobRequestConditions : Azure.Storage.Blobs.Models.BlobRequestConditions
{
Expand All @@ -1351,7 +1351,7 @@ public partial class PageBlobUploadPagesOptions
public PageBlobUploadPagesOptions() { }
public Azure.Storage.Blobs.Models.PageBlobRequestConditions Conditions { get { throw null; } set { } }
public System.IProgress<long> ProgressHandler { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
public Azure.Storage.UploadTransferValidationOptions TransferValidation { get { throw null; } set { } }
}
public partial class PageInfo
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ await blockBlobClient.StageBlockAsync(
blockContentStream,
new BlockBlobStageBlockOptions
{
TransferValidationOptions = new UploadTransferValidationOptions
TransferValidation = new UploadTransferValidationOptions
{
ChecksumAlgorithm = StorageChecksumAlgorithm.MD5,
// a precalculated hash can be provided as follows,
Expand All @@ -972,7 +972,7 @@ await blockBlobClient.StageBlockAsync(
{
// a range must be provided when requesting checksums; here we use transactional download max size
Range = new HttpRange(length: 4 * Constants.MB),
TransferValidationOptions = new DownloadTransferValidationOptions
TransferValidation = new DownloadTransferValidationOptions
{
ChecksumAlgorithm = StorageChecksumAlgorithm.MD5,
// SDK will validate against checksum for you
Expand Down
12 changes: 6 additions & 6 deletions sdk/storage/Azure.Storage.Blobs/src/AppendBlobClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,7 @@ public virtual Response<BlobAppendInfo> AppendBlock(
CancellationToken cancellationToken = default) =>
AppendBlockInternal(
content,
options?.TransferValidationOptions,
options?.TransferValidation,
options?.Conditions,
options?.ProgressHandler,
false, // async
Expand Down Expand Up @@ -1159,7 +1159,7 @@ public virtual async Task<Response<BlobAppendInfo>> AppendBlockAsync(
CancellationToken cancellationToken = default) =>
await AppendBlockInternal(
content,
options?.TransferValidationOptions,
options?.TransferValidation,
options?.Conditions,
options?.ProgressHandler,
true, // async
Expand All @@ -1181,7 +1181,7 @@ await AppendBlockInternal(
/// A <see cref="Stream"/> containing the content of the block to
/// append.
/// </param>
/// <param name="validationOptionsOverride">
/// <param name="transferValidationOverride">
/// Validation options for content verification.
/// </param>
/// <param name="conditions">
Expand All @@ -1207,13 +1207,13 @@ await AppendBlockInternal(
/// </remarks>
internal async Task<Response<BlobAppendInfo>> AppendBlockInternal(
Stream content,
UploadTransferValidationOptions validationOptionsOverride,
UploadTransferValidationOptions transferValidationOverride,
AppendBlobRequestConditions conditions,
IProgress<long> progressHandler,
bool async,
CancellationToken cancellationToken)
{
UploadTransferValidationOptions validationOptions = validationOptionsOverride ?? ClientConfiguration.TransferValidation.Upload;
UploadTransferValidationOptions validationOptions = transferValidationOverride ?? ClientConfiguration.TransferValidation.Upload;

using (ClientConfiguration.Pipeline.BeginLoggingScope(nameof(AppendBlobClient)))
{
Expand Down Expand Up @@ -2041,7 +2041,7 @@ private async Task<Stream> OpenWriteInternal(
position: position,
conditions: conditions,
progressHandler: options?.ProgressHandler,
options?.TransferValidationOptions
options?.TransferValidation
);
}
catch (Exception ex)
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/Azure.Storage.Blobs/src/AppendBlobWriteStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ public AppendBlobWriteStream(
long position,
AppendBlobRequestConditions conditions,
IProgress<long> progressHandler,
UploadTransferValidationOptions validationOptions
UploadTransferValidationOptions transferValidation
) : base(
position,
bufferSize,
progressHandler,
validationOptions
transferValidation
)
{
ValidateBufferSize(bufferSize);
Expand Down
Loading

0 comments on commit f79d14c

Please sign in to comment.