12
12
using Azure . Storage . Blobs . Models ;
13
13
using Azure . Storage . Blobs . Specialized ;
14
14
using Azure . Storage . DataMovement . Models ;
15
+ using Azure . Storage . Shared ;
15
16
16
17
namespace Azure . Storage . DataMovement . Blobs
17
18
{
@@ -22,19 +23,19 @@ public class BlockBlobStorageResource : StorageResourceSingle
22
23
{
23
24
internal BlockBlobClient BlobClient { get ; set ; }
24
25
internal BlockBlobStorageResourceOptions _options ;
26
+ internal long ? _length ;
27
+ internal ETag ? _etagDownloadLock = default ;
25
28
26
29
/// <summary>
27
30
/// In order to ensure the block list is sent in the correct order
28
31
/// we will order them by the offset (i.e. {offset, block_id}).
29
32
/// </summary>
30
33
private ConcurrentDictionary < long , string > _blocks ;
31
- private long ? _length ;
32
- private ETag ? _etagDownloadLock = default ;
33
34
34
35
/// <summary>
35
36
/// The identifier for the type of storage resource.
36
37
/// </summary>
37
- public override string ResourceId => "BlockBlob" ;
38
+ protected override string ResourceId => "BlockBlob" ;
38
39
39
40
/// <summary>
40
41
/// Gets the URL of the storage resource.
@@ -49,12 +50,12 @@ public class BlockBlobStorageResource : StorageResourceSingle
49
50
/// <summary>
50
51
/// Defines whether the storage resource type can produce a web URL.
51
52
/// </summary>
52
- public override bool CanProduceUri => true ;
53
+ protected override bool CanProduceUri => true ;
53
54
54
55
/// <summary>
55
56
/// Defines the recommended Transfer Type of the storage resource.
56
57
/// </summary>
57
- public override TransferType TransferType => TransferType . Concurrent ;
58
+ protected override TransferType TransferType => TransferType . Concurrent ;
58
59
59
60
/// <summary>
60
61
/// Store Max Initial Size that a Put Blob can get to.
@@ -64,14 +65,14 @@ public class BlockBlobStorageResource : StorageResourceSingle
64
65
/// <summary>
65
66
/// Defines the maximum chunk size for the storage resource.
66
67
/// </summary>
67
- public override long MaxChunkSize => Constants . Blob . Block . MaxStageBytes ;
68
+ protected override long MaxChunkSize => Constants . Blob . Block . MaxStageBytes ;
68
69
69
70
/// <summary>
70
71
/// Length of the storage resource. This information is can obtained during a GetStorageResources API call.
71
72
///
72
73
/// Will return default if the length was not set by a GetStorageResources API call.
73
74
/// </summary>
74
- public override long ? Length => _length ;
75
+ protected override long ? Length => _length ;
75
76
76
77
/// <summary>
77
78
/// The constructor for a new instance of the <see cref="AppendBlobStorageResource"/>
@@ -120,7 +121,7 @@ internal BlockBlobStorageResource(
120
121
/// Optional <see cref="CancellationToken"/> to propagate
121
122
/// notifications that the operation should be cancelled.</param>
122
123
/// <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 (
124
125
long position = 0 ,
125
126
long ? length = default ,
126
127
CancellationToken cancellationToken = default )
@@ -153,7 +154,7 @@ await BlobClient.DownloadStreamingAsync(
153
154
/// notifications that the operation should be cancelled.
154
155
/// </param>
155
156
/// <returns></returns>
156
- public override async Task WriteFromStreamAsync (
157
+ protected override async Task WriteFromStreamAsync (
157
158
Stream stream ,
158
159
long streamLength ,
159
160
bool overwrite ,
@@ -174,7 +175,7 @@ await BlobClient.UploadAsync(
174
175
return ;
175
176
}
176
177
177
- string id = Shared . StorageExtensions . GenerateBlockId ( position ) ;
178
+ string id = Azure . Storage . Shared . StorageExtensions . GenerateBlockId ( position ) ;
178
179
if ( ! _blocks . TryAdd ( position , id ) )
179
180
{
180
181
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(
203
204
/// notifications that the operation should be cancelled.
204
205
/// </param>
205
206
/// <returns></returns>
206
- public override async Task CopyFromUriAsync (
207
+ protected override async Task CopyFromUriAsync (
207
208
StorageResourceSingle sourceResource ,
208
209
bool overwrite ,
209
210
long completeLength ,
@@ -238,7 +239,7 @@ await BlobClient.SyncUploadFromUriAsync(
238
239
/// notifications that the operation should be cancelled.
239
240
/// </param>
240
241
/// <returns></returns>
241
- public override async Task CopyBlockFromUriAsync (
242
+ protected override async Task CopyBlockFromUriAsync (
242
243
StorageResourceSingle sourceResource ,
243
244
HttpRange range ,
244
245
bool overwrite ,
@@ -270,7 +271,7 @@ await BlobClient.StageBlockFromUriAsync(
270
271
/// notifications that the operation should be cancelled.
271
272
/// </param>
272
273
/// <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 )
274
275
{
275
276
CancellationHelper . ThrowIfCancellationRequested ( cancellationToken ) ;
276
277
Response < BlobProperties > response = await BlobClient . GetPropertiesAsync ( cancellationToken : cancellationToken ) . ConfigureAwait ( false ) ;
@@ -289,7 +290,7 @@ public override async Task<StorageResourceProperties> GetPropertiesAsync(Cancell
289
290
/// Gets the HTTP Authorization header for the storage resource if available. If not available
290
291
/// will return default.
291
292
/// </returns>
292
- public override async Task < HttpAuthorization > GetCopyAuthorizationHeaderAsync ( CancellationToken cancellationToken = default )
293
+ protected override async Task < HttpAuthorization > GetCopyAuthorizationHeaderAsync ( CancellationToken cancellationToken = default )
293
294
{
294
295
return await BlobBaseClientInternals . GetCopyAuthorizationTokenAsync ( BlobClient , cancellationToken ) . ConfigureAwait ( false ) ;
295
296
}
@@ -305,7 +306,7 @@ public override async Task<HttpAuthorization> GetCopyAuthorizationHeaderAsync(Ca
305
306
/// notifications that the operation should be cancelled.
306
307
/// </param>
307
308
/// <returns>The Task which Commits the list of ids</returns>
308
- public override async Task CompleteTransferAsync (
309
+ protected override async Task CompleteTransferAsync (
309
310
bool overwrite ,
310
311
CancellationToken cancellationToken = default )
311
312
{
@@ -332,7 +333,7 @@ await BlobClient.CommitBlockListAsync(
332
333
/// If the storage resource exists and is deleted, true will be returned.
333
334
/// Otherwise if the storage resource does not exist, false will be returned.
334
335
/// </returns>
335
- public override async Task < bool > DeleteIfExistsAsync ( CancellationToken cancellationToken = default )
336
+ protected override async Task < bool > DeleteIfExistsAsync ( CancellationToken cancellationToken = default )
336
337
{
337
338
return await BlobClient . DeleteIfExistsAsync ( cancellationToken : cancellationToken ) . ConfigureAwait ( false ) ;
338
339
}
0 commit comments