hoff

package module
v0.0.0-...-8a9fb8e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2019 License: MIT Imports: 0 Imported by: 0

README

= HOFF

> Don't hassle with HOFF

image:https://travis-ci.org/rlespinasse/hoff.svg?branch=v0["Build Status", link="https://travis-ci.org/rlespinasse/hoff"]
image:https://coveralls.io/repos/github/rlespinasse/hoff/badge.svg?branch=v0["Coverage Status", link="https://coveralls.io/github/rlespinasse/hoff?branch=v0"]
image:https://goreportcard.com/badge/github.com/rlespinasse/hoff["Go Report Card", link="https://goreportcard.com/report/github.com/rlespinasse/hoff"]

**HOFF** is a library to configure and run a computation engine in order to process data throught a high order functions workflow.

== Usage

Import the `HOFF` library in your **golang** project

[source,go]
----
import "github.com/rlespinasse/hoff"
----

Than read the documentation image:https://godoc.org/github.com/rlespinasse/hoff?status.svg["GoDoc", link="https://godoc.org/github.com/rlespinasse/hoff"] to have some usage examples.

== Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

== License

https://choosealicense.com/licenses/mit/[MIT]

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL