pipeline

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PipeLevel

type PipeLevel int8

PipeLevel level in pipe

const (
	Debugger PipeLevel = iota // default 0:debug wrap
	Enhancer                  // enhancer feature
	Feature                   // user feature

	Initiator PipeLevel = math.MinInt8 // run first,default priority
	Runner    PipeLevel = math.MaxInt8 // final runner
)

priority const lower will run before than higher you can customize your own priority

func ClosePipeLevel

func ClosePipeLevel(p PipeLevel) PipeLevel

ClosePipeLevel by original pipeLevel if register close, flip around 0 would be useful

type PipeLine

type PipeLine interface {
	heap.Interface // sort by pipeLevel
	fmt.Stringer   // print order by pipeLevel
	AddStage(parent string, name string, stage PipeLine) PipeLine
	GetStage(name string) PipeLine
	CustomizeStage(name string, stage PipeLine) PipeLine
	RemoveStage(name string) PipeLine
	Exec(input interface{}) (output interface{}, err error)
}

PipeLine interface every stage is also a pipeline

type SimpleFunc

type SimpleFunc func() error

SimpleFunc stage fn

type SimpleFuncStage

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

SimpleFuncStage simple func stage

func NewSimpleFuncStage

func NewSimpleFuncStage(name, split string) *SimpleFuncStage

NewSimpleFuncStage empty root simple func pipe

func (*SimpleFuncStage) AddStage

func (s *SimpleFuncStage) AddStage(parent string, name string, stage PipeLine) PipeLine

AddStage add stage to pipe or offspring of this pipe

func (*SimpleFuncStage) CustomizeStage

func (s *SimpleFuncStage) CustomizeStage(name string, stage PipeLine) PipeLine

CustomizeStage customize stage with new stage

func (*SimpleFuncStage) Exec

func (s *SimpleFuncStage) Exec(input interface{}) (output interface{}, err error)

Exec finally

func (*SimpleFuncStage) GetStage

func (s *SimpleFuncStage) GetStage(name string) PipeLine

GetStage get stage with name

func (*SimpleFuncStage) Len

func (s *SimpleFuncStage) Len() int

func (*SimpleFuncStage) Less

func (s *SimpleFuncStage) Less(i, j int) bool

func (*SimpleFuncStage) Pop

func (s *SimpleFuncStage) Pop() interface{}

func (*SimpleFuncStage) Push

func (s *SimpleFuncStage) Push(x interface{})

func (*SimpleFuncStage) RemoveStage

func (s *SimpleFuncStage) RemoveStage(name string) PipeLine

RemoveStage remove stage with name

func (*SimpleFuncStage) SetDefaultPPL

func (s *SimpleFuncStage) SetDefaultPPL(p PipeLevel) *SimpleFuncStage

SetDefaultPPL set default priority for parent(auto added)

func (*SimpleFuncStage) SetFunc

SetFunc set func

func (*SimpleFuncStage) SetPriority

func (s *SimpleFuncStage) SetPriority(p PipeLevel) *SimpleFuncStage

SetPriority set priority

func (*SimpleFuncStage) String

func (s *SimpleFuncStage) String() string

String help debug print exec pipeline

func (*SimpleFuncStage) Swap

func (s *SimpleFuncStage) Swap(i, j int)

Jump to

Keyboard shortcuts

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