Skip to content

Commit b14a49d

Browse files
authored
[Storage] [DataMovement] Made the respective members public to protected internal members (Azure#37604)
* Changed all valid members of the StorageResource class to either protected or protected internal * Updated Changelog * PR comments
1 parent d9bba26 commit b14a49d

22 files changed

+478
-274
lines changed

sdk/storage/Azure.Storage.DataMovement.Blobs/CHANGELOG.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,22 @@
55
### Features Added
66

77
### Breaking Changes
8-
8+
- [BREAKING CHANGE] Made the following members `public` to `protected` members (including all derived classes):
9+
- `BlobStorageResourceContainer.CanProduceUri`
10+
- `BlobStorageResourceContainer.GetStorageResourcesAsync`
11+
- `*BlobStorageResource.CanProduceUri`
12+
- `*BlobStorageResource.Length`
13+
- `*BlobStorageResource.MaxChunkSize`
14+
- `*BlobStorageResource.ResourceId`
15+
- `*BlobStorageResource.TransferType`
16+
- `*BlobStorageResource.CompleteTransferAsync`
17+
- `*BlobStorageResource.CopyBlockFromUriAsync`
18+
- `*BlobStorageResource.CopyFromUriAsync`
19+
- `*BlobStorageResource.DeleteIfExistsAsync`
20+
- `*BlobStorageResource.GetCopyAuthorizationHeaderAsync`
21+
- `*BlobStorageResource.GetPropertiesAsync`
22+
- `*BlobStorageResource.ReadStreamAsync`
23+
- `*BlobStorageResource.WriteFromStreamAsync`
924
### Bugs Fixed
1025

1126
### Other Changes

sdk/storage/Azure.Storage.DataMovement.Blobs/api/Azure.Storage.DataMovement.Blobs.net6.0.cs

Lines changed: 42 additions & 42 deletions
Large diffs are not rendered by default.

sdk/storage/Azure.Storage.DataMovement.Blobs/api/Azure.Storage.DataMovement.Blobs.netstandard2.0.cs

Lines changed: 42 additions & 42 deletions
Large diffs are not rendered by default.

sdk/storage/Azure.Storage.DataMovement.Blobs/src/AppendBlobStorageResource.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ public class AppendBlobStorageResource : StorageResourceSingle
1919
{
2020
internal AppendBlobClient BlobClient { get; set; }
2121
internal AppendBlobStorageResourceOptions _options;
22-
private long? _length;
23-
private ETag? _etagDownloadLock = default;
22+
internal long? _length;
23+
internal ETag? _etagDownloadLock = default;
2424

2525
/// <summary>
2626
/// The identifier for the type of storage resource.
2727
/// </summary>
28-
public override string ResourceId => "AppendBlob";
28+
protected override string ResourceId => "AppendBlob";
2929

3030
/// <summary>
3131
/// Gets the URL of the storage resource.
@@ -40,24 +40,24 @@ public class AppendBlobStorageResource : StorageResourceSingle
4040
/// <summary>
4141
/// Defines whether the storage resource type can produce a web URL.
4242
/// </summary>
43-
public override bool CanProduceUri => true;
43+
protected override bool CanProduceUri => true;
4444

4545
/// <summary>
4646
/// Defines the recommended Transfer Type for the storage resource.
4747
/// </summary>
48-
public override TransferType TransferType => TransferType.Sequential;
48+
protected override TransferType TransferType => TransferType.Sequential;
4949

5050
/// <summary>
5151
/// Defines the maximum chunk size for the storage resource.
5252
/// </summary>
53-
public override long MaxChunkSize => Constants.Blob.Append.MaxAppendBlockBytes;
53+
protected override long MaxChunkSize => Constants.Blob.Append.MaxAppendBlockBytes;
5454

5555
/// <summary>
5656
/// Length of the storage resource. This information is obtained during a GetStorageResources API call.
5757
///
5858
/// Will return default if the length was not set by a GetStorageResources API call.
5959
/// </summary>
60-
public override long? Length => _length;
60+
protected override long? Length => _length;
6161

6262
/// <summary>
6363
/// The constructor for a new instance of the <see cref="AppendBlobStorageResource"/>
@@ -104,7 +104,7 @@ internal AppendBlobStorageResource(
104104
/// notifications that the operation should be cancelled.
105105
/// </param>
106106
/// <returns>The <see cref="ReadStreamStorageResourceResult"/> resulting from the upload operation.</returns>
107-
public override async Task<ReadStreamStorageResourceResult> ReadStreamAsync(
107+
protected override async Task<ReadStreamStorageResourceResult> ReadStreamAsync(
108108
long position = 0,
109109
long? length = default,
110110
CancellationToken cancellationToken = default)
@@ -135,7 +135,7 @@ public override async Task<ReadStreamStorageResourceResult> ReadStreamAsync(
135135
/// notifications that the operation should be cancelled.
136136
/// </param>
137137
/// <returns></returns>
138-
public override async Task WriteFromStreamAsync(
138+
protected override async Task WriteFromStreamAsync(
139139
Stream stream,
140140
long streamLength,
141141
bool overwrite,
@@ -176,7 +176,7 @@ await BlobClient.AppendBlockAsync(
176176
/// notifications that the operation should be cancelled.
177177
/// </param>
178178
/// <returns></returns>
179-
public override async Task CopyFromUriAsync(
179+
protected override async Task CopyFromUriAsync(
180180
StorageResourceSingle sourceResource,
181181
bool overwrite,
182182
long completeLength,
@@ -218,7 +218,7 @@ await BlobClient.AppendBlockFromUriAsync(
218218
/// notifications that the operation should be cancelled.
219219
/// </param>
220220
/// <returns></returns>
221-
public override async Task CopyBlockFromUriAsync(
221+
protected override async Task CopyBlockFromUriAsync(
222222
StorageResourceSingle sourceResource,
223223
HttpRange range,
224224
bool overwrite,
@@ -247,7 +247,7 @@ await BlobClient.AppendBlockFromUriAsync(
247247
/// See <see cref="StorageResourceProperties"/>.
248248
/// </summary>
249249
/// <returns>Returns the properties of the Append Blob Storage Resource. See <see cref="StorageResourceProperties"/>.</returns>
250-
public override async Task<StorageResourceProperties> GetPropertiesAsync(CancellationToken cancellationToken = default)
250+
protected override async Task<StorageResourceProperties> GetPropertiesAsync(CancellationToken cancellationToken = default)
251251
{
252252
Response<BlobProperties> response = await BlobClient.GetPropertiesAsync(cancellationToken: cancellationToken).ConfigureAwait(false);
253253
GrabEtag(response.GetRawResponse());
@@ -265,15 +265,15 @@ public override async Task<StorageResourceProperties> GetPropertiesAsync(Cancell
265265
/// Gets the HTTP Authorization header for the storage resource if available. If not available
266266
/// will return default.
267267
/// </returns>
268-
public override async Task<HttpAuthorization> GetCopyAuthorizationHeaderAsync(CancellationToken cancellationToken = default)
268+
protected override async Task<HttpAuthorization> GetCopyAuthorizationHeaderAsync(CancellationToken cancellationToken = default)
269269
{
270270
return await BlobBaseClientInternals.GetCopyAuthorizationTokenAsync(BlobClient, cancellationToken).ConfigureAwait(false);
271271
}
272272

273273
/// <summary>
274274
/// Commits the block list given.
275275
/// </summary>
276-
public override Task CompleteTransferAsync(bool overwrite, CancellationToken cancellationToken = default)
276+
protected override Task CompleteTransferAsync(bool overwrite, CancellationToken cancellationToken = default)
277277
{
278278
// no-op for now
279279
return Task.CompletedTask;
@@ -290,7 +290,7 @@ public override Task CompleteTransferAsync(bool overwrite, CancellationToken can
290290
/// If the storage resource exists and is deleted, true will be returned.
291291
/// Otherwise if the storage resource does not exist, false will be returned.
292292
/// </returns>
293-
public override async Task<bool> DeleteIfExistsAsync(CancellationToken cancellationToken = default)
293+
protected override async Task<bool> DeleteIfExistsAsync(CancellationToken cancellationToken = default)
294294
{
295295
return await BlobClient.DeleteIfExistsAsync(cancellationToken: cancellationToken).ConfigureAwait(false);
296296
}

sdk/storage/Azure.Storage.DataMovement.Blobs/src/BlobStorageResourceContainer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public BlobStorageResourceContainer(BlobContainerClient blobContainerClient, Blo
5050
/// <summary>
5151
/// Defines whether the storage resource type can produce a web URL.
5252
/// </summary>
53-
public override bool CanProduceUri => true;
53+
protected override bool CanProduceUri => true;
5454

5555
/// <summary>
5656
/// Gets the path of the storage resource.
@@ -67,7 +67,7 @@ public BlobStorageResourceContainer(BlobContainerClient blobContainerClient, Blo
6767
/// Retrieves a single blob resource based on this respective resource.
6868
/// </summary>
6969
/// <param name="path">The path to the storage resource, relative to the directory prefix if any.</param>
70-
public override StorageResourceSingle GetChildStorageResource(string path)
70+
protected override StorageResourceSingle GetChildStorageResource(string path)
7171
=> GetBlobAsStorageResource(ApplyOptionalPrefix(path), type: _options?.BlobType ?? BlobType.Block);
7272

7373
/// <summary>
@@ -123,7 +123,7 @@ private StorageResourceSingle GetBlobAsStorageResource(
123123
/// Because blobs is a flat namespace, virtual directories will not be returned.
124124
/// </summary>
125125
/// <returns>List of the child resources in the storage container.</returns>
126-
public override async IAsyncEnumerable<StorageResource> GetStorageResourcesAsync(
126+
protected override async IAsyncEnumerable<StorageResource> GetStorageResourcesAsync(
127127
[EnumeratorCancellation] CancellationToken cancellationToken = default)
128128
{
129129
AsyncPageable<BlobItem> pages = _blobContainerClient.GetBlobsAsync(

sdk/storage/Azure.Storage.DataMovement.Blobs/src/BlockBlobStorageResource.cs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using Azure.Storage.Blobs.Models;
1313
using Azure.Storage.Blobs.Specialized;
1414
using Azure.Storage.DataMovement.Models;
15+
using Azure.Storage.Shared;
1516

1617
namespace Azure.Storage.DataMovement.Blobs
1718
{
@@ -22,19 +23,19 @@ public class BlockBlobStorageResource : StorageResourceSingle
2223
{
2324
internal BlockBlobClient BlobClient { get; set; }
2425
internal BlockBlobStorageResourceOptions _options;
26+
internal long? _length;
27+
internal ETag? _etagDownloadLock = default;
2528

2629
/// <summary>
2730
/// In order to ensure the block list is sent in the correct order
2831
/// we will order them by the offset (i.e. {offset, block_id}).
2932
/// </summary>
3033
private ConcurrentDictionary<long, string> _blocks;
31-
private long? _length;
32-
private ETag? _etagDownloadLock = default;
3334

3435
/// <summary>
3536
/// The identifier for the type of storage resource.
3637
/// </summary>
37-
public override string ResourceId => "BlockBlob";
38+
protected override string ResourceId => "BlockBlob";
3839

3940
/// <summary>
4041
/// Gets the URL of the storage resource.
@@ -49,12 +50,12 @@ public class BlockBlobStorageResource : StorageResourceSingle
4950
/// <summary>
5051
/// Defines whether the storage resource type can produce a web URL.
5152
/// </summary>
52-
public override bool CanProduceUri => true;
53+
protected override bool CanProduceUri => true;
5354

5455
/// <summary>
5556
/// Defines the recommended Transfer Type of the storage resource.
5657
/// </summary>
57-
public override TransferType TransferType => TransferType.Concurrent;
58+
protected override TransferType TransferType => TransferType.Concurrent;
5859

5960
/// <summary>
6061
/// Store Max Initial Size that a Put Blob can get to.
@@ -64,14 +65,14 @@ public class BlockBlobStorageResource : StorageResourceSingle
6465
/// <summary>
6566
/// Defines the maximum chunk size for the storage resource.
6667
/// </summary>
67-
public override long MaxChunkSize => Constants.Blob.Block.MaxStageBytes;
68+
protected override long MaxChunkSize => Constants.Blob.Block.MaxStageBytes;
6869

6970
/// <summary>
7071
/// Length of the storage resource. This information is can obtained during a GetStorageResources API call.
7172
///
7273
/// Will return default if the length was not set by a GetStorageResources API call.
7374
/// </summary>
74-
public override long? Length => _length;
75+
protected override long? Length => _length;
7576

7677
/// <summary>
7778
/// The constructor for a new instance of the <see cref="AppendBlobStorageResource"/>
@@ -120,7 +121,7 @@ internal BlockBlobStorageResource(
120121
/// Optional <see cref="CancellationToken"/> to propagate
121122
/// notifications that the operation should be cancelled.</param>
122123
/// <returns>The <see cref="ReadStreamStorageResourceResult"/> resulting from the upload operation.</returns>
123-
public override async Task<ReadStreamStorageResourceResult> ReadStreamAsync(
124+
protected override async Task<ReadStreamStorageResourceResult> ReadStreamAsync(
124125
long position = 0,
125126
long? length = default,
126127
CancellationToken cancellationToken = default)
@@ -153,7 +154,7 @@ await BlobClient.DownloadStreamingAsync(
153154
/// notifications that the operation should be cancelled.
154155
/// </param>
155156
/// <returns></returns>
156-
public override async Task WriteFromStreamAsync(
157+
protected override async Task WriteFromStreamAsync(
157158
Stream stream,
158159
long streamLength,
159160
bool overwrite,
@@ -174,7 +175,7 @@ await BlobClient.UploadAsync(
174175
return;
175176
}
176177

177-
string id = Shared.StorageExtensions.GenerateBlockId(position);
178+
string id = Azure.Storage.Shared.StorageExtensions.GenerateBlockId(position);
178179
if (!_blocks.TryAdd(position, id))
179180
{
180181
throw new ArgumentException($"Cannot Stage Block to the specific offset \"{position}\", it already exists in the block list.");
@@ -203,7 +204,7 @@ await BlobClient.StageBlockAsync(
203204
/// notifications that the operation should be cancelled.
204205
/// </param>
205206
/// <returns></returns>
206-
public override async Task CopyFromUriAsync(
207+
protected override async Task CopyFromUriAsync(
207208
StorageResourceSingle sourceResource,
208209
bool overwrite,
209210
long completeLength,
@@ -238,7 +239,7 @@ await BlobClient.SyncUploadFromUriAsync(
238239
/// notifications that the operation should be cancelled.
239240
/// </param>
240241
/// <returns></returns>
241-
public override async Task CopyBlockFromUriAsync(
242+
protected override async Task CopyBlockFromUriAsync(
242243
StorageResourceSingle sourceResource,
243244
HttpRange range,
244245
bool overwrite,
@@ -270,7 +271,7 @@ await BlobClient.StageBlockFromUriAsync(
270271
/// notifications that the operation should be cancelled.
271272
/// </param>
272273
/// <returns>Returns the properties of the Storage Resource. See <see cref="StorageResourceProperties"/>.</returns>
273-
public override async Task<StorageResourceProperties> GetPropertiesAsync(CancellationToken cancellationToken = default)
274+
protected override async Task<StorageResourceProperties> GetPropertiesAsync(CancellationToken cancellationToken = default)
274275
{
275276
CancellationHelper.ThrowIfCancellationRequested(cancellationToken);
276277
Response<BlobProperties> response = await BlobClient.GetPropertiesAsync(cancellationToken: cancellationToken).ConfigureAwait(false);
@@ -289,7 +290,7 @@ public override async Task<StorageResourceProperties> GetPropertiesAsync(Cancell
289290
/// Gets the HTTP Authorization header for the storage resource if available. If not available
290291
/// will return default.
291292
/// </returns>
292-
public override async Task<HttpAuthorization> GetCopyAuthorizationHeaderAsync(CancellationToken cancellationToken = default)
293+
protected override async Task<HttpAuthorization> GetCopyAuthorizationHeaderAsync(CancellationToken cancellationToken = default)
293294
{
294295
return await BlobBaseClientInternals.GetCopyAuthorizationTokenAsync(BlobClient, cancellationToken).ConfigureAwait(false);
295296
}
@@ -305,7 +306,7 @@ public override async Task<HttpAuthorization> GetCopyAuthorizationHeaderAsync(Ca
305306
/// notifications that the operation should be cancelled.
306307
/// </param>
307308
/// <returns>The Task which Commits the list of ids</returns>
308-
public override async Task CompleteTransferAsync(
309+
protected override async Task CompleteTransferAsync(
309310
bool overwrite,
310311
CancellationToken cancellationToken = default)
311312
{
@@ -332,7 +333,7 @@ await BlobClient.CommitBlockListAsync(
332333
/// If the storage resource exists and is deleted, true will be returned.
333334
/// Otherwise if the storage resource does not exist, false will be returned.
334335
/// </returns>
335-
public override async Task<bool> DeleteIfExistsAsync(CancellationToken cancellationToken = default)
336+
protected override async Task<bool> DeleteIfExistsAsync(CancellationToken cancellationToken = default)
336337
{
337338
return await BlobClient.DeleteIfExistsAsync(cancellationToken: cancellationToken).ConfigureAwait(false);
338339
}

sdk/storage/Azure.Storage.DataMovement.Blobs/src/DataMovementBlobsExtensions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
using System.IO;
54
using System.Threading.Tasks;
65
using System.Threading;
76
using Azure.Storage.Blobs.Models;

0 commit comments

Comments
 (0)