system

package
Version: 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: 6 Imported by: 0

Documentation

Overview

Package system expose functions to create and manipulate a Node system.

NOTE: The NodeSystem, once correctly configure, need to be activate in order to work properly.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NodeSystem

type NodeSystem struct {
	// contains filtered or unexported fields
}

NodeSystem is a system to configure workflow between action nodes, or decision nodes. The nodes are linked between them by link and join mode options. An activated Node system will be walked throw Follow and Ancestors functions

func New

func New() *NodeSystem

New create an empty Node system who need to be valid and activated in order to be used.

func (*NodeSystem) Activate

func (s *NodeSystem) Activate() error

Activate prepare the node system to be used. In order to activate it, the node system must be valid. Once activated, the initial nodes, following nodes, and ancestors nodes will be accessibles.

func (s *NodeSystem) AddLink(from, to node.Node) (bool, error)

AddLink add a link from a node to another node into the system before activation.

func (*NodeSystem) AddLinkOnBranch

func (s *NodeSystem) AddLinkOnBranch(from, to node.Node, branch bool) (bool, error)

AddLinkOnBranch add a link from a node (on a specific branch) to another node into the system before activation.

func (*NodeSystem) AddNode

func (s *NodeSystem) AddNode(n node.Node) (bool, error)

AddNode add a node to the system before activation.

func (*NodeSystem) Ancestors

func (s *NodeSystem) Ancestors(n node.Node, branch *bool) ([]node.Node, error)

Ancestors get the set of nodes who access using one of their branch to a specific node after activation.

func (*NodeSystem) ConfigureJoinModeOnNode

func (s *NodeSystem) ConfigureJoinModeOnNode(n node.Node, m joinmode.JoinMode) (bool, error)

ConfigureJoinModeOnNode configure the join mode of a node into the system before activation.

func (*NodeSystem) Equal

func (s *NodeSystem) Equal(o *NodeSystem) bool

Equal validate the two NodeSystem are equals.

func (*NodeSystem) Follow

func (s *NodeSystem) Follow(n node.Node, branch *bool) ([]node.Node, error)

Follow get the set of nodes accessible from a specific node and one of its branch after activation.

func (*NodeSystem) InitialNodes

func (s *NodeSystem) InitialNodes() []node.Node

InitialNodes get the initial nodes

func (*NodeSystem) IsActivated

func (s *NodeSystem) IsActivated() bool

IsActivated give the activation state of the node system. Only true if the node system is valid and have run the activate function without errors.

func (*NodeSystem) IsValid

func (s *NodeSystem) IsValid() (bool, []error)

IsValid check if the configuration of the node system is valid based on checks. Check for decision node with any node links as from, check for cyclic redundancy in node links, check for undeclared node used in node links, check for multiple declaration of same node instance.

func (*NodeSystem) JoinModeOfNode

func (s *NodeSystem) JoinModeOfNode(n node.Node) joinmode.JoinMode

JoinModeOfNode get the configured join mode of a node

Source Files

Directories

Path Synopsis
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
t or T : Toggle theme light dark auto
y or Y : Canonical URL