Documentation
¶
Overview ¶
Package process is a package for managing a processing pipeline. Copied from https://github.com/rheinardkorf/go-concurrency/blob/master/11_pipeline_complex/pipe/process.go
Index ¶
- type Info
- type Ingest
- type Lighthouse
- type Phpcs
- type Process
- func (p *Process) CopyFields(proc Processor)
- func (p Process) Error(msg string) error
- func (p Process) GetFilesPath() string
- func (p Process) GetMessage() message.Message
- func (p Process) GetResult() *Result
- func (p *Process) Run() (<-chan error, error)
- func (p *Process) SetContext(ctx context.Context)
- func (p *Process) SetFilesPath(path string)
- func (p *Process) SetMessage(msg message.Message)
- func (p *Process) SetResults(res *Result)
- type Processor
- type Response
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Info ¶
type Info struct { Process // Inherits methods from Process. In <-chan Processor // Expects a processor channel as input. Out chan Processor // Send results to an output channel. }
Info defines the structure for our Info process.
type Ingest ¶
type Ingest struct { Process // Inherits methods from Process. In <-chan message.Message // Expects a message channel as input. Out chan Processor // Send results to an output channel. TempFolder string // Path to a temp folder where files will be extracted. // contains filtered or unexported fields }
Ingest defines the structure for our Ingest process.
type Lighthouse ¶
type Lighthouse struct { Process // Inherits methods from Process. In <-chan Processor // Expects a processor channel as input. Out chan Processor // Send results to an output channel. TempFolder string // Path to a temp folder where reports will be generated. StorageProvider storage.Provider // Storage provider to upload reports to. }
Lighthouse defines the structure for our Lighthouse process.
func (*Lighthouse) Run ¶
func (lh *Lighthouse) Run(errc *chan error) error
Run runs the process in a pipeline.
type Phpcs ¶
type Phpcs struct { Process // Inherits methods from Process. In <-chan Processor // Expects a processor channel as input. Out chan Processor // Send results to an output channel. Config Result // Additional config. TempFolder string // Path to a temp folder where reports will be generated. StorageProvider storage.Provider // Storage provider to upload reports to. PhpcsVersions map[string]map[string]string // PHPCS versions. }
Phpcs defines the structure for our Phpcs process.
type Process ¶
type Process struct { Message message.Message // Keeps track of the original message. Result *Result // Passes along a Result object. FilesPath string // Path of files to audit. // contains filtered or unexported fields }
Process is the base for all processes.
func (*Process) CopyFields ¶
CopyFields copies required fields from one process to another.
func (Process) GetFilesPath ¶
GetFilesPath gets the path of the source used for processing.
func (Process) GetMessage ¶
GetMessage returns the message object for this process.
func (*Process) Run ¶
Run is a default implementation with an error nag. Not required, but serves as an example.
func (*Process) SetContext ¶
SetContext sets the context so that it can be used in the processes to terminate goroutines if it needs to.
func (*Process) SetFilesPath ¶
SetFilesPath sets the path of the code to run the process againsts.
func (*Process) SetMessage ¶
SetMessage is used to set the Message for this process (used for copying the message).
func (*Process) SetResults ¶
SetResults sets the results for this process (used for copying results from process to process).
type Processor ¶
type Processor interface { Run(*chan error) error Do() error SetContext(ctx context.Context) SetMessage(msg message.Message) GetMessage() message.Message SetResults(res *Result) GetResult() *Result SetFilesPath(path string) GetFilesPath() string }
Processor is an interface for all processors.
type Response ¶
type Response struct { Process // Inherits methods from Process. In <-chan Processor // Expects a processor channel as input. Out chan Processor // (Optional) Send results to an output channel. Payloaders map[string]payload.Payloader // A map of "Payloader"s for different services. }
Response defines the structure for a Response process. This determines where the processed results will be sent.