pipeline

package
v0.9.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllRegisteredJoints

func GetAllRegisteredJoints() map[string]interface{}

func Register

func Register(joint Joint)

func RegisterByName

func RegisterByName(jointName string, joint Joint)

Types

type Context

type Context struct {
	Parameters

	Simulate     bool        `json:"simulate"`
	Phrase       Phrase      `json:"phrase"`
	IgnoreBroken bool        `json:"ignore_broken"`
	Payload      interface{} `json:"-"`
	// contains filtered or unexported fields
}

func (*Context) End added in v0.9.0

func (context *Context) End(msg interface{})

End break all pipelines, but the end phrase not included

func (*Context) Exit added in v0.9.0

func (context *Context) Exit(msg interface{})

Exit tells pipeline to exit

func (*Context) IsEnd added in v0.9.0

func (context *Context) IsEnd() bool

IsEnd indicates whether the pipe process is end, end means no more processes will be execute

func (*Context) IsExit added in v0.9.0

func (context *Context) IsExit() bool

IsExit means all pipelines will be breaked and jump to outside, even the end phrase will not be executed as well

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" config:"joint"`           //the joint name
	Parameters map[string]interface{} `json:"parameters" config:"parameters"` //kv parameters for this joint
	Enabled    bool                   `json:"enabled" config:"enabled"`
}

JointConfig configs for each joint

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 (para *Parameters) Get(key ParaKey) interface{}

func (*Parameters) GetBool added in v0.9.0

func (para *Parameters) GetBool(key ParaKey, defaultV bool) bool

func (*Parameters) GetInt

func (para *Parameters) GetInt(key ParaKey, defaultV int) (int, bool)

func (*Parameters) GetInt64 added in v0.9.0

func (para *Parameters) GetInt64(key ParaKey, defaultV int64) (int64, bool)

func (*Parameters) GetInt64OrDefault added in v0.9.0

func (para *Parameters) GetInt64OrDefault(key ParaKey, defaultV int64) int64

func (*Parameters) GetIntOrDefault added in v0.9.0

func (para *Parameters) GetIntOrDefault(key ParaKey, defaultV int) int

func (*Parameters) GetMap

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

func (*Parameters) GetOrDefault

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

func (*Parameters) GetString

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

func (*Parameters) GetStringArray added in v0.9.0

func (para *Parameters) GetStringArray(key ParaKey) ([]string, bool)

GetStringArray will return a array which type of the items are string

func (*Parameters) GetStringOrDefault

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

func (*Parameters) Has

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

func (*Parameters) Init

func (para *Parameters) Init()

func (*Parameters) MustGet

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

func (*Parameters) MustGetBytes

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

func (*Parameters) MustGetInt

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

MustGetInt return 0 if not key was found

func (*Parameters) MustGetInt64 added in v0.9.0

func (para *Parameters) MustGetInt64(key ParaKey) int64

func (*Parameters) MustGetMap

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

func (*Parameters) MustGetString

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

func (*Parameters) Set

func (para *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 (pipe *Pipeline) Context(s *Context) *Pipeline

func (*Pipeline) End

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

func (*Pipeline) GetContext

func (pipe *Pipeline) GetContext() *Context

func (*Pipeline) GetID

func (pipe *Pipeline) GetID() string

func (*Pipeline) Join

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

func (*Pipeline) Run

func (pipe *Pipeline) Run() *Context

func (*Pipeline) Start

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

type PipelineConfig

type PipelineConfig struct {
	Name          string         `json:"name" config:"name"`
	Context       *Context       `json:"context" config:"context"`
	StartJoint    *JointConfig   `json:"start" config:"start"`
	ProcessJoints []*JointConfig `json:"process" config:"process"`
	EndJoint      *JointConfig   `json:"end" config:"end"`
}

PipelineConfig config for each pipeline, a pipeline may have more than one joints

Jump to

Keyboard shortcuts

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