private PipelinePhase GetPipelineAndPhase( string pipelineName, Phase phase, IPipelineCollection pipelines, ConcurrentDictionary <string, PhaseResult[]> phaseResults, IDocument[] outputs, params PipelinePhase[] dependencies) => GetPipelineAndPhase(pipelineName, phase, pipelines, phaseResults, outputs, Phase.Process, dependencies);
public static void AddIfNonExisting(this IPipelineCollection pipelineCollection, IPipeline pipeline) { string name = (pipeline as INamedPipeline)?.PipelineName ?? pipeline?.GetType().Name; if (!pipelineCollection.ContainsKey(name)) { pipelineCollection.Add(name, pipeline); } }
public PipelinesProvider( IPipelineCollection <IPipeline> pipelineCollection, IPipelineCollection <IAsyncPipeline> asyncPipelineCollection, IPipelineCollection <ICancellablePipeline> cancellablePipelineCollection) { _pipelineCollection = pipelineCollection; _asyncPipelineCollection = asyncPipelineCollection; _cancellablePipelineCollection = cancellablePipelineCollection; }
/// <summary> /// Inserts an existing pipeline before an existing named pipeline. /// </summary> /// <param name="pipelines">The pipeline collection.</param> /// <param name="target">The pipeline before which the specified pipeline should be inserted.</param> /// <param name="pipeline">The pipeline to insert.</param> /// <returns>The inserted pipeline.</returns> public static IPipeline InsertBefore(this IPipelineCollection pipelines, string target, IPipeline pipeline) { int index = pipelines.IndexOf(target); if (index < 0) { throw new KeyNotFoundException($"Target pipeline {target} was not found"); } return(pipelines.Insert(index, pipeline)); }
/// <summary> /// A helper for adding reading time meta data to blog post pipelines. /// </summary> /// <param name="pipelineCollection"></param> /// <param name="wordsPerMinute"></param> /// <returns></returns> public static IPipelineCollection AddReadingTimeMeta(this IPipelineCollection pipelineCollection, uint wordsPerMinute) { if (!pipelineCollection.TryGetValue(BlogPosts, out var blogPipeline)) { throw new Exception("Reading time meta can currently only be added to a blog template with this helper!"); } blogPipeline.InsertBefore(WriteMetadata, new ReadingTime(wordsPerMinute)); return(pipelineCollection); }
public Mediator( GetService getService, IPipelineCollection <IPipeline> pipelineCollection, IPipelineCollection <IAsyncPipeline> asyncPipelineCollection, IPipelineCollection <ICancellablePipeline> cancellablePipelineCollection) { GetService = getService; _pipelineCollection = pipelineCollection; _asyncPipelineCollection = asyncPipelineCollection; _cancellablePipelineCollection = cancellablePipelineCollection; }
/// <summary> /// Inserts an existing pipeline after an existing named pipeline. /// </summary> /// <param name="pipelines">The pipeline collection.</param> /// <param name="target">The pipeline after which the specified pipeline should be inserted.</param> /// <param name="pipeline">The pipeline to insert.</param> /// <returns>The inserted pipeline.</returns> public static IPipeline InsertAfter(this IPipelineCollection pipelines, string target, IPipeline pipeline) { int index = pipelines.IndexOf(target); if (index < 0) { throw new KeyNotFoundException($"Target pipeline {target} was not found"); } return(index + 1 < pipelines.Count ? pipelines.Insert(index + 1, pipeline) : pipelines.Add(pipeline)); }
private PipelinePhase GetPipelineAndPhase( string pipelineName, Phase phase, IPipelineCollection pipelines, ConcurrentDictionary <string, ImmutableArray <IDocument> > documentCollection, IDocument[] documents, params PipelinePhase[] dependencies) { TestPipeline pipeline = new TestPipeline(); PipelinePhase pipelinePhase = new PipelinePhase(pipeline, pipelineName, phase, Array.Empty <IModule>(), NullLogger.Instance, dependencies); pipelines.Add(pipelineName, pipeline); documentCollection.AddOrUpdate(pipelineName, documents.ToImmutableArray(), (_, __) => documents.ToImmutableArray()); return(pipelinePhase); }
private PipelinePhase GetPipelineAndPhase( string pipelineName, Phase currentPhase, IPipelineCollection pipelines, ConcurrentDictionary <string, PhaseResult[]> phaseResults, IDocument[] outputs, Phase phaseForOutputs, params PipelinePhase[] dependencies) { TestPipeline pipeline = new TestPipeline(); PipelinePhase pipelinePhase = new PipelinePhase(pipeline, pipelineName, currentPhase, Array.Empty <IModule>(), NullLogger.Instance, dependencies); pipelines.Add(pipelineName, pipeline); PhaseResult[] results = new PhaseResult[4]; if (outputs != null) { results[(int)phaseForOutputs] = new PhaseResult(pipelineName, phaseForOutputs, outputs.ToImmutableArray(), default, 0);
private PipelinePhase GetPipelineAndPhase( string pipelineName, Phase phase, IPipelineCollection pipelines, ConcurrentDictionary <string, PhaseResult[]> phaseResults, IDocument[] outputs, params PipelinePhase[] dependencies) { TestPipeline pipeline = new TestPipeline(); PipelinePhase pipelinePhase = new PipelinePhase(pipeline, pipelineName, phase, Array.Empty <IModule>(), NullLogger.Instance, dependencies); pipelines.Add(pipelineName, pipeline); PhaseResult[] results = new PhaseResult[4]; results[(int)Phase.Process] = new PhaseResult(pipelineName, Phase.Process, outputs.ToImmutableArray(), 0); phaseResults.TryAdd(pipelineName, results); return(pipelinePhase); }
/// <summary> /// Inserts a new unnamed pipeline before an existing named pipeline. /// </summary> /// <param name="pipelines">The pipeline collection.</param> /// <param name="target">The pipeline before which the new pipeline should be inserted.</param> /// <param name="modules">The modules the new pipeline should contain.</param> /// <returns>The newly inserted pipeline.</returns> public static IPipeline InsertBefore(this IPipelineCollection pipelines, string target, IModuleList modules) => InsertBefore(pipelines, target, null, modules);
/// <summary> /// Inserts a new named pipeline into the collection. /// </summary> /// <param name="pipelines">The pipeline collection.</param> /// <param name="index">The index at which to insert the new pipeline.</param> /// <param name="name">The name of the new pipeline.</param> /// <param name="modules">The modules the new pipeline should contain.</param> /// <returns>The newly inserted pipeline.</returns> public static IPipeline Insert(this IPipelineCollection pipelines, int index, string name, params IModule[] modules) => pipelines.Insert(index, name, new ModuleList(modules));
/// <summary> /// Inserts a new unnamed pipeline into the collection. /// </summary> /// <param name="pipelines">The pipeline collection.</param> /// <param name="index">The index at which to insert the new pipeline.</param> /// <param name="modules">The modules the new pipeline should contain.</param> /// <returns>The newly inserted pipeline.</returns> public static IPipeline Insert(this IPipelineCollection pipelines, int index, IModuleList modules) => pipelines.Insert(index, null, modules);
/// <summary> /// Adds a new named pipeline to the collection. /// </summary> /// <param name="pipelines">The pipeline collection.</param> /// <param name="name">The name of the new pipeline.</param> /// <param name="modules">The modules the new pipeline should contain.</param> /// <returns>The newly added pipeline.</returns> public static IPipeline Add(this IPipelineCollection pipelines, string name, params IModule[] modules) => pipelines.Add(name, new ModuleList(modules));
/// <summary> /// Adds a new unnamed pipeline to the collection. /// </summary> /// <param name="pipelines">The pipeline collection.</param> /// <param name="modules">The modules the new pipeline should contain.</param> /// <returns>The newly added pipeline.</returns> public static IPipeline Add(this IPipelineCollection pipelines, IModuleList modules) => pipelines.Add(null, modules);
public static void Add(this IPipelineCollection pipelineCollection, IPipeline pipeline) => pipelineCollection.Add((pipeline as INamedPipeline)?.PipelineName ?? pipeline?.GetType().Name, pipeline);
public MediatorBuilder() { _pipelineCollection = new PipelineCollection <IPipeline>(); _asyncPipelineCollection = new PipelineCollection <IAsyncPipeline>(); _cancellablePipelineCollection = new PipelineCollection <ICancellablePipeline>(); }
public PipelineOutputs(ConcurrentDictionary <string, ImmutableArray <IDocument> > documents, PipelinePhase pipelinePhase, IPipelineCollection pipelines) { _documents = documents; _pipelinePhase = pipelinePhase; _pipelines = pipelines; }
/// <summary> /// Inserts a new named pipeline before an existing named pipeline. /// </summary> /// <param name="pipelines">The pipeline collection.</param> /// <param name="target">The pipeline before which the new pipeline should be inserted.</param> /// <param name="name">The name of the new pipeline.</param> /// <param name="modules">The modules the new pipeline should contain.</param> /// <returns>The newly inserted pipeline.</returns> public static IPipeline InsertBefore(this IPipelineCollection pipelines, string target, string name, params IModule[] modules) => InsertBefore(pipelines, target, name, new ModuleList(modules));
internal PipelineBuilder(IPipelineCollection collection, IReadOnlySettings settings) { _collection = collection; Settings = settings; }
/// <summary> /// Inserts a new unnamed pipeline after an existing named pipeline. /// </summary> /// <param name="pipelines">The pipeline collection.</param> /// <param name="target">The pipeline after which the new pipeline should be inserted.</param> /// <param name="modules">The modules the new pipeline should contain.</param> /// <returns>The newly inserted pipeline.</returns> public static IPipeline InsertAfter(this IPipelineCollection pipelines, string target, params IModule[] modules) => InsertAfter(pipelines, target, null, new ModuleList(modules));
public PhaseOutputs(IReadOnlyDictionary <string, PhaseResult[]> phaseResults, PipelinePhase currentPhase, IPipelineCollection pipelines) { _phaseResults = phaseResults ?? throw new ArgumentNullException(nameof(phaseResults)); _currentPhase = currentPhase ?? throw new ArgumentNullException(nameof(currentPhase)); _pipelines = pipelines ?? throw new ArgumentNullException(nameof(pipelines)); }
internal PipelineBuilder(IPipelineCollection collection, IEngineSettings settings) { _collection = collection; Settings = settings; }