WolvenSpirit / node-graph-flow

Simple frame for node graph inspired task processing.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

node-graph-flow codecov GoDoc

node graph flow

Simple frame for node graph inspired task processing.

Disclaimer:

  • Each individual flow can be executed concurrently on separate goroutines.

  • At node level, all nodes of an individual graph should execute on the same goroutine (synchronous).


My intended purpose is to use this with https://github.com/WolvenSpirit/postgres-queue but it is just a few lines of code to provide a frame or example for any sort of node based separation of steps that together can define a task flow.


Why define a generic task or a handler like this?

Main reasons:

✅ Handle errors consistently.

✅ Handle program conditional logic flows consistently.

✅ Have a recorded and traceable logic flow throughout task execution.


✅ Now makes full use of Go Generics (go 1.18)

✅ Provides optional onFinished hook on each node. No matter if the node fails or succeeds, a custom clean-up function can run that might perform additional checks or store metrics regarding the outcome.


Examples for using this package can be found in the examples folder.

About

Simple frame for node graph inspired task processing.

License:GNU Lesser General Public License v2.1


Languages

Language:Go 100.0%