Documentation ¶
Index ¶
- func New(lengthChannel int, chanType faces.ChanType, name string) faces.IConveyor
- type Conveyor
- func (c *Conveyor) AddErrorHandler(manageName faces.Name, minCount, maxCount int, handler faces.GiveBirth) error
- func (c *Conveyor) AddFinalHandler(name faces.Name, minCount, maxCount int, handler faces.GiveBirth) error
- func (c *Conveyor) AddHandler(name faces.Name, minCount, maxCount int, handler faces.GiveBirth) error
- func (c *Conveyor) GetDefaultPriority() int
- func (c *Conveyor) GetName() string
- func (c *Conveyor) MetricPeriod(duration time.Duration) faces.IConveyor
- func (c *Conveyor) Run(data interface{})
- func (c *Conveyor) RunCtx(ctx context.Context, data interface{})
- func (c *Conveyor) RunPriority(data interface{}, priority int)
- func (c *Conveyor) RunPriorityCtx(ctx context.Context, data interface{}, priority int)
- func (c *Conveyor) RunPriorityTrace(ctx context.Context, tr faces.ITrace, data interface{}, priority int)
- func (c *Conveyor) RunRes(data interface{}, priority int) (interface{}, error)
- func (c *Conveyor) RunResCtx(ctx context.Context, data interface{}, priority int) (interface{}, error)
- func (c *Conveyor) RunResTrace(ctx context.Context, tr faces.ITrace, data interface{}, priority int) (interface{}, error)
- func (c *Conveyor) RunTrace(ctx context.Context, tr faces.ITrace, data interface{})
- func (c *Conveyor) SetDefaultPriority(defaultPriority int)
- func (c *Conveyor) SetMasterNode(addr string, masterNodePeriod time.Duration)
- func (c *Conveyor) SetName(name string) faces.IConveyor
- func (c *Conveyor) SetTracer(tr faces.ITrace) faces.IConveyor
- func (c *Conveyor) SetWorkersCounter(wc faces.IWorkersCounter) faces.IConveyor
- func (c *Conveyor) Start(ctx context.Context) error
- func (c *Conveyor) Statistic() *nodes.SlaveNodeInfoRequest
- func (c *Conveyor) Stop()
- func (c *Conveyor) WaitAndStop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Conveyor ¶
type Conveyor struct {
// contains filtered or unexported fields
}
func (*Conveyor) AddErrorHandler ¶
func (c *Conveyor) AddErrorHandler(manageName faces.Name, minCount, maxCount int, handler faces.GiveBirth) error
AddErrorHandler adds custom error handler for processing the errors which were returned with work handler. Multiple custom error handlers are allowed. If custom error handler returned error the conveyor logs the error but doesn't process.
func (*Conveyor) AddFinalHandler ¶
func (c *Conveyor) AddFinalHandler(name faces.Name, minCount, maxCount int, handler faces.GiveBirth) error
AddFinalHandler adds customer final handler as the latest handler from all. Only single customer final handler is allow. If custom final handler returned error the conveyor doesn't process and log it.
func (*Conveyor) AddHandler ¶
func (c *Conveyor) AddHandler(name faces.Name, minCount, maxCount int, handler faces.GiveBirth) error
addSystemFinalHandler adds customer handler. Parameter name should be unique. minCount should be less or equal the maxCount.
The order of adding handlers are important. The handlers are called in the same order as they were added.
func (*Conveyor) GetDefaultPriority ¶
GetDefaultPriority returns the default priority of items. It makes sense if priority queue is used.
func (*Conveyor) MetricPeriod ¶
MetricPeriod sets up the period between metric evaluations. By default 10 second
func (*Conveyor) Run ¶
func (c *Conveyor) Run(data interface{})
Run creates the new item over interface and sends to conveyor. If priority queue is used the default priority will be set up.
func (*Conveyor) RunCtx ¶
RunCtx is a variety of Run with context If priority queue is used the default priority will be set up.
func (*Conveyor) RunPriority ¶
RunPriority is a variety of Run with priority
func (*Conveyor) RunPriorityCtx ¶
RunPriorityCtx is a variety of RunPriority with context
func (*Conveyor) RunPriorityTrace ¶
func (c *Conveyor) RunPriorityTrace(ctx context.Context, tr faces.ITrace, data interface{}, priority int)
RunPriorityTrace is a variety of RunPriorityCtx with tracer
func (*Conveyor) RunRes ¶
RunRes creates the new item over interface and sends to conveyor and returns result.
func (*Conveyor) RunResCtx ¶
func (c *Conveyor) RunResCtx(ctx context.Context, data interface{}, priority int) (interface{}, error)
RunResCtx is a variety of RunRes with context
func (*Conveyor) RunResTrace ¶
func (c *Conveyor) RunResTrace(ctx context.Context, tr faces.ITrace, data interface{}, priority int) (interface{}, error)
RunResTrace is a variety of RunPriorityCtx with tracer
func (*Conveyor) RunTrace ¶
RunTrace is a variety of RunCtx with tracer If priority queue is used the default priority will be set up.
func (*Conveyor) SetDefaultPriority ¶
SetDefaultPriority sets the priority of items.
It makes sense if priority queue is used. If priority is not set up it equals the 0 (defaultPriority constant)
func (*Conveyor) SetMasterNode ¶
SetMasterNode sets the internet address master node. Master node allow to get information online about current conveyor see more information github.com/iostrovok/conveyormaster
func (*Conveyor) SetWorkersCounter ¶
func (c *Conveyor) SetWorkersCounter(wc faces.IWorkersCounter) faces.IConveyor
SetWorkersCounter sets up the tracer with IWorkersCounter interface WorkersCounter rules the number of current worked handlers.
func (*Conveyor) Statistic ¶
func (c *Conveyor) Statistic() *nodes.SlaveNodeInfoRequest
Statistic returns the information about current stage of conveyor.
func (*Conveyor) Stop ¶
func (c *Conveyor) Stop()
Stop stops the conveyor. Processing of items will be interrupted.
func (*Conveyor) WaitAndStop ¶
func (c *Conveyor) WaitAndStop()
WaitAndStop waits while all handler are finished and exits. Processing of items will not be interrupted.
Directories ¶
Path | Synopsis |
---|---|
Just for fun - simple script which grabs documentation from "godoc" local server
|
Just for fun - simple script which grabs documentation from "godoc" local server |
example
|
|
mmock
Package mmock is a generated GoMock package.
|
Package mmock is a generated GoMock package. |
Internal package.
|
Internal package. |
Package realizes the IItem interface.
|
Package realizes the IItem interface. |
protobuf
|
|
Package supports the IChan interface and provides 3 simples realization of them.
|
Package supports the IChan interface and provides 3 simples realization of them. |
priorityqueue
The package support the priority queue for using them in conveyor.
|
The package support the priority queue for using them in conveyor. |
stack
The package support the stack queue LIFO (or FILO) for using them in conveyor.
|
The package support the stack queue LIFO (or FILO) for using them in conveyor. |
std
The package support queue with standard GO-channels for using them in conveyor.
|
The package support queue with standard GO-channels for using them in conveyor. |
The package support the slave mode and sends statistic to master node.
|
The package support the slave mode and sends statistic to master node. |
Package supports the simple realization of ITrace.
|
Package supports the simple realization of ITrace. |
Internal package.
|
Internal package. |
WorkersCounter rules the number of current worked handlers.
|
WorkersCounter rules the number of current worked handlers. |