コード例 #1
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="NuPlugPackageManager" /> class.
 /// </summary>
 /// <param name="packageLookup">The <see cref="IPackageLookup"/> to be wrapped.</param>
 /// <param name="packageRegistry">The <see cref="IPackageRegistry"/> to use for mocking existing packages at runtime</param>
 /// <exception cref="ArgumentNullException"></exception>
 public NuPlugPackageRepository(IPackageLookup packageLookup, IPackageRegistry packageRegistry = null)
 {
     if (packageLookup == null)
     {
         throw new ArgumentNullException(nameof(packageLookup));
     }
     _packageLookup   = packageLookup;
     _packageRegistry = packageRegistry ?? new NuPlugPackageRegistry();
 }
コード例 #2
0
 public WebFacade(AppInfo appInfo, PackageDownloadManager packageDownloadManager, PackageDataValidator validator, LocalPackageManager localPackageManager, IPeerRegistry peerRegistry, IPackageRegistry packageRegistry, InstanceHash instanceHash, LongRunningTasksManager tasks, PeersCluster peersCluster)
 {
     this.appInfo = appInfo ?? throw new ArgumentNullException(nameof(appInfo));
     this.packageDownloadManager = packageDownloadManager ?? throw new ArgumentNullException(nameof(packageDownloadManager));
     this.validator           = validator ?? throw new ArgumentNullException(nameof(validator));
     this.localPackageManager = localPackageManager ?? throw new ArgumentNullException(nameof(localPackageManager));
     this.peerRegistry        = peerRegistry ?? throw new ArgumentNullException(nameof(peerRegistry));
     this.packageRegistry     = packageRegistry ?? throw new ArgumentNullException(nameof(packageRegistry));
     this.instanceHash        = instanceHash ?? throw new ArgumentNullException(nameof(instanceHash));
     this.tasks        = tasks ?? throw new ArgumentNullException(nameof(tasks));
     this.peersCluster = peersCluster ?? throw new ArgumentNullException(nameof(peersCluster));
 }
コード例 #3
0
 public PeersCluster(AppInfo appInfo, IPeerRegistry peerRegistry, HttpApiClient client, IPackageRegistry packageRegistry, PackageDownloadManager packageDownloadManager)
 {
     this.appInfo                = appInfo ?? throw new ArgumentNullException(nameof(appInfo));
     this.peerRegistry           = peerRegistry ?? throw new ArgumentNullException(nameof(peerRegistry));
     this.client                 = client ?? throw new ArgumentNullException(nameof(client));
     this.packageRegistry        = packageRegistry ?? throw new ArgumentNullException(nameof(packageRegistry));
     this.packageDownloadManager = packageDownloadManager ?? throw new ArgumentNullException(nameof(packageDownloadManager));
     statusUpdateTimer           = new Timer(StatusUpdateTimerCallback, null, TimeSpan.Zero, TimeSpan.Zero);
     uploadSlots                 = appInfo.NetworkSettings.MaximumUploadsSlots;
     logger = appInfo.LoggerFactory.CreateLogger <PeersCluster>();
     peerRegistry.PeersChanged += PeerRegistry_PeersChanged;
     packageRegistry.NewLocalPackageCreated      += PackageRegistry_NewLocalPackageCreated;
     packageRegistry.LocalPackageDeleted         += PackageRegistry_LocalPackageDeleted;
     packageDownloadManager.DownloadStatusChange += PackageDownloadManager_DownloadStatusChange;
 }
コード例 #4
0
 public PackageDownloadManager(AppInfo appInfo, HttpApiClient client, IPackageRegistry packageRegistry, IPeerRegistry peerRegistry)
 {
     this.appInfo                           = appInfo ?? throw new ArgumentNullException(nameof(appInfo));
     logger                                 = appInfo.LoggerFactory.CreateLogger <PackageDownloadManager>();
     this.client                            = client ?? throw new ArgumentNullException(nameof(client));
     this.packageRegistry                   = packageRegistry ?? throw new ArgumentNullException(nameof(packageRegistry));
     this.peerRegistry                      = peerRegistry ?? throw new ArgumentNullException(nameof(peerRegistry));
     postPoneUpdateDownloadFile             = new Dictionary <Hash, PostponeTimer>();
     downloadSlots                          = new List <PackageDownloadSlot>(MaximumDownloadSlots);
     downloads                              = new List <LocalPackageInfo>();
     packageStatusUpdater                   = new PackageStatusUpdater(appInfo.LoggerFactory, appInfo.NetworkSettings, client);
     peerRegistry.PeersChanged             += packageStatusUpdater.UpdatePeers;
     packageStatusUpdater.NewDataAvailable += TryScheduleNextDownload;
     packageRegistry.LocalPackageDeleting  += PackageRegistry_LocalPackageDeleting;
 }
コード例 #5
0
 public AppInstanceBootstrapper(
     PackageDownloadManager packageDownloadManager,
     UdpPeerDiscovery udpPeerDiscovery,
     IPeerRegistry peerRegistry,
     IPackageRegistry packageRegistry,
     LocalPackageManager localPackageManager,
     PeersCluster peersCluster
     )
 {
     PackageDownloadManager = packageDownloadManager ?? throw new ArgumentNullException(nameof(packageDownloadManager));
     UdpPeerDiscovery       = udpPeerDiscovery ?? throw new ArgumentNullException(nameof(udpPeerDiscovery));
     PeerRegistry           = peerRegistry ?? throw new ArgumentNullException(nameof(peerRegistry));
     PackageRegistry        = packageRegistry ?? throw new ArgumentNullException(nameof(packageRegistry));
     LocalPackageManager    = localPackageManager ?? throw new ArgumentNullException(nameof(localPackageManager));
     PeersCluster           = peersCluster ?? throw new ArgumentNullException(nameof(peersCluster));
 }
コード例 #6
0
 public HttpApiController(PeersCluster peersCluster, IPackageRegistry packageRegistry, PackageDownloadManager downloadManager)
 {
     this.peersCluster    = peersCluster ?? throw new ArgumentNullException(nameof(peersCluster));
     this.packageRegistry = packageRegistry ?? throw new ArgumentNullException(nameof(packageRegistry));
     this.downloadManager = downloadManager ?? throw new ArgumentNullException(nameof(downloadManager));
 }