Documentation ¶
Index ¶
Constants ¶
View Source
const ( ChanStdGo = ChanType(nodes.ChanType_CHAN_STD_GO) ChanStack = ChanType(nodes.ChanType_CHAN_STACK) ChaPriorityQueue = ChanType(nodes.ChanType_CHAN_PRIORITY_QUEUE) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EmptyHandler ¶ added in v0.0.3
type EmptyHandler struct{}
EmptyHandler realizes the empty handler which do nothing. It is useful for replace empty Start and Stop methods by inherited objects.
Example:
type MySimpleHandler struct { EmptyHandler } func Handler(_ faces.Name) (faces.IHandler, error) { return &MySimpleHandler{}, nil } func (m *MySimpleHandler) Run(item faces.IItem) error {s // do something here return nil }
func (*EmptyHandler) Run ¶ added in v0.0.3
func (m *EmptyHandler) Run(_ IItem) error
Run does nothing
type GiveBirth ¶
GiveBirth return new handler. Type Name is string which was passed with AddHandler(...)
type IConveyor ¶
type IConveyor interface { Start(ctx context.Context) error Stop() WaitAndStop() // simple pushing Run(IInput) RunRes(IInput) (interface{}, error) SetDefaultPriority(defaultPriority int) GetDefaultPriority() int SetName(name string) IConveyor GetName() string SetWorkersCounter(wc IWorkersCounter) IConveyor AddHandler(manageName Name, minCount, maxCount int, handler GiveBirth) error AddErrorHandler(manageName Name, minCount, maxCount int, handler GiveBirth) error AddFinalHandler(manageName Name, minCount, maxCount int, handler GiveBirth) error Statistic() *nodes.SlaveNodeInfoRequest SetTracer(tr ITrace, duration time.Duration) IConveyor // The period between metric evaluations. // By default 10 second MetricPeriod(duration time.Duration) IConveyor // Master node is single node for control the conveyor SetMasterNode(addr string, masterNodePeriod time.Duration) DefaultPriority() int }
type IHandler ¶
type IHandler interface { // Start() function is called one time for each handler right after it's created with GiveBirth(). Start(ctx context.Context) error // Run() function is called for processing single item. Run(item IItem) error // Stop() function is called before destruction of handler. Stop() }
type IInput ¶ added in v0.0.9
type IInput interface { Context(ctx context.Context) IInput // by default the context.Background() Trace(tr ITrace) IInput // nil is by default Data(data interface{}) IInput // nil is by default Priority(priority int) IInput // by default is IConveyor.DefaultPriority() SkipToName(name Name) IInput // by default is "" // return all data above Values() (ctx context.Context, tr ITrace, data interface{}, priority *int, name Name) }
type IItem ¶
type IItem interface { GetID() int64 SetID(id int64) IItem Get() (data interface{}) Set(data interface{}) IItem GetContext() context.Context AddError(err error) GetError() error CleanError() SetSkipToName(label Name) GetSkipToName() Name NeedToSkip(worker IWorker) (bool, error) LogTraceFinishTime(format string, a ...interface{}) LogTrace(format string, a ...interface{}) Start() IItem Cancel() Finish() // >>>>>>> Priority Queue Supports GetPriority() int SetPriority(priority int) IItem SetHandlerError(handlerNameWithError Name) IItem GetHandlerError() Name SetLastHandler(handlerName Name) IItem GetLastHandler() Name }
type IManager ¶
type IManager interface { SetHandler(handler GiveBirth) IManager Start(ctx context.Context) error Stop() SetWorkersCounter(wc IWorkersCounter) IManager SetChanIn(in IChan) IManager SetChanOut(out IChan) IManager SetChanErr(errCh IChan) IManager GetNextManager() IManager SetNextManager(next IManager) IManager GetPrevManager() IManager SetPrevManager(previous IManager) IManager SetIsLast(isLast bool) IManager IsLast() bool SetWaitGroup(wg *sync.WaitGroup) IManager MetricPeriod(duration time.Duration) IManager Statistic() *nodes.ManagerData }
type ITrace ¶
type ITrace interface { // LazyPrintf evaluates its arguments with fmt.Sprintf each time the // /debug/requests page is rendered. Any memory referenced by a will be // pinned until the trace is finished and later discarded. LazyPrintf(format string, a ...interface{}) // SetError declares that this trace resulted in an error. SetError() // Flush will call at the end on cycle Flush() // Flush will call at the end on cycle ForceFlush() }
type IWorker ¶
type IWorker interface { Start(ctx context.Context) error Stop() SetBorderCond(typ ManagerType, isLast bool) GetBorderCond() (Name, ManagerType, bool) Name() Name ID() string }
type IWorkersCounter ¶
type IWorkersCounter interface {
Check(mc *nodes.ManagerData) (*nodes.ManagerAction, error)
}
type ManagerType ¶
type ManagerType string
const ( WorkerManagerType ManagerType = "worker" ErrorManagerType ManagerType = "error" FinalManagerType ManagerType = "final" )
Source Files ¶
Click to show internal directories.
Click to hide internal directories.