pipe

package
v0.0.0-...-9fb4de0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2020 License: MIT Imports: 4 Imported by: 8

Documentation

Overview

package pipe initializes, configures and runs a pipeline

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Steps []StepConfig `json:"steps"`
}

Config is the Configuration Object to setup all steps

type Pipeline

type Pipeline struct {
	Steps []Step
}

Pipeline holds all steps and executes them on after each other

func (*Pipeline) FromConfig

func (p *Pipeline) FromConfig(reader io.Reader) error

FromConfig takes a StepConfig in JSON format and creates an executable Pipeline from it

func (*Pipeline) Run

func (p *Pipeline) Run(reader io.Reader, writer io.Writer) error

Run starts the pipeline It takes the input from the reader and pipes it into the first step The result written to the writer of the last step will be emitted to the writer passed to Run

type Step

type Step interface {
	Invoke(reader io.Reader, writer io.Writer) error
}

Step is a pipeline step which takes an io.Reader as well as an io.Writer as arguments The previous (or first) pipeline step will pipe its result to the reader of the next (or final) pipeline step. The step is expected to write its result to the writer so that the next (or final) step can proceed doing its work.

type StepConfig

type StepConfig struct {
	Kind   string          `json:"kind"`
	Config json.RawMessage `json:"config"`
}

StepConfig is the object to hold the kind and config of each step

Jump to

Keyboard shortcuts

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