Task DownloadFileAsync(string remoteFile, IAbsoluteFilePath destinationPath,
                        IMirrorSelector scoreMirrorSelector, CancellationToken token,
                        Func <IAbsoluteFilePath, bool> confirmValidity, int zsyncHttpFallbackAfter)
 => DownloadFileAsync(remoteFile, destinationPath, scoreMirrorSelector, token, confirmValidity,
                      new TransferStatus(remoteFile)
 {
     ZsyncHttpFallbackAfter = zsyncHttpFallbackAfter
 });
 async Task DownloadFileAsync(string remoteFile, IAbsoluteDirectoryPath destinationPath,
                              IMirrorSelector scoreMirrorSelector, CancellationToken token)
 {
     destinationPath.MakeSurePathExists();
     using (var dl = _createMultiMirrorFileDownloader(scoreMirrorSelector)) {
         await
         dl.Value.DownloadAsync(new MultiMirrorFileDownloadSpec(remoteFile,
                                                                destinationPath.GetChildFileWithName(remoteFile)) { CancellationToken = token }, token)
         .ConfigureAwait(false);
     }
 }
 async Task DownloadFilesAsync(StatusRepo sr,
                               IDictionary <FileFetchInfo, ITransferStatus> transferStatuses,
                               IAbsoluteDirectoryPath destinationPath, IMirrorSelector scoreMirrorSelector)
 {
     destinationPath.MakeSurePathExists();
     sr.Total = transferStatuses.Count;
     using (var multiMirrorFileDownloader = _createMultiMirrorFileDownloader(scoreMirrorSelector))
         using (var multi = _createQueueDownloader(multiMirrorFileDownloader.Value)) {
             await multi.Value
             .DownloadAsync(CreateFileQueueSpec(transferStatuses, destinationPath), sr.CancelToken)
             .ConfigureAwait(false);
         }
 }
        public SourceProvider(IMirrorSelector mirrorSelector, IProtocalProvider protocalProvider)
        {
            if (mirrorSelector == null)
            {
                throw new ArgumentNullException("mirrorSelector");
            }
            if (protocalProvider == null)
            {
                throw new ArgumentNullException("protocalProvider");
            }

            this._mirrorSelector   = mirrorSelector;
            this._protocalProvider = protocalProvider;
        }
 async Task DownloadFileAsync(string remoteFile, IAbsoluteFilePath destinationPath,
                              IMirrorSelector scoreMirrorSelector, CancellationToken token,
                              Func <IAbsoluteFilePath, bool> confirmValidity, ITransferStatus status)
 {
     destinationPath.MakeSureParentPathExists();
     using (var dl = _createMultiMirrorFileDownloader(scoreMirrorSelector)) {
         await
         dl.Value.DownloadAsync(new MultiMirrorFileDownloadSpec(remoteFile,
                                                                destinationPath, confirmValidity) {
             CancellationToken = token,
             Progress          = status
         },
                                token).ConfigureAwait(false);
     }
 }
 public Task DownloadFileAsync(string remoteFile, IAbsoluteFilePath destinationPath,
                               IMirrorSelector selector, ITransferStatus status, CancellationToken token)
 => DownloadFileAsync(remoteFile, destinationPath, selector, token, x => true, status);
 Task DownloadFileAsync(string remoteFile, IAbsoluteDirectoryPath destinationPath,
                        IMirrorSelector scoreMirrorSelector, CancellationToken token,
                        Func <IAbsoluteFilePath, bool> confirmValidity, int zsyncHttpFallbackAfter)
 => DownloadFileAsync(remoteFile, destinationPath.GetChildFileWithName(remoteFile), scoreMirrorSelector,
                      token, confirmValidity, zsyncHttpFallbackAfter);
