model

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SIGNAL_STOP                = 1
	SIGNAL_TERMINATE_WAITING   = 2 // Signal to terminate all waiting nodes but not trigger nodes
	ParallelExecutionKeepFirst = "keep_first"
	ParallelExecutionKeepLast  = "keep_last"
	ParallelExecutionParallel  = "parallel"
)

Variables

This section is empty.

Functions

func GetValueByPath

func GetValueByPath(msg *Message, pathType string, path string, targetVariableType string) (interface{}, error)

func MsgValueToNumber

func MsgValueToNumber(msg *Message) (float64, error)

Types

type Context

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

func NewContextDB

func NewContextDB(storageLocation string) (*Context, error)

func (*Context) Close

func (ctx *Context) Close()

func (*Context) DeleteRecord

func (ctx *Context) DeleteRecord(name string, flowId string, inMemory bool) error

func (*Context) FactoryReset added in v1.0.1

func (ctx *Context) FactoryReset()

func (*Context) GetRecord

func (ctx *Context) GetRecord(name string, flowId string) (*ContextRecord, error)

func (*Context) GetRecords

func (ctx *Context) GetRecords(flowId string) []ContextRecord

func (*Context) GetVariable

func (ctx *Context) GetVariable(name string, flowId string) (Variable, error)

func (*Context) GetVariableType

func (ctx *Context) GetVariableType(name string, flowId string) (string, error)

func (*Context) PutRecord

func (ctx *Context) PutRecord(rec *ContextRecord, flowId string, inMemory bool) error

func (*Context) RegisterFlow

func (ctx *Context) RegisterFlow(flowId string) error

func (*Context) SetVariable

func (ctx *Context) SetVariable(name string, valueType string, value interface{}, description string, flowId string, inMemory bool) error

func (*Context) UnregisterFlow

func (ctx *Context) UnregisterFlow(flowId string) error

type ContextInMemoryStore

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

func (*ContextInMemoryStore) DeleteFlow

func (ctx *ContextInMemoryStore) DeleteFlow(flowId string)

func (*ContextInMemoryStore) Get

func (ctx *ContextInMemoryStore) Get(flowId string, varName string) *ContextRecord

func (*ContextInMemoryStore) GetRecordsForFlow

func (ctx *ContextInMemoryStore) GetRecordsForFlow(flowId string) ([]ContextRecord, error)

func (*ContextInMemoryStore) Store

func (ctx *ContextInMemoryStore) Store(rec ContextRecord, flowId string)

type ContextRecord

type ContextRecord struct {
	Name        string
	Description string
	UpdatedAt   time.Time
	Variable    Variable
	InMemory    bool
}

type FlowMeta

type FlowMeta struct {
	Id                string // Instance id . Is different for every instance
	ClassId           string // Class id , all instances share the same ClassId
	Author            string
	Version           int
	CreatedAt         time.Time
	UpdatedAt         time.Time
	Name              string
	Group             string
	Description       string
	Nodes             []MetaNode
	Settings          map[string]Setting
	IsDisabled        bool
	IsDefault         bool   // default flows are read only and can't be deleted
	ParallelExecution string // keep_first , keep_last , parallel
}

type FlowOperationalContext

type FlowOperationalContext struct {
	FlowMeta                    *FlowMeta
	FlowId                      string
	IsFlowRunning               bool
	State                       string
	TriggerControlSignalChannel chan int // the channel should be used to stop all waiting nodes .
	NodeControlSignalChannel    chan int
	NodeIsReady                 chan bool // Flow should notify message router when next node is ready to process new message .
	StoragePath                 string
	ExtLibsDir                  string
}

type FlowRunner

type FlowRunner func(ReactorEvent)

type FlowStatsReport

type FlowStatsReport struct {
	CurrentNodeId          NodeID
	CurrentNodeLabel       string
	NumberOfNodes          int
	NumberOfTriggers       int
	NumberOfActiveTriggers int
	NumberOfActiveSubflows int
	State                  string
	StartedAt              time.Time
	WaitingSince           time.Time
	LastExecutionTime      int64
}

type Message

type Message struct {
	AddressStr string
	Address    fimpgo.Address
	Payload    fimpgo.FimpMessage
	RawPayload []byte
	Header     map[string]string
	CancelOp   bool // if true , listening end should close all operations
}

type MetaNode

type MetaNode struct {
	Id                NodeID
	Type              string
	Label             string
	SuccessTransition NodeID
	TimeoutTransition NodeID
	ErrorTransition   NodeID
	Address           string
	Service           string
	ServiceInterface  string
	Config            interface{}
	Ui                interface{}
}

type MsgPipeline

type MsgPipeline chan Message

type Node

type Node interface {
	OnInput(msg *Message) ([]NodeID, error)
	// reactor nodes should publish events into the channel
	WaitForEvent(responseChannel chan ReactorEvent)
	GetMetaNode() *MetaNode
	GetNextSuccessNodes() []NodeID
	GetNextErrorNode() NodeID
	GetNextTimeoutNode() NodeID
	LoadNodeConfig() error
	IsStartNode() bool
	IsMsgReactorNode() bool
	IsReactorRunning() bool
	//ConfigureInStream(activeSubscriptions *[]string,msgInStream MsgPipeline)
	// Invoked when node is started
	Init() error
	// Invoked when node is stopped
	Cleanup() error
	SetConnectorRegistry(connectorRegistry *connector.Registry)
	SetFlowRunner(runner FlowRunner)
}

type NodeID

type NodeID string

type ReactorEvent

type ReactorEvent struct {
	Msg              Message
	Err              error
	TransitionNodeId NodeID
	SrcNodeId        NodeID
}

type Setting added in v1.0.1

type Setting struct {
	Value       interface{}
	ValueType   string // only simple types supported - int,string,float,bool
	Description string `json:"omitempty"` // Human readable description
	InitVar     bool   `json:"omitempty"` // If set , flow will init variable during startup
	TVarSType   string `json:"omitempty"` // Target variable storage type - mem_local, disk_local,disk_global
	TVarPType   string `json:"omitempty"` // Target variable payload type - int , string , float , bool
}

func (*Setting) String added in v1.0.1

func (s *Setting) String() string

type Variable

type Variable struct {
	Value     interface{}
	ValueType string
}

func (*Variable) IsEqual

func (vrbl *Variable) IsEqual(var2 *Variable) (bool, error)

func (*Variable) IsNumber

func (vrbl *Variable) IsNumber() bool

func (*Variable) ToNumber

func (vrbl *Variable) ToNumber() (float64, error)

Jump to

Keyboard shortcuts

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