runtime

package
v0.12.9 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package runtime defines the interface between the GCS and an OCI container runtime.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrContainerAlreadyExists = gcserr.WrapHresult(errors.New("container already exist"), gcserr.HrVmcomputeSystemAlreadyExists)
	ErrContainerDoesNotExist  = gcserr.WrapHresult(errors.New("container does not exist"), gcserr.HrVmcomputeSystemNotFound)
	ErrContainerStillRunning  = gcserr.WrapHresult(errors.New("container still running"), gcserr.HrVmcomputeInvalidState)
	ErrContainerNotRunning    = gcserr.WrapHresult(errors.New("container not running"), gcserr.HrVmcomputeSystemAlreadyStopped)
	ErrContainerNotStopped    = gcserr.WrapHresult(errors.New("container not stopped"), gcserr.HrVmcomputeInvalidState)
	ErrInvalidContainerID     = gcserr.WrapHresult(errors.New("invalid container ID"), gcserr.HrErrInvalidArg)
)

Functions

This section is empty.

Types

type Container

type Container interface {
	Process
	ID() string
	Exists() (bool, error)
	Start() error
	ExecProcess(process *oci.Process, stdioSet *stdio.ConnectionSet) (p Process, err error)
	Kill(signal syscall.Signal) error
	Pause() error
	Resume() error
	GetState() (*ContainerState, error)
	GetRunningProcesses() ([]ContainerProcessState, error)
	GetAllProcesses() ([]ContainerProcessState, error)
	GetInitProcess() (Process, error)
	Update(resources interface{}) error
}

Container is an interface to manipulate container state.

type ContainerProcessState

type ContainerProcessState struct {
	Pid              int
	Command          []string
	CreatedByRuntime bool
	IsZombie         bool
}

ContainerProcessState gives information about a process created by a Runtime.

type ContainerState

type ContainerState struct {
	OCIVersion string
	ID         string
	Pid        int
	BundlePath string
	RootfsPath string
	Status     string
	Created    string
}

ContainerState gives information about a container created by a Runtime.

type Process

type Process interface {
	Wait() (int, error)
	Pid() int
	Delete() error
	Tty() *stdio.TtyRelay
	PipeRelay() *stdio.PipeRelay
}

Process is an interface to manipulate process state.

type Runtime

type Runtime interface {
	CreateContainer(id string, bundlePath string, stdioSet *stdio.ConnectionSet) (c Container, err error)
	ListContainerStates() ([]ContainerState, error)
}

Runtime is the interface defining commands over an OCI container runtime, such as runC.

type StdioPipes

type StdioPipes struct {
	In  io.WriteCloser
	Out io.ReadCloser
	Err io.ReadCloser
}

StdioPipes contain the interfaces for reading from and writing to a process's stdio.

Directories

Path Synopsis
Package runc defines an implementation of the Runtime interface which uses runC as the container runtime.
Package runc defines an implementation of the Runtime interface which uses runC as the container runtime.

Jump to

Keyboard shortcuts

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