示例#8
0
 public Handler(SynqProcessor processor, IMirrorSelector selector)
 {
     _processor = processor;
     _selector  = selector;
 }
 public Task DownloadFileAsync(string remoteFile, IAbsoluteFilePath destinationPath,
         IMirrorSelector selector, ITransferStatus status, CancellationToken token)
     => DownloadFileAsync(remoteFile, destinationPath, selector, token, x => true, status);
 async Task DownloadFilesAsync(StatusRepo sr,
     IDictionary<FileFetchInfo, ITransferStatus> transferStatuses,
     IAbsoluteDirectoryPath destinationPath, IMirrorSelector scoreMirrorSelector) {
     destinationPath.MakeSurePathExists();
     sr.Total = transferStatuses.Count;
     using (var multiMirrorFileDownloader = _createMultiMirrorFileDownloader(scoreMirrorSelector))
     using (var multi = _createQueueDownloader(multiMirrorFileDownloader.Value)) {
         await multi.Value
             .DownloadAsync(CreateFileQueueSpec(transferStatuses, destinationPath), sr.CancelToken)
             .ConfigureAwait(false);
     }
 }
 async Task DownloadFileAsync(string remoteFile, IAbsoluteFilePath destinationPath,
     IMirrorSelector scoreMirrorSelector, CancellationToken token,
     Func<IAbsoluteFilePath, bool> confirmValidity, ITransferStatus status) {
     destinationPath.MakeSureParentPathExists();
     using (var dl = _createMultiMirrorFileDownloader(scoreMirrorSelector)) {
         await
             dl.Value.DownloadAsync(new MultiMirrorFileDownloadSpec(remoteFile,
                     destinationPath, confirmValidity) {
                     CancellationToken = token,
                     Progress = status
                 },
                 token).ConfigureAwait(false);
     }
 }
 Task DownloadFileAsync(string remoteFile, IAbsoluteFilePath destinationPath,
         IMirrorSelector scoreMirrorSelector, CancellationToken token,
         Func<IAbsoluteFilePath, bool> confirmValidity, int zsyncHttpFallbackAfter)
     => DownloadFileAsync(remoteFile, destinationPath, scoreMirrorSelector, token, confirmValidity,
         new TransferStatus(remoteFile) {ZsyncHttpFallbackAfter = zsyncHttpFallbackAfter});
 Task DownloadFileAsync(string remoteFile, IAbsoluteDirectoryPath destinationPath,
         IMirrorSelector scoreMirrorSelector, CancellationToken token,
         Func<IAbsoluteFilePath, bool> confirmValidity, int zsyncHttpFallbackAfter)
     => DownloadFileAsync(remoteFile, destinationPath.GetChildFileWithName(remoteFile), scoreMirrorSelector,
         token, confirmValidity, zsyncHttpFallbackAfter);
 async Task DownloadFileAsync(string remoteFile, IAbsoluteDirectoryPath destinationPath,
     IMirrorSelector scoreMirrorSelector, CancellationToken token) {
     destinationPath.MakeSurePathExists();
     using (var dl = _createMultiMirrorFileDownloader(scoreMirrorSelector)) {
         await
             dl.Value.DownloadAsync(new MultiMirrorFileDownloadSpec(remoteFile,
                     destinationPath.GetChildFileWithName(remoteFile)) {CancellationToken = token}, token)
                 .ConfigureAwait(false);
     }
 }
 public Task DownloadFileAsync(string remoteFile, IAbsoluteDirectoryPath destinationPath,
         IMirrorSelector selector, int limit, CancellationToken token)
     => DownloadFileAsync(remoteFile, destinationPath, selector, token, x => true,
         RepositoryRemote.CalculateHttpFallbackAfter(limit));
示例#16
0
 public Task DownloadFileAsync(string remoteFile, IAbsoluteDirectoryPath destinationPath,
                               IMirrorSelector selector, int limit, CancellationToken token)
 => DownloadFileAsync(remoteFile, destinationPath, selector, token, x => true,
                      RepositoryRemote.CalculateHttpFallbackAfter(limit));
 public MultiMirrorFileDownloader(IFileDownloader downloader, IMirrorSelector mirrorSelector) {
     _downloader = downloader;
     _mirrorStrategy = mirrorSelector;
 }
示例#18
0
 public MultiMirrorFileDownloader(IFileDownloader downloader, IMirrorSelector mirrorSelector)
 {
     _downloader     = downloader;
     _mirrorStrategy = mirrorSelector;
 }