Giter VIP home page Giter VIP logo

pipelineblocks's Introduction

PipelineBlocks

NuGet NuGet downloads License Coverage Status

A .NET Standard library that can be used to create two-directional pipeline blocks.

Features

  • It's asynchronous.
  • Allows moving forward and backward in the pipeline.
  • Allows skipping the current block and removing it from the pipeline.
  • Blocks can be marked as an exit, meaning the pipeline can be finished at that stage.
  • Blocks can be marked as a checkpoint, allowing the pipeline to revert to this stage from any descendant block.
  • Child blocks can be dynamically determined based on the data of the current block.
  • Blocks can be merged into modules for better organization and reuse.
  • The library includes unit tests.

Example

using PipelineBlocks.Extensions;
using PipelineBlocks.Models;

var block2 = new PipelineBlock<string>()
{
    Job = (x, c) => BlockResult.Forward("success"),
    KeyCondition = x => "block2",
    NameCondition = x => "block2",
    CheckpointCondition = x => false,
    ExitCondition = x => true,
    ChildCondition = x => null
};
var block1 = new PipelineBlock<int>()
{
    Job = (x, c) => BlockResult.Forward(123),
    KeyCondition = x => "block1",
    NameCondition = x => "block1",
    CheckpointCondition = x => false,
    ExitCondition = x => true,
    ChildCondition = x => block2
};
await block1.ExecuteAsync();

Available actions in active block

sequenceDiagram
participant PA as Parent A (exit)
participant PB as Parent B (checkpoint)
participant A as Active block (exit)
participant CA as Child
A ->> CA: BlockResult.Forward<T>
Note left of CA: Continuue pipeline
A ->> CA: BlockResult<T>.Skip
Note left of CA: Continuue pipeline
A ->> PA: BlockResult<T>.BackToExit
Note right of PA: Finish pipeline
A ->> PB: BlockResult<T>.BackToCheckpoint
Note right of PB: Continuue pipeline
A ->> A: BlockResult.Exit<T>
Note right of A: Finish pipeline
A ->> A: BlockResult<T>.Error
Note right of A: Finish pipeline
Loading

pipelineblocks's People

Contributors

danielklecha avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.