Documentation ¶
Overview ¶
Package pipeline provides a framework for creating pipelines.
Index ¶
- Constants
- type Func
- type IPipeline
- type OnFinished
- type Pipeline
- func (p *Pipeline[In, Out]) GetCounterCreated() *expvar.Int
- func (p *Pipeline[In, Out]) GetCounterDone() *expvar.Int
- func (p *Pipeline[In, Out]) GetCounterFailed() *expvar.Int
- func (p *Pipeline[In, Out]) GetCounterRunning() *expvar.Int
- func (p *Pipeline[In, Out]) GetDescription() string
- func (p *Pipeline[In, Out]) GetLogger() sypl.ISypl
- func (p *Pipeline[In, Out]) GetName() string
- func (p *Pipeline[In, Out]) GetOnFinished() OnFinished[In, Out]
- func (p *Pipeline[In, Out]) GetPaused() status.Status
- func (p *Pipeline[In, Out]) GetStatus() *expvar.String
- func (p *Pipeline[In, Out]) Run(ctx context.Context, in []In) ([]Out, error)
- func (p *Pipeline[In, Out]) SetOnFinished(onFinished OnFinished[In, Out])
- func (p *Pipeline[In, Out]) SetPaused()
Constants ¶
const Type = "pipeline"
Type of the entity.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Func ¶ added in v0.1.0
Func allows to specify message's options.
func WithOnFinished ¶ added in v0.1.0
func WithOnFinished[In, Out any](onFinished OnFinished[In, Out]) Func[In, Out]
WithOnFinished sets the OnFinished function.
type IPipeline ¶
type IPipeline[In, Out any] interface { shared.IMeta shared.IMetrics // GetPaused returns the Paused status. GetPaused() status.Status // SetPaused sets the Paused status. SetPaused() // GetOnFinished returns the `OnFinished` function. GetOnFinished() OnFinished[In, Out] // SetOnFinished sets the `OnFinished` function. SetOnFinished(onFinished OnFinished[In, Out]) // Run the pipeline. Run(ctx context.Context, in []In) (out []Out, err error) }
IPipeline defines what a `Pipeline` must do.
type OnFinished ¶ added in v0.1.0
type OnFinished[In, Out any] func(ctx context.Context, p IPipeline[In, Out], in []In, processedOut []Out)
OnFinished is the function that is called when a processor finishes its execution.
type Pipeline ¶
type Pipeline[In any, Out any] struct { // Concurrent determines whether the stage should be run concurrently. ConcurrentStage bool `json:"concurrentStage"` // Logger is the pipeline logger. Logger sypl.ISypl `json:"-" validate:"required"` // Description of the processor. Description string `json:"description"` // Name of the processor. Name string `json:"name" validate:"required"` // Progress of the pipeline. Progress int `json:"progress"` // OnFinished is the function that is called when a processor finishes its // execution. OnFinished OnFinished[In, Out] `json:"-"` // Stages to be used in the pipeline. Stages []stage.IStage[In, Out] `json:"stages" validate:"dive,required,dive"` // Metrics. CounterCreated *expvar.Int `json:"counterCreated" validate:"required,gte=0"` CounterRunning *expvar.Int `json:"counterRunning" validate:"required,gte=0"` CounterFailed *expvar.Int `json:"counterFailed" validate:"required,gte=0"` CounterDone *expvar.Int `json:"counterDone" validate:"required,gte=0"` Status *expvar.String `json:"status" validate:"required,gte=0"` }
Pipeline definition.
func (*Pipeline[In, Out]) GetCounterCreated ¶ added in v0.1.0
GetCounterCreated returns the `CounterCreated` of the processor.
func (*Pipeline[In, Out]) GetCounterDone ¶ added in v0.1.0
GetCounterDone returns the `CounterDone` of the processor.
func (*Pipeline[In, Out]) GetCounterFailed ¶ added in v0.1.0
GetCounterFailed returns the `CounterFailed` of the processor.
func (*Pipeline[In, Out]) GetCounterRunning ¶ added in v0.1.0
GetCounterRunning returns the `CounterRunning` of the processor.
func (*Pipeline[In, Out]) GetDescription ¶
GetDescription returns the `Description` of the pipeline.
func (*Pipeline[In, Out]) GetLogger ¶ added in v0.1.0
GetLogger returns the `Logger` of the pipeline.
func (*Pipeline[In, Out]) GetOnFinished ¶ added in v0.1.0
func (p *Pipeline[In, Out]) GetOnFinished() OnFinished[In, Out]
GetOnFinished returns the `OnFinished` function.
func (*Pipeline[In, Out]) SetOnFinished ¶ added in v0.1.0
func (p *Pipeline[In, Out]) SetOnFinished(onFinished OnFinished[In, Out])
SetOnFinished sets the `OnFinished` function.