runtime

package
v0.0.0-...-e99cc0b Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrSkip is used as a return value when container
	// execution should be skipped at runtime. It is not
	// returned as an error by any function.
	ErrSkip = errors.New("Skipped")

	// ErrCancel is used as a return value when the
	// container execution receives a cancellation signal
	// from the context.
	ErrCancel = errors.New("Cancelled")

	// ErrInterrupt is used to signal an interrupt and
	// gracefully exit the runtime execution.
	ErrInterrupt = errors.New("Interrupt")
)

Functions

This section is empty.

Types

type ExitError

type ExitError struct {
	Name string
	Code int
}

An ExitError reports an unsuccessful exit.

func (*ExitError) Error

func (e *ExitError) Error() string

Error returns the error message in string format.

type Hook

type Hook struct {
	// Before is called before all all steps are executed.
	Before func(*State) error

	// BeforeEach is called before each step is executed.
	BeforeEach func(*State) error

	// After is called after all steps are executed.
	After func(*State) error

	// AfterEach is called after each step is executed.
	AfterEach func(*State) error

	// GotLine is called when a line is logged.
	GotLine func(*State, *Line) error

	// GotLogs is called when the logs are completed.
	GotLogs func(*State, []*Line) error
}

Hook provides a set of hooks to run at various stages of runtime execution.

type Line

type Line struct {
	Number    int    `json:"pos,omitempty"`
	Message   string `json:"out,omitempty"`
	Timestamp int64  `json:"time,omitempty"`
}

Line represents a line in the container logs.

type OomError

type OomError struct {
	Name string
	Code int
}

An OomError reports the process received an OOMKill from the kernel.

func (*OomError) Error

func (e *OomError) Error() string

Error reteurns the error message in string format.

type Option

type Option func(*Runtime)

Option configures a Runtime option.

func WithConfig

func WithConfig(c *engine.Spec) Option

WithConfig sets the Runtime configuration.

func WithEngine

func WithEngine(e engine.Engine) Option

WithEngine sets the Runtime engine.

func WithHooks

func WithHooks(h *Hook) Option

WithHooks sets the Runtime tracer.

type Runtime

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

Runtime executes a pipeline configuration.

func New

func New(opts ...Option) *Runtime

New returns a new runtime using the specified runtime configuration and runtime engine.

func (*Runtime) Resume

func (r *Runtime) Resume(ctx context.Context, start int) error

Resume starts the pipeline at the specified stage and waits for it to complete.

func (*Runtime) Run

func (r *Runtime) Run(ctx context.Context) error

Run starts the pipeline and waits for it to complete.

type State

type State struct {

	// Global state of the runtime.
	Runtime struct {
		// Runtime time started
		Time int64

		// Runtime pipeline error state
		Error error
	}

	// Runtime pipeline step
	Step *engine.Step

	// Current process state.
	State *engine.State
	// contains filtered or unexported fields
}

State defines the pipeline and process state.

Directories

Path Synopsis
mocks
Package mock_engine is a generated GoMock package.
Package mock_engine is a generated GoMock package.

Jump to

Keyboard shortcuts

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