runtime

package
v0.0.0-...-3e8bd99 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2017 License: Apache-2.0 Imports: 12 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 FileSystem

type FileSystem interface {
	Open(string) (io.ReadCloser, error)
	Stat(string) (os.FileInfo, error)
	Create(string) (io.WriteCloser, error)
	Remove(string) error
}

FileSystem interface defines an abstract file system used by the runtime to snapshot and restore a container file system.

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

	// GotFile is called when a file is exported.
	GotFile func(*State, *engine.FileInfo, io.ReadCloser) 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,omityempty"`
	Message   string `json:"out,omitempty"`
	Timestemp 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.Config) Option

WithConfig sets the Runtime configuration.

func WithEngine

func WithEngine(engine engine.Engine) Option

WithEngine sets the Runtime engine.

func WithFileSystem

func WithFileSystem(fs FileSystem) Option

WithFileSystem sets the Runtime virtual filesystem.

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(c 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(c 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
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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