pipeline

package
v0.0.0-...-6b52c20 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2017 License: Apache-2.0 Imports: 11 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllRegisteredJoints

func GetAllRegisteredJoints() map[string]interface{}

func Register

func Register(jointName JointKey, joint Joint)

func RegisterByName

func RegisterByName(jointName string, joint Joint)

Types

type Context

type Context struct {
	Simulate bool `json:"simulate"`
	Parameters
	Phrase       Phrase `json:"phrase"`
	IgnoreBroken bool   `json:"ignore_broken"`

	Payload interface{} `json:"-"`
	// contains filtered or unexported fields
}

func (*Context) Break

func (this *Context) Break(msg interface{})

* break all pipelines, but the end phrase not included

func (*Context) ErrorExit

func (this *Context) ErrorExit(msg interface{})

* tell pipeline to exit all

func (*Context) IsBreak

func (this *Context) IsBreak() bool

func (*Context) IsErrorExit

func (this *Context) IsErrorExit() bool

* break all pipelines, without execute the end phrase

type Joint

type Joint interface {
	Name() string
	Process(s *Context) error
}

func GetJointInstance

func GetJointInstance(cfg *JointConfig) Joint

type JointConfig

type JointConfig struct {
	JointName  string                 `json:"joint_name"` //the joint name
	Parameters map[string]interface{} `json:"parameters"` //kv parameters for this joint
}

* config for each joint

type JointKey

type JointKey string

type ParaKey

type ParaKey string

type Parameters

type Parameters struct {
	Data map[string]interface{} `json:"data"`
	// contains filtered or unexported fields
}

func (*Parameters) Get

func (this *Parameters) Get(key ParaKey) interface{}

func (*Parameters) GetInt

func (this *Parameters) GetInt(key ParaKey) (int, bool)

func (*Parameters) GetMap

func (this *Parameters) GetMap(key ParaKey) (map[string]interface{}, bool)

func (*Parameters) GetOrDefault

func (this *Parameters) GetOrDefault(key ParaKey, val interface{}) interface{}

func (*Parameters) GetString

func (this *Parameters) GetString(key ParaKey) (string, bool)

func (*Parameters) GetStringOrDefault

func (this *Parameters) GetStringOrDefault(key ParaKey, val string) string

func (*Parameters) Has

func (this *Parameters) Has(key ParaKey) bool

func (*Parameters) Init

func (this *Parameters) Init()

func (*Parameters) MustGet

func (this *Parameters) MustGet(key ParaKey) interface{}

func (*Parameters) MustGetBytes

func (this *Parameters) MustGetBytes(key ParaKey) []byte

func (*Parameters) MustGetInt

func (this *Parameters) MustGetInt(key ParaKey) int

return 0 if not key was found

func (*Parameters) MustGetMap

func (this *Parameters) MustGetMap(key ParaKey) map[string]interface{}

func (*Parameters) MustGetString

func (this *Parameters) MustGetString(key ParaKey) string

func (*Parameters) Set

func (this *Parameters) Set(key ParaKey, value interface{})

type Phrase

type Phrase int

type Pipeline

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

func NewPipeline

func NewPipeline(name string) *Pipeline

func NewPipelineFromConfig

func NewPipelineFromConfig(config *PipelineConfig) *Pipeline

func (*Pipeline) Context

func (this *Pipeline) Context(s *Context) *Pipeline

func (*Pipeline) End

func (this *Pipeline) End(s Joint) *Pipeline

func (*Pipeline) GetContext

func (this *Pipeline) GetContext() *Context

func (*Pipeline) GetID

func (this *Pipeline) GetID() string

func (*Pipeline) Join

func (this *Pipeline) Join(s Joint) *Pipeline

func (*Pipeline) Run

func (this *Pipeline) Run() *Context

func (*Pipeline) Start

func (this *Pipeline) Start(s Joint) *Pipeline

type PipelineConfig

type PipelineConfig struct {
	Name          string         `json:"name"`
	Context       *Context       `json:"context"`
	InputJoint    *JointConfig   `json:"input_joint"`
	ProcessJoints []*JointConfig `json:"process_joints"`
	OutputJoint   *JointConfig   `json:"output_joint"`
}

* config for each pipeline, a pipeline have more than one joints

Jump to

Keyboard shortcuts

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