lifecycle

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContainerSigQuitGracePeriod = 2 * time.Second
	ContainerStatePollInterval  = 1 * time.Second

	ContainerStateRunning = "running"
	ContainerStatePaused  = "paused"
	ContainerStateStopped = "stopped"
)

Variables

This section is empty.

Functions

func IsNotExist added in v0.6.0

func IsNotExist(err error) bool

Types

type CommandRunner

type CommandRunner interface {
	Run(*exec.Cmd) error
}

func NewCommandRunner

func NewCommandRunner() CommandRunner

type RuncAdapter

type RuncAdapter interface {
	CreateJobPrerequisites(bpmCfg *config.BPMConfig, procCfg *config.ProcessConfig, user specs.User) (*os.File, *os.File, error)
	BuildSpec(logger lager.Logger, bpmCfg *config.BPMConfig, procCfg *config.ProcessConfig, user specs.User) (specs.Spec, error)
}

type RuncClient

type RuncClient interface {
	CreateBundle(bundlePath string, jobSpec specs.Spec, user specs.User) error
	RunContainer(pidFilePath, bundlePath, containerID string, detach bool, stdout, stderr io.Writer) (int, error)
	Exec(containerID, command string, stdin io.Reader, stdout, stderr io.Writer) error
	ContainerState(containerID string) (*specs.State, error)
	ListContainers() ([]client.ContainerState, error)
	SignalContainer(containerID string, signal client.Signal) error
	DeleteContainer(containerID string) error
	DestroyBundle(bundlePath string) error
}

type RuncLifecycle

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

func NewRuncLifecycle

func NewRuncLifecycle(
	runcClient RuncClient,
	runcAdapter RuncAdapter,
	userFinder UserFinder,
	commandRunner CommandRunner,
	clock clock.Clock,
	deleteFile func(string) error,
) *RuncLifecycle

func (*RuncLifecycle) ListProcesses

func (j *RuncLifecycle) ListProcesses() ([]*models.Process, error)

func (*RuncLifecycle) OpenShell

func (j *RuncLifecycle) OpenShell(cfg *config.BPMConfig, stdin io.Reader, stdout, stderr io.Writer) error

func (*RuncLifecycle) RemoveProcess

func (j *RuncLifecycle) RemoveProcess(logger lager.Logger, cfg *config.BPMConfig) error

func (*RuncLifecycle) RunProcess added in v0.8.0

func (j *RuncLifecycle) RunProcess(logger lager.Logger, bpmCfg *config.BPMConfig, procCfg *config.ProcessConfig) (int, error)

func (*RuncLifecycle) StartProcess

func (j *RuncLifecycle) StartProcess(logger lager.Logger, bpmCfg *config.BPMConfig, procCfg *config.ProcessConfig) error

func (*RuncLifecycle) StatProcess added in v0.6.0

func (j *RuncLifecycle) StatProcess(cfg *config.BPMConfig) (*models.Process, error)

func (*RuncLifecycle) StopProcess

func (j *RuncLifecycle) StopProcess(logger lager.Logger, cfg *config.BPMConfig, exitTimeout time.Duration) error

type UserFinder

type UserFinder interface {
	Lookup(username string) (specs.User, error)
}

Jump to

Keyboard shortcuts

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