-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLargeFileMigrationScript.cs
More file actions
67 lines (53 loc) · 1.94 KB
/
LargeFileMigrationScript.cs
File metadata and controls
67 lines (53 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using Azure.Storage.Files.Shares;
namespace LargeFileMigrationScript
{
class Program
{
#region Definitions
private delegate Task<SlicedStream> GetNextStreamPartition(
Stream stream,
);
static void Main(string[] args)
{
// Required to authenticate to storage account
string storageAccountName = "rishabstoragetest";
string storageConnectionString = "";
// Names of Directory to access and File to create
string dirName = "testdest";
string shareName = "testfileshare1";
// Get a reference to a share and create it
ShareClient share = new ShareClient(storageConnectionString, shareName);
await share.createAsync();
int maxWorkerCount = 20;
return await UploadInParallelAsync();
Console.WriteLine("Migrating files from to .");
}
private async Task<Response<TCompleteUpload>> UploadInParallelAsync(
Stream content,
long? contentLength,
TServiceSpecificArgs args,
IProgress<long> progressHandler,
CancellationToken cancellationToken)
{
// A list of tasks that are currently executing which will
// always be smaller than _maxWorkerCount
List<Task> runningTasks = new List<Task>();
// Partition fileshare into byte ranges
await foreach ()
}
private static async IAsyncEnumerable<SlicedStream> GetPartitionsAsync(
Stream stream,
long? streamLength,
GetNextStreamPartition getNextPartition,
bool async,
[EnumeratorCancellation] CancellationToken cancellationToken)
{
}
}
}