예제 #1
0
 void IPreprocessingStepCallback.YieldNextStep(IPreprocessingStep step)
 {
     if (nextSteps != null)
     {
         nextSteps.Enqueue(step);
     }
 }
예제 #2
0
            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;
                        }
                    }
                };
            }
예제 #3
0
 bool TryExtensions(Uri uri, out IPreprocessingStep extensionStep)
 {
     foreach (var ext in extensions.Items)
     {
         var step = ext.TryParseLaunchUri(uri);
         if (step != null)
         {
             extensionStep = step;
             return(true);
         }
     }
     extensionStep = null;
     return(false);
 }
예제 #4
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;
                        }
                    }
                };
            }