engine

package
v0.0.0-...-59f10e1 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Copyright 2017, RadiantBlue Technologies, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2017, RadiantBlue Technologies, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	ColonMarker   = 58
	PeriodMarker  = 46
	HyphenMarker  = 45
	GreaterMarker = 62
	WigglyMarker  = 126
)

Variables

View Source
var Factory = &TypeFactory{
	types: map[string]Component{},
}

Functions

func NewViaReflection

func NewViaReflection(any interface{}) interface{}

func ReadFromJSON

func ReadFromJSON(jsn string, obj interface{}) error

func SetStructFromMap

func SetStructFromMap(input map[string]interface{}, result interface{}, weakly bool) (interface{}, error)

func WriteToJSON

func WriteToJSON(obj interface{}) (string, error)

Types

type ArgMap

type ArgMap map[string]interface{}

func NewArgMap

func NewArgMap(jsn string) (ArgMap, error)

func (ArgMap) GetBool

func (m ArgMap) GetBool(field string) (bool, error)

func (ArgMap) GetBoolOrDefault

func (m ArgMap) GetBoolOrDefault(field string, defalt bool) (bool, error)

func (ArgMap) GetFloat

func (m ArgMap) GetFloat(field string) (float64, error)

func (ArgMap) GetFloatOrDefault

func (m ArgMap) GetFloatOrDefault(field string, defalt float64) (float64, error)

func (ArgMap) GetInterfaceOrDefault

func (m ArgMap) GetInterfaceOrDefault(field string, defalt interface{}) (interface{}, error)

func (ArgMap) GetString

func (m ArgMap) GetString(field string) (string, error)

func (ArgMap) GetStringOrDefault

func (m ArgMap) GetStringOrDefault(field string, defalt string) (string, error)

func (ArgMap) String

func (m ArgMap) String() string

func (ArgMap) ToJSON

func (m ArgMap) ToJSON() (string, error)

func (ArgMap) ToStruct

func (m ArgMap) ToStruct(result interface{}) error

type Component

type Component interface {
	// the system calls this to do init work specific to your component type
	// you must implement this
	Configure() error
	// contains filtered or unexported methods
}

type ComponentCore

type ComponentCore struct {
	Config ArgMap

	flow.Component
	// contains filtered or unexported fields
}

type ComponentModel

type ComponentModel struct {
	Name string `json:"name"`

	Type string `json:"type"`

	Precondition  string `json:"precondition,omitempty"`
	Postcondition string `json:"postcondition,omitempty"`
	Config        ArgMap
}

func (*ComponentModel) ReadFromJSON

func (m *ComponentModel) ReadFromJSON(jsn string) error

func (*ComponentModel) String

func (c *ComponentModel) String() string

func (*ComponentModel) Validate

func (m *ComponentModel) Validate() error

func (*ComponentModel) WriteToJSON

func (m *ComponentModel) WriteToJSON() (string, error)

type ConnectionModel

type ConnectionModel struct {
	Source      string `json:"source"`      // component.port
	Destination string `json:"destination"` // component.port
}

func (*ConnectionModel) ReadFromJSON

func (m *ConnectionModel) ReadFromJSON(jsn string) error

func (*ConnectionModel) String

func (c *ConnectionModel) String() string

func (*ConnectionModel) Validate

func (m *ConnectionModel) Validate() error

func (*ConnectionModel) WriteToJSON

func (m *ConnectionModel) WriteToJSON() (string, error)

type Expression

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

func NewExpression

func NewExpression(text string, funcs Functions) (e *Expression, err error)

func (*Expression) Eval

func (e *Expression) Eval(vars Variables) (result interface{}, err error)

func (*Expression) String

func (e *Expression) String() string

type Functions

type Functions map[string]govaluate.ExpressionFunction

func (Functions) String

func (fs Functions) String() string

type GraphModel

type GraphModel struct {
	Name string `json:"name"`

	Components  []*ComponentModel  `json:"components"`
	Connections []*ConnectionModel `json:"connections"`
}

func ParseDSL

func ParseDSL(lines string) (*GraphModel, error)

func (*GraphModel) ReadFromJSON

func (m *GraphModel) ReadFromJSON(jsn string) error

func (*GraphModel) String

func (g *GraphModel) String() string

func (*GraphModel) Validate

func (m *GraphModel) Validate() error

func (*GraphModel) WriteToJSON

func (m *GraphModel) WriteToJSON() (string, error)

type Network

type Network struct {
	flow.Graph
	// contains filtered or unexported fields
}

Network represents a running instance of a Graph We can have several Networks running at the same time.

func NewNetwork

func NewNetwork(graphModel *GraphModel) (net *Network, err error)

func (*Network) Execute

func (g *Network) Execute(timeout int) (err error)

timeout is in seconds, zero means no timeout

type Parser

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

type Serializer

type Serializer interface {
	ReadFromJSON(string) error
	WriteToJSON() (string, error)
	Validate() error
}

type Starter

type Starter struct {
	ComponentCore
	Input  <-chan string
	Output chan<- string
}

func (*Starter) Configure

func (*Starter) Configure() error

func (*Starter) OnInput

func (s *Starter) OnInput(string)

type Stopper

type Stopper struct {
	ComponentCore
	Input  <-chan string
	Output chan<- string
}

func (*Stopper) Configure

func (*Stopper) Configure() error

func (*Stopper) OnInput

func (s *Stopper) OnInput(string)

type Token

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

func (Token) String

func (t Token) String() string

type Tokenizer

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

func (*Tokenizer) Peek

func (t *Tokenizer) Peek() Token

return top, but don't pop

func (*Tokenizer) Pop

func (t *Tokenizer) Pop() Token

pop from front

func (*Tokenizer) Push

func (t *Tokenizer) Push(token Token)

push onto end

func (*Tokenizer) PutBack

func (t *Tokenizer) PutBack(token Token)

push onto front!

func (*Tokenizer) Scan

func (t *Tokenizer) Scan(lines string) error

type TypeFactory

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

func (*TypeFactory) Create

func (f *TypeFactory) Create(typ string, config ArgMap) (Component, error)

func (*TypeFactory) Register

func (f *TypeFactory) Register(name string, typ Component)

type Variables

type Variables map[string]interface{}

func (Variables) String

func (vs Variables) String() string

Jump to

Keyboard shortcuts

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