public LogSourcePreprocessing(
                LogSourcesPreprocessingManager owner,
                IPreprocessingUserRequests userRequests,
                Action <YieldedProvider> providerYieldedCallback,
                IEnumerable <IPreprocessingStep> initialSteps,
                string preprocessingDisplayName,
                PreprocessingOptions options) :
                this(owner, userRequests, providerYieldedCallback)
            {
                this.displayName = preprocessingDisplayName;
                this.options     = options;
                preprocLogic     = async() =>
                {
                    using (var perfop = new Profiling.Operation(trace, displayName))
                    {
                        for (var steps = new Queue <IPreprocessingStep>(initialSteps); steps.Count > 0;)
                        {
                            if (cancellation.IsCancellationRequested)
                            {
                                break;
                            }
                            IPreprocessingStep currentStep = steps.Dequeue();
                            nextSteps = steps;
                            await currentStep.Execute(this).ConfigureAwait(continueOnCapturedContext: !isLongRunning);

                            perfop.Milestone("completed " + currentStep.ToString());
                            nextSteps          = null;
                            currentDescription = genericProcessingDescription;
                        }
                    }
                };
            }
Esempio n. 2
0
            public LogSourcePreprocessing(
                LogSourcesPreprocessingManager owner,
                Action <YieldedProvider> providerYieldedCallback,
                IEnumerable <IPreprocessingStep> initialSteps,
                string preprocessingDisplayName,
                PreprocessingOptions options) :
                this(owner, providerYieldedCallback)
            {
                this.displayName = preprocessingDisplayName;
                this.options     = options;
                preprocLogic     = async() =>
                {
                    using (var perfop = new Profiling.Operation(trace, displayName))
                    {
                        for (var steps = new Queue <IPreprocessingStep>(initialSteps); ;)
                        {
                            if (cancellation.IsCancellationRequested)
                            {
                                break;
                            }
                            nextSteps = steps;
                            if (steps.Count > 0)
                            {
                                IPreprocessingStep currentStep = steps.Dequeue();
                                await currentStep.Execute(this).ConfigureAwait(continueOnCapturedContext: !isLongRunning);

                                perfop.Milestone("completed " + currentStep.ToString());
                            }
                            else
                            {
                                foreach (var e in owner.extensions.Items)
                                {
                                    await e.FinalizePreprocessing(this).ConfigureAwait(continueOnCapturedContext: !isLongRunning);
                                }
                                perfop.Milestone("notified extensions about finalization");
                                if (steps.Count == 0)
                                {
                                    break;
                                }
                            }
                            nextSteps          = null;
                            currentDescription = genericProcessingDescription;
                        }
                    }
                };
            }