Skip to content

Commit

Permalink
Removes public API for transactional hashing for upcoming GA release (#…
Browse files Browse the repository at this point in the history
…27259)

* revert transactional checksums

* revert part 2

* exportapi

* fix md5 false condition

* fix mock

* fix datalake mock

* fix accidental file deletion

* changelog

Co-authored-by: jschrepp-MSFT <[email protected]>
Co-authored-by: Sean McCullough <[email protected]>
  • Loading branch information
3 people authored Mar 1, 2022
1 parent 35eb8d5 commit 1645ea5
Show file tree
Hide file tree
Showing 67 changed files with 2,703 additions and 2,442 deletions.
1 change: 1 addition & 0 deletions sdk/storage/Azure.Storage.Blobs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Fixed a bug where BlobBaseClient.DownloadTo() would result in an ObjectDisposedException on .NET Framework in certain network conditions.
- Added nullable version of `BlobProperties.CopyStatus` called `BlobCopyStatus`, allowing a null value when Storage doesn't return a value.
- Fixed a bug where BlobContainerClient.GetProperties() would throw an ArgumentNullException when the AccessPolicy was null
- Removed preview support for SDK-calculated transactional checksums on data transfer.

## 12.11.0-beta.3 (2022-02-07)
- Added support for service version 2021-04-10.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ 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.UploadTransactionalHashingOptions TransactionalHashingOptions { get { throw null; } set { } }
}
public partial class AppendBlobCreateOptions
{
Expand All @@ -283,7 +282,6 @@ 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.UploadTransactionalHashingOptions TransactionalHashingOptions { get { throw null; } set { } }
}
public partial class AppendBlobRequestConditions : Azure.Storage.Blobs.Models.BlobRequestConditions
{
Expand Down Expand Up @@ -509,7 +507,6 @@ 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.DownloadTransactionalHashingOptions TransactionalHashingOptions { get { throw null; } set { } }
}
public partial class BlobDownloadResult
{
Expand All @@ -529,7 +526,6 @@ public partial class BlobDownloadToOptions
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.DownloadTransactionalHashingOptions TransactionalHashingOptions { get { throw null; } set { } }
public Azure.Storage.StorageTransferOptions TransferOptions { get { throw null; } set { } }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
Expand Down Expand Up @@ -808,7 +804,6 @@ 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.DownloadTransactionalHashingOptions TransactionalHashingOptions { get { throw null; } set { } }
}
public partial class BlobOpenWriteOptions
{
Expand All @@ -819,7 +814,6 @@ 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.UploadTransactionalHashingOptions TransactionalHashingOptions { get { throw null; } set { } }
}
public partial class BlobProperties
{
Expand Down Expand Up @@ -1128,7 +1122,6 @@ public BlobUploadOptions() { }
public System.Collections.Generic.IDictionary<string, string> Metadata { 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.UploadTransactionalHashingOptions TransactionalHashingOptions { get { throw null; } set { } }
public Azure.Storage.StorageTransferOptions TransferOptions { get { throw null; } set { } }
}
public partial class BlockBlobOpenWriteOptions
Expand All @@ -1140,14 +1133,12 @@ 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.UploadTransactionalHashingOptions TransactionalHashingOptions { 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.UploadTransactionalHashingOptions TransactionalHashingOptions { get { throw null; } set { } }
}
public partial class BlockInfo
{
Expand Down Expand Up @@ -1299,7 +1290,6 @@ 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.UploadTransactionalHashingOptions TransactionalHashingOptions { get { throw null; } set { } }
}
public partial class PageBlobRequestConditions : Azure.Storage.Blobs.Models.BlobRequestConditions
{
Expand All @@ -1321,7 +1311,6 @@ 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.UploadTransactionalHashingOptions TransactionalHashingOptions { get { throw null; } set { } }
}
public partial class PageInfo
{
Expand Down
57 changes: 36 additions & 21 deletions sdk/storage/Azure.Storage.Blobs/src/AppendBlobClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1010,20 +1010,22 @@ public virtual Response<BlobAppendInfo> AppendBlock(
{
options = new AppendBlobAppendBlockOptions()
{
TransactionalHashingOptions = transactionalContentHash != default
? new UploadTransactionalHashingOptions()
{
Algorithm = TransactionalHashAlgorithm.MD5,
PrecalculatedHash = transactionalContentHash
}
: default,
// TODO #27253
//TransactionalHashingOptions = transactionalContentHash != default
// ? new UploadTransactionalHashingOptions()
// {
// Algorithm = TransactionalHashAlgorithm.MD5,
// PrecalculatedHash = transactionalContentHash
// }
// : default,
Conditions = conditions,
ProgressHandler = progressHandler
};
}
return AppendBlockInternal(
content,
options,
transactionalContentHash,
false, // async
cancellationToken)
.EnsureCompleted();
Expand Down Expand Up @@ -1085,20 +1087,22 @@ public virtual async Task<Response<BlobAppendInfo>> AppendBlockAsync(
{
options = new AppendBlobAppendBlockOptions()
{
TransactionalHashingOptions = transactionalContentHash != default
? new UploadTransactionalHashingOptions()
{
Algorithm = TransactionalHashAlgorithm.MD5,
PrecalculatedHash = transactionalContentHash
}
: default,
// TODO #27253
//TransactionalHashingOptions = transactionalContentHash != default
// ? new UploadTransactionalHashingOptions()
// {
// Algorithm = TransactionalHashAlgorithm.MD5,
// PrecalculatedHash = transactionalContentHash
// }
// : default,
Conditions = conditions,
ProgressHandler = progressHandler
};
}
return await AppendBlockInternal(
content,
options,
transactionalContentHash,
true, // async
cancellationToken)
.ConfigureAwait(false);
Expand Down Expand Up @@ -1141,6 +1145,7 @@ public virtual Response<BlobAppendInfo> AppendBlock(
AppendBlockInternal(
content,
options,
transactionalContentMD5: default,
false, // async
cancellationToken)
.EnsureCompleted();
Expand Down Expand Up @@ -1182,6 +1187,7 @@ public virtual async Task<Response<BlobAppendInfo>> AppendBlockAsync(
await AppendBlockInternal(
content,
options,
transactionalContentMD5: default,
true, // async
cancellationToken)
.ConfigureAwait(false);
Expand All @@ -1204,6 +1210,9 @@ await AppendBlockInternal(
/// <param name="options">
/// Optional parameters.
/// </param>
/// <param name="transactionalContentMD5">
/// Transactional MD5 for content verification.
/// </param>
/// <param name="async">
/// Whether to invoke the operation asynchronously.
/// </param>
Expand All @@ -1222,6 +1231,7 @@ await AppendBlockInternal(
internal async Task<Response<BlobAppendInfo>> AppendBlockInternal(
Stream content,
AppendBlobAppendBlockOptions options,
byte[] transactionalContentMD5,
bool async,
CancellationToken cancellationToken)
{
Expand Down Expand Up @@ -1250,7 +1260,8 @@ internal async Task<Response<BlobAppendInfo>> AppendBlockInternal(
Errors.VerifyStreamPosition(content, nameof(content));

// compute hash BEFORE attaching progress handler
ContentHasher.GetHashResult hashResult = ContentHasher.GetHashOrDefault(content, options?.TransactionalHashingOptions);
// TODO #27253
//ContentHasher.GetHashResult hashResult = ContentHasher.GetHashOrDefault(content, options?.TransactionalHashingOptions);

content = content.WithNoDispose().WithProgress(options?.ProgressHandler);

Expand All @@ -1261,8 +1272,9 @@ internal async Task<Response<BlobAppendInfo>> AppendBlockInternal(
response = await AppendBlobRestClient.AppendBlockAsync(
contentLength: (content.Length - content.Position),
body: content,
transactionalContentCrc64: hashResult?.StorageCrc64,
transactionalContentMD5: hashResult?.MD5,
// TODO #27253
//transactionalContentCrc64: hashResult?.StorageCrc64,
transactionalContentMD5: transactionalContentMD5, //hashResult?.MD5,
leaseId: options?.Conditions?.LeaseId,
maxSize: options?.Conditions?.IfMaxSizeLessThanOrEqual,
appendPosition: options?.Conditions?.IfAppendPositionEqual,
Expand All @@ -1283,8 +1295,9 @@ internal async Task<Response<BlobAppendInfo>> AppendBlockInternal(
response = AppendBlobRestClient.AppendBlock(
contentLength: (content.Length - content.Position),
body: content,
transactionalContentCrc64: hashResult?.StorageCrc64,
transactionalContentMD5: hashResult?.MD5,
// TODO #27253
//transactionalContentCrc64: hashResult?.StorageCrc64,
transactionalContentMD5: transactionalContentMD5, //hashResult?.MD5,
leaseId: options?.Conditions?.LeaseId,
maxSize: options?.Conditions?.IfMaxSizeLessThanOrEqual,
appendPosition: options?.Conditions?.IfAppendPositionEqual,
Expand Down Expand Up @@ -2050,8 +2063,10 @@ private async Task<Stream> OpenWriteInternal(
bufferSize: options?.BufferSize ?? Constants.DefaultBufferSize,
position: position,
conditions: conditions,
progressHandler: options?.ProgressHandler,
hashingOptions: options?.TransactionalHashingOptions);
progressHandler: options?.ProgressHandler
// TODO #27253
//options?.TransactionalHashingOptions
);
}
catch (Exception ex)
{
Expand Down
17 changes: 12 additions & 5 deletions sdk/storage/Azure.Storage.Blobs/src/AppendBlobWriteStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@ public AppendBlobWriteStream(
long bufferSize,
long position,
AppendBlobRequestConditions conditions,
IProgress<long> progressHandler,
UploadTransactionalHashingOptions hashingOptions) : base(
IProgress<long> progressHandler
// TODO #27253
//UploadTransactionalHashingOptions hashingOptions
) : base(
position,
bufferSize,
progressHandler,
hashingOptions)
progressHandler
// TODO #27253
//hashingOptions
)
{
ValidateBufferSize(bufferSize);
_appendBlobClient = appendBlobClient;
Expand All @@ -44,10 +48,13 @@ protected override async Task AppendInternal(
content: _buffer,
new AppendBlobAppendBlockOptions()
{
TransactionalHashingOptions = _hashingOptions,
// TODO #27253
//TransactionalHashingOptions = _hashingOptions,
Conditions = _conditions,
ProgressHandler = _progressHandler
},
// TODO #27253
transactionalContentMD5: default,
async: async,
cancellationToken: cancellationToken)
.ConfigureAwait(false);
Expand Down
Loading

0 comments on commit 1645ea5

Please sign in to comment.