Documentation ¶
Overview ¶
Package hoff is a library to define a Node workflow and compute data against it.
Create a node system and activate it:
ns := system.New() ns.AddNode(some_action_node) // read the input_data in context and create a output_data in context ns.AddNode(decision_node) // check if the input_data is valid with some functionals rules ns.AddNode(another_action_node) // enhance output_data with some functionals tasks ns.ConfigureJoinModeOnNode(another_action_node, joinmode.AND) ns.AddLink(some_action_node, another_action_node) ns.AddLinkOnBranch(decision_node, another_action_node, true) errs := ns.Activate() if errs != nil { // error handling }
Create a single computation and launch it:
cxt := node.NewContextWithoutData() cxt.Store("input_info", input_info) cp := computation.New(ns, context) err := cp.Compute() if err != nil { // error handling } fmt.Printf("computation report: %+v", cp.Report) fmt.Printf("output_data: %+v", cp.Context.Read("output_data"))
Create an engine and run multiple computations:
eng := engine.New() eng.ConfigureNodeSystem(ns) cr1 := eng.Compute(input_info) fmt.Printf("computation error: %+v", cr1.Error) fmt.Printf("computation report: %+v", cr1.Report) fmt.Printf("computed data: %+v", cr1.Data) cr2 := eng.Compute(another_aninput_info) fmt.Printf("computation error: %+v", cr2.Error) fmt.Printf("computation report: %+v", cr2.Report) fmt.Printf("computed data: %+v", cr2.Data)
Directories ¶
Path | Synopsis |
---|---|
Package computation serve to create and run a sequential computation of the Node system.
|
Package computation serve to create and run a sequential computation of the Node system. |
Package computestate expose utility functions to create a ComputeState object.
|
Package computestate expose utility functions to create a ComputeState object. |
Package engine serve to run multiple computations against a node system.
|
Package engine serve to run multiple computations against a node system. |
internal
|
|
nodelink
Package nodelink serve to internally store a link between nodes in the Node system.
|
Package nodelink serve to internally store a link between nodes in the Node system. |
utils
Package utils expose utility functions.
|
Package utils expose utility functions. |
Package node define action, and decision nodes.
|
Package node define action, and decision nodes. |
Package statetype expose possible computation state type as enum.
|
Package statetype expose possible computation state type as enum. |
Package system expose functions to create and manipulate a Node system.
|
Package system expose functions to create and manipulate a Node system. |
joinmode
Package joinmode expose possible join mode as enum for the node system.
|
Package joinmode expose possible join mode as enum for the node system. |
Click to show internal directories.
Click to hide internal directories.