Ejemplo n.º 1
0
        public UpdateDownloadsCommand(
            IAuxiliaryFileClient auxiliaryFileClient,
            IDatabaseAuxiliaryDataFetcher databaseFetcher,
            IDownloadDataClient downloadDataClient,
            IDownloadSetComparer downloadSetComparer,
            IDownloadTransferrer downloadTransferrer,
            IPopularityTransferDataClient popularityTransferDataClient,
            ISearchDocumentBuilder searchDocumentBuilder,
            ISearchIndexActionBuilder indexActionBuilder,
            Func <IBatchPusher> batchPusherFactory,
            ISystemTime systemTime,
            IFeatureFlagService featureFlags,
            IOptionsSnapshot <Auxiliary2AzureSearchConfiguration> options,
            IAzureSearchTelemetryService telemetryService,
            ILogger <Auxiliary2AzureSearchCommand> logger)
        {
            _auxiliaryFileClient          = auxiliaryFileClient ?? throw new ArgumentException(nameof(auxiliaryFileClient));
            _databaseFetcher              = databaseFetcher ?? throw new ArgumentNullException(nameof(databaseFetcher));
            _downloadDataClient           = downloadDataClient ?? throw new ArgumentNullException(nameof(downloadDataClient));
            _downloadSetComparer          = downloadSetComparer ?? throw new ArgumentNullException(nameof(downloadSetComparer));
            _downloadTransferrer          = downloadTransferrer ?? throw new ArgumentNullException(nameof(downloadTransferrer));
            _popularityTransferDataClient = popularityTransferDataClient ?? throw new ArgumentNullException(nameof(popularityTransferDataClient));
            _searchDocumentBuilder        = searchDocumentBuilder ?? throw new ArgumentNullException(nameof(searchDocumentBuilder));
            _indexActionBuilder           = indexActionBuilder ?? throw new ArgumentNullException(nameof(indexActionBuilder));
            _batchPusherFactory           = batchPusherFactory ?? throw new ArgumentNullException(nameof(batchPusherFactory));
            _systemTime       = systemTime ?? throw new ArgumentNullException(nameof(systemTime));
            _featureFlags     = featureFlags ?? throw new ArgumentNullException(nameof(featureFlags));
            _options          = options ?? throw new ArgumentNullException(nameof(options));
            _telemetryService = telemetryService ?? throw new ArgumentNullException(nameof(telemetryService));
            _logger           = logger ?? throw new ArgumentNullException(nameof(logger));
            _stringCache      = new StringCache();

            if (_options.Value.MaxConcurrentBatches <= 0)
            {
                throw new ArgumentOutOfRangeException(
                          nameof(options),
                          $"The {nameof(AzureSearchJobConfiguration.MaxConcurrentBatches)} must be greater than zero.");
            }

            if (_options.Value.MaxConcurrentVersionListWriters <= 0)
            {
                throw new ArgumentOutOfRangeException(
                          nameof(options),
                          $"The {nameof(AzureSearchJobConfiguration.MaxConcurrentVersionListWriters)} must be greater than zero.");
            }
        }