dispatcher

package
v0.20.2 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dispatcher

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

Dispatcher is the central place which runs Pipelines. maxWorkers is based by default on number of CPUs * 2 accounting for modern CPU architectures.

func New

func New() *Dispatcher

New returns a set up instance of Dispatcher

func (*Dispatcher) RunPipelines

func (dispatch *Dispatcher) RunPipelines(pipelines []Pipeliner) *Results

RunPipelines will run asynchronously all pipelines passed to it. It is limited only by the maxWorkers field on Dispatcher.

type FailureData

type FailureData struct {
	Name  string
	Value string
}

FailureData is used to build the table output Example: "hash": "somehash". It is built as a struct to enforce order

type PipelineError

type PipelineError struct {
	PipelineName string
	Data         []FailureData
	Error        error
}

PipelineError is used to group errors based on PipelineName

type PipelineSuccess

type PipelineSuccess struct {
	PipelineName string
	Message      string
}

PipelineSuccess is returned by a pipeline if it encounters no errors

type Pipeliner

type Pipeliner interface {
	Name() string
	Run() (*PipelineSuccess, error)
}

Pipeliner interface describes the requirements for pipelines the dispatcher can run

type Results

type Results struct {
	SuccessfulPipelines []PipelineSuccess
	Errors              []PipelineError
}

Results contains the aggregated results of both the succesful and error pipelines.

Jump to

Keyboard shortcuts

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