|
1 | 1 | # Azure Storage Data Movement Blobs client library for .NET |
2 | 2 |
|
3 | | -> Server Version: 2020-04-08, 2020-02-10, 2019-12-12, 2019-07-07, and 2020-02-02 |
4 | | -
|
5 | 3 | ## Project Status: Beta |
6 | 4 |
|
7 | 5 | This product is in beta. Some features will be missing or have significant bugs. Please see [Known Issues](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/storage/Azure.Storage.DataMovement/KnownIssues.md) for detailed information. |
8 | 6 |
|
9 | 7 | --- |
10 | 8 |
|
11 | 9 | Azure Storage is a Microsoft-managed service providing cloud storage that is |
12 | | -highly available, secure, durable, scalable, and redundant. Azure Storage |
13 | | -includes Azure Blobs (objects), Azure Data Lake Storage Gen2, Azure Files, |
14 | | -and Azure Queues. |
| 10 | +highly available, secure, durable, scalable, and redundant. |
15 | 11 |
|
16 | | -The Azure Storage Data Movement library is optimized for uploading, downloading and |
17 | | -copying customer data. |
| 12 | +The Azure Storage Data Movement Blobs library is optimized for uploading, downloading and |
| 13 | +copying blobs. |
18 | 14 |
|
19 | 15 | The Azure.Storage.DataMovement.Blobs library provides infrastructure shared by the other |
20 | 16 | Azure Storage client libraries. |
@@ -72,82 +68,10 @@ We guarantee that all client instance methods are thread-safe and independent of |
72 | 68 |
|
73 | 69 | This section demonstrates usage of Data Movement for interacting with blob storage. |
74 | 70 |
|
75 | | -### Extensions on `BlobContainerClient` |
76 | | - |
77 | | -For applications with preexisting code using Azure.Storage.Blobs, this package provides extension methods for `BlobContainerClient` to get some of the benefits of the `TransferManager` with minimal extra code. |
78 | | - |
79 | | -Instantiate the BlobContainerClient |
80 | | -```C# Snippet:ExtensionMethodCreateContainerClient |
81 | | -BlobServiceClient service = new BlobServiceClient(serviceUri, credential); |
82 | | - |
83 | | -BlobContainerClient container = service.GetBlobContainerClient(containerName); |
84 | | -``` |
85 | | - |
86 | | -Upload a local directory to the root of the container |
87 | | -```C# Snippet:ExtensionMethodSimpleUploadToRoot |
88 | | -DataTransfer transfer = await container.StartUploadDirectoryAsync(localPath); |
89 | | - |
90 | | -await transfer.WaitForCompletionAsync(); |
91 | | -``` |
92 | | - |
93 | | -Upload a local directory to a virtual directory in the container by specifying a directory prefix |
94 | | -```C# Snippet:ExtensionMethodSimpleUploadToDirectoryPrefix |
95 | | -DataTransfer transfer = await container.StartUploadDirectoryAsync(localPath, blobDirectoryPrefix); |
96 | | - |
97 | | -await transfer.WaitForCompletionAsync(); |
98 | | -``` |
99 | | - |
100 | | -Upload a local directory to a virtual directory in the container specifying more advanced options |
101 | | -```C# Snippet:ExtensionMethodSimpleUploadWithOptions |
102 | | -BlobContainerClientTransferOptions options = new BlobContainerClientTransferOptions |
103 | | -{ |
104 | | - BlobContainerOptions = new BlobStorageResourceContainerOptions |
105 | | - { |
106 | | - BlobDirectoryPrefix = blobDirectoryPrefix |
107 | | - }, |
108 | | - TransferOptions = new DataTransferOptions() |
109 | | - { |
110 | | - CreationPreference = StorageResourceCreationPreference.OverwriteIfExists, |
111 | | - } |
112 | | -}; |
113 | | - |
114 | | -DataTransfer transfer = await container.StartUploadDirectoryAsync(localPath, options); |
| 71 | +### Using the TransferManager for Blob Transfers |
115 | 72 |
|
116 | | -await transfer.WaitForCompletionAsync(); |
117 | | -``` |
| 73 | +The `TransferManager` is the primary class for managing data transfers between storage resources. See [Setup the TransferManager sample](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/storage/Azure.Storage.DataMovement#setup-the-transfermanager). |
118 | 74 |
|
119 | | -Download the entire container to a local directory |
120 | | -```C# Snippet:ExtensionMethodSimpleDownloadContainer |
121 | | -DataTransfer transfer = await container.StartDownloadToDirectoryAsync(localDirectoryPath); |
122 | | - |
123 | | -await transfer.WaitForCompletionAsync(); |
124 | | -``` |
125 | | - |
126 | | -Download a directory in the container by specifying a directory prefix |
127 | | -```C# Snippet:ExtensionMethodSimpleDownloadContainerDirectory |
128 | | -DataTransfer tranfer = await container.StartDownloadToDirectoryAsync(localDirectoryPath2, blobDirectoryPrefix); |
129 | | - |
130 | | -await tranfer.WaitForCompletionAsync(); |
131 | | -``` |
132 | | - |
133 | | -Download from the container specifying more advanced options |
134 | | -```C# Snippet:ExtensionMethodSimpleDownloadContainerDirectoryWithOptions |
135 | | -BlobContainerClientTransferOptions options = new BlobContainerClientTransferOptions |
136 | | -{ |
137 | | - BlobContainerOptions = new BlobStorageResourceContainerOptions |
138 | | - { |
139 | | - BlobDirectoryPrefix = blobDirectoryPrefix |
140 | | - }, |
141 | | - TransferOptions = new DataTransferOptions() |
142 | | - { |
143 | | - CreationPreference = StorageResourceCreationPreference.OverwriteIfExists, |
144 | | - } |
145 | | -}; |
146 | | - |
147 | | -DataTransfer tranfer = await container.StartDownloadToDirectoryAsync(localDirectoryPath2, options); |
148 | | - |
149 | | -await tranfer.WaitForCompletionAsync(); |
150 | | -``` |
151 | 75 |
|
152 | 76 | ### Initializing Blob Storage `StorageResource` |
153 | 77 |
|
@@ -302,13 +226,92 @@ destinationResource: blobs.FromContainer( |
302 | 226 | await dataTransfer.WaitForCompletionAsync(); |
303 | 227 | ``` |
304 | 228 |
|
| 229 | +### Extensions on `BlobContainerClient` |
| 230 | + |
| 231 | +For applications with preexisting code using Azure.Storage.Blobs, this package provides extension methods for `BlobContainerClient` to get some of the benefits of the `TransferManager` with minimal extra code. |
| 232 | + |
| 233 | +Instantiate the BlobContainerClient |
| 234 | +```C# Snippet:ExtensionMethodCreateContainerClient |
| 235 | +BlobServiceClient service = new BlobServiceClient(serviceUri, credential); |
| 236 | + |
| 237 | +BlobContainerClient container = service.GetBlobContainerClient(containerName); |
| 238 | +``` |
| 239 | + |
| 240 | +Upload a local directory to the root of the container |
| 241 | +```C# Snippet:ExtensionMethodSimpleUploadToRoot |
| 242 | +DataTransfer transfer = await container.StartUploadDirectoryAsync(localPath); |
| 243 | + |
| 244 | +await transfer.WaitForCompletionAsync(); |
| 245 | +``` |
| 246 | + |
| 247 | +Upload a local directory to a virtual directory in the container by specifying a directory prefix |
| 248 | +```C# Snippet:ExtensionMethodSimpleUploadToDirectoryPrefix |
| 249 | +DataTransfer transfer = await container.StartUploadDirectoryAsync(localPath, blobDirectoryPrefix); |
| 250 | + |
| 251 | +await transfer.WaitForCompletionAsync(); |
| 252 | +``` |
| 253 | + |
| 254 | +Upload a local directory to a virtual directory in the container specifying more advanced options |
| 255 | +```C# Snippet:ExtensionMethodSimpleUploadWithOptions |
| 256 | +BlobContainerClientTransferOptions options = new BlobContainerClientTransferOptions |
| 257 | +{ |
| 258 | + BlobContainerOptions = new BlobStorageResourceContainerOptions |
| 259 | + { |
| 260 | + BlobDirectoryPrefix = blobDirectoryPrefix |
| 261 | + }, |
| 262 | + TransferOptions = new DataTransferOptions() |
| 263 | + { |
| 264 | + CreationPreference = StorageResourceCreationPreference.OverwriteIfExists, |
| 265 | + } |
| 266 | +}; |
| 267 | + |
| 268 | +DataTransfer transfer = await container.StartUploadDirectoryAsync(localPath, options); |
| 269 | + |
| 270 | +await transfer.WaitForCompletionAsync(); |
| 271 | +``` |
| 272 | + |
| 273 | +Download the entire container to a local directory |
| 274 | +```C# Snippet:ExtensionMethodSimpleDownloadContainer |
| 275 | +DataTransfer transfer = await container.StartDownloadToDirectoryAsync(localDirectoryPath); |
| 276 | + |
| 277 | +await transfer.WaitForCompletionAsync(); |
| 278 | +``` |
| 279 | + |
| 280 | +Download a directory in the container by specifying a directory prefix |
| 281 | +```C# Snippet:ExtensionMethodSimpleDownloadContainerDirectory |
| 282 | +DataTransfer transfer = await container.StartDownloadToDirectoryAsync(localDirectoryPath2, blobDirectoryPrefix); |
| 283 | + |
| 284 | +await transfer.WaitForCompletionAsync(); |
| 285 | +``` |
| 286 | + |
| 287 | +Download from the container specifying more advanced options |
| 288 | +```C# Snippet:ExtensionMethodSimpleDownloadContainerDirectoryWithOptions |
| 289 | +BlobContainerClientTransferOptions options = new BlobContainerClientTransferOptions |
| 290 | +{ |
| 291 | + BlobContainerOptions = new BlobStorageResourceContainerOptions |
| 292 | + { |
| 293 | + BlobDirectoryPrefix = blobDirectoryPrefix |
| 294 | + }, |
| 295 | + TransferOptions = new DataTransferOptions() |
| 296 | + { |
| 297 | + CreationPreference = StorageResourceCreationPreference.OverwriteIfExists, |
| 298 | + } |
| 299 | +}; |
| 300 | + |
| 301 | +DataTransfer transfer = await container.StartDownloadToDirectoryAsync(localDirectoryPath2, options); |
| 302 | + |
| 303 | +await transfer.WaitForCompletionAsync(); |
| 304 | +``` |
| 305 | + |
305 | 306 | ## Troubleshooting |
306 | 307 |
|
307 | | -***TODO*** |
| 308 | +See [Handling Failed Transfers](#handling-failed-transfers) and [Enabling Logging](https://learn.microsoft.com/dotnet/azure/sdk/logging) to assist with any troubleshooting. |
308 | 309 |
|
309 | 310 | ## Next steps |
310 | 311 |
|
311 | | -***TODO*** |
| 312 | +Get started with our [Share Files Samples][share_samples]. |
| 313 | + |
| 314 | +For more base Transfer Manager scenarios see [DataMovement samples][datamovement_base]. |
312 | 315 |
|
313 | 316 | ## Contributing |
314 | 317 |
|
@@ -342,7 +345,8 @@ additional questions or comments. |
342 | 345 | [azure_sub]: https://azure.microsoft.com/free/dotnet/ |
343 | 346 | [RequestFailedException]: https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/core/Azure.Core/src/RequestFailedException.cs |
344 | 347 | [error_codes]: https://learn.microsoft.com/rest/api/storageservices/common-rest-api-error-codes |
345 | | -[samples]: https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/storage/Azure.Storage.DataMovement.Blobs/samples |
| 348 | +[datamovement_base]: https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/storage/Azure.Storage.DataMovement |
| 349 | +[share_samples]: https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/storage/Azure.Storage.DataMovement.Files.Shares/samples |
346 | 350 | [storage_contrib]: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/storage/CONTRIBUTING.md |
347 | 351 | [cla]: https://cla.microsoft.com |
348 | 352 | [coc]: https://opensource.microsoft.com/codeofconduct/ |
|
0 commit comments