Exemple #1
0
 public PackageValidatorContextEnqueuer(
     ValidationCollector collector,
     ReadWriteCursor front,
     ReadCursor back)
 {
     _collector = collector ?? throw new ArgumentNullException(nameof(collector));
     _front = front ?? throw new ArgumentNullException(nameof(front));
     _back = back ?? throw new ArgumentNullException(nameof(back));
 }
        /// <summary>
        /// Constructs a <see cref="ValidationCollector"/> from inputs and returns a <see cref="Result"/>.
        /// </summary>
        /// <param name="queue">Queue that the <see cref="ValidationCollector"/> queues packages to.</param>
        /// <param name="catalogIndexUrl">Url of the catalog that the <see cref="ValidationCollector"/> should run on.</param>
        /// <param name="monitoringStorageFactory">Storage where the cursors used by the <see cref="ValidationCollector"/> are stored.</param>
        /// <param name="endpointInputs">Endpoints that validations will be run on for queued packages.</param>
        /// <param name="messageHandlerFactory">Used by <see cref="ValidationCollector"/> to construct a <see cref="CollectorHttpClient"/>.</param>
        public Result Create(
            IStorageQueue <PackageValidatorContext> queue,
            string catalogIndexUrl,
            Persistence.IStorageFactory monitoringStorageFactory,
            IEnumerable <EndpointFactory.Input> endpointInputs,
            ITelemetryService telemetryService,
            Func <HttpMessageHandler> messageHandlerFactory)
        {
            var collector = new ValidationCollector(
                queue,
                new Uri(catalogIndexUrl),
                telemetryService,
                _loggerFactory.CreateLogger <ValidationCollector>(),
                messageHandlerFactory);

            var front = GetFront(monitoringStorageFactory);
            var back  = new AggregateCursor(endpointInputs.Select(input => new HttpReadCursor(input.CursorUri, messageHandlerFactory)));

            return(new Result(collector, front, back));
        }
 public Result(ValidationCollector collector, ReadWriteCursor front, ReadCursor back)
 {
     Collector = collector;
     Front     = front;
     Back      = back;
 }