Documentation
¶
Overview ¶
Package conveyor implements a conveyor for process items step by step.
Index ¶
- Constants
- func New(workBranchLength int, chanType faces.ChanType, name string) faces.IConveyor
- func NewTest(workBranchLength 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) DefaultPriority() int
- func (c *Conveyor) GetDefaultPriority() int
- func (c *Conveyor) GetName() string
- func (c *Conveyor) Init(workBranchLength int, chType faces.ChanType, name string, ...) faces.IConveyor
- func (c *Conveyor) MetricPeriod(duration time.Duration) faces.IConveyor
- func (c *Conveyor) Run(i faces.IInput)
- func (c *Conveyor) RunRes(i faces.IInput) (interface{}, error)
- func (c *Conveyor) RunResTest(i faces.IInput, testObject faces.ITestObject) (interface{}, error)
- func (c *Conveyor) RunTest(i faces.IInput, testObject faces.ITestObject)
- 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, duration time.Duration) 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()
- func (c *Conveyor) WorkBench() faces.IWorkBench
Constants ¶
const DefaultMetricPeriodDuration = 10 * time.Second
DefaultMetricPeriodDuration set up by default default for send/print metric.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Conveyor ¶
type Conveyor struct {
// contains filtered or unexported fields
}
Conveyor is main top structure supported the faces.IConveyor interface. It is exported to possibility of debug in outside applications.
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
AddHandler adds customer handler. Parameter name should be unique. minCount should be less or equal the maxCount and great than zero. The order of adding handlers are important. The handlers are called in the same order as they were added.
func (*Conveyor) DefaultPriority ¶ added in v0.0.3
DefaultPriority returns the current default priority. The current default priority is used if a priority is not set up for item.
func (*Conveyor) GetDefaultPriority ¶
GetDefaultPriority returns the default priority of items. It makes sense if priority queue is used.
func (*Conveyor) Init ¶ added in v0.0.2
func (c *Conveyor) Init(workBranchLength int, chType faces.ChanType, name string, testObject faces.ITestObject) faces.IConveyor
Init is full constructor for accurate configuration.
func (*Conveyor) MetricPeriod ¶
MetricPeriod sets up the period between metric evaluations. By default 10 second.
func (*Conveyor) Run ¶
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) RunRes ¶
RunRes creates the new item over interface, sends to conveyor and returns result.
func (*Conveyor) RunResTest ¶ added in v0.0.19
RunResTest creates the new item over interface, sends to conveyor and returns result.
func (*Conveyor) RunTest ¶ added in v0.0.19
func (c *Conveyor) RunTest(i faces.IInput, testObject faces.ITestObject)
RunTest creates the new item over interface and sends to conveyor. 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.
func (*Conveyor) WorkBench ¶ added in v0.2.0
func (c *Conveyor) WorkBench() faces.IWorkBench
WorkBench is a simple getter
Directories
¶
| Path | Synopsis |
|---|---|
|
example
|
|
|
quickstart
command
|
|
|
simple
command
|
|
|
Package faces implements the full list of Interfaces.
|
Package faces implements the full list of Interfaces. |
|
mmock
Package mmock is a generated GoMock package.
|
Package mmock is a generated GoMock package. |
|
Package input implements the faces.IInput interface.
|
Package input implements the faces.IInput interface. |
|
Package internalmanager is an internal package.
|
Package internalmanager is an internal package. |
|
Package item implements the faces.IItem interface.
|
Package item implements the faces.IItem interface. |
|
protobuf
|
|
|
Package queues implements the IChan interface and provides 3 simples realization of them.
|
Package queues implements the IChan interface and provides 3 simples realization of them. |
|
priorityqueue
Package priorityqueue supports the priority queues for using them in conveyor.
|
Package priorityqueue supports the priority queues for using them in conveyor. |
|
stack
Package stack supports the stack queues LIFO (or FILO) for using them in conveyor.
|
Package stack supports the stack queues LIFO (or FILO) for using them in conveyor. |
|
std
Package std supports queue with standard GO-channels for using them in conveyor.
|
Package std supports queue with standard GO-channels for using them in conveyor. |
|
Package slavenode support the slave mode and sends statistic to master node.
|
Package slavenode support the slave mode and sends statistic to master node. |
|
Package testobject realizes the ITestObject interface.
|
Package testobject realizes the ITestObject interface. |
|
Package tracer supports the simple realization of ITrace.
|
Package tracer supports the simple realization of ITrace. |
|
Package workbench supports the simple realization of ITrace.
|
Package workbench supports the simple realization of ITrace. |
|
Package workers is an internal package.
|
Package workers is an internal package. |
|
Package workerscounter rules the number of current worked handlers.
|
Package workerscounter rules the number of current worked handlers. |
