static async Task MainCoreAsync(string[] args) { var sw = Stopwatch.StartNew(); // Apply initial settings ApplyInitialConfiguration(); // Validate argumanges LogTitle("Start : Evaluate Arguments. Override with EnvironmentVariables if missing argument."); EvaluateArguments(args); // Set UploadCallback if (!Silent) { // アップロード時のコールバック登録 UploadCallback = e => Log($"{e.PercentDone}%, {e.FilePath}, {nameof(KeyPrefix)} : {KeyPrefix}, {e}"); } // Obtain local files LogTitle("Start : Obtain Local items."); var localFileInfos = new EnumerableFileSystem(ExcludeDirectories, ExcludeFiles) .EnumerateFiles(LocalRoot) .ToArray(); var obtainLocal = sw.Elapsed; Log($@"Complete : Obtain Local items.", obtainLocal); sw.Restart(); // Get Credential // Missing CredentialProfile : Use IAM Instance Profile // Found CredentialProfile : Use as ProfileName LogTitle("Start : Obtain credential"); var s3 = string.IsNullOrEmpty(CredentialProfile) ? new S3Client(Option) : new S3Client(Option, AmazonCredential.GetCredential(CredentialProfile)); // Begin Synchronization LogTitle("Start : Synchronization"); var result = await s3.SyncWithLocal(localFileInfos, BucketName, KeyPrefix, IgnoreKeyPrefix, UploadCallback); // Show result LogTitle($@"Show : Synchronization result as follows."); Warn(result.ToMarkdown()); var synchronization = sw.Elapsed; Log($@"Complete : Synchronization.", synchronization); // Total result Log($@"Total :", (obtainLocal + synchronization)); }
public async Task ConcurretFileUploadPartsize5CpuX1() { var tasks = new EnumerableFileSystem().EnumerateFiles(LocalRoot) .Select(async x => { var fileUploadRequest = new TransferUtilityUploadRequest { BucketName = BucketName, FilePath = x.FullPath, Key = x.FullPath.Replace(LocalRoot + @"\", "").Replace(@"\", "/"), StorageClass = S3StorageClass.ReducedRedundancy, }; await S3.Transfer.UploadAsync(fileUploadRequest); }); await Task.WhenAll(tasks); }
public async Task ConcurretFileUploadPartsize16CpuX1() { var tasks = new EnumerableFileSystem().EnumerateFiles(LocalRoot) .Select(async x => { var fileUploadRequest = new TransferUtilityUploadRequest { BucketName = BucketName, FilePath = x.FullPath, Key = x.FullPath.Replace(LocalRoot + @"\", "").Replace(@"\", "/"), PartSize = S3.TransferConfig.MinSizeBeforePartUpload, StorageClass = S3StorageClass.ReducedRedundancy, }; fileUploadRequest.UploadProgressEvent += (sender, e) => { //Console.WriteLine($"{e.PercentDone}%, {e.FilePath}, {e}"); }; await S3.Transfer.UploadAsync(fileUploadRequest); }); await Task.WhenAll(tasks); }