runtime

package
v0.0.0-...-39278d5 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogFileBase = "runc.log"
)

Variables

This section is empty.

Functions

func NewConsoleReferenceId

func NewConsoleReferenceId() string

func NewIoReferenceId

func NewIoReferenceId() string

func NewSocketReferenceId

func NewSocketReferenceId(allocatedSocket AllocatedSocket) string

func NewUnixSocketReferenceId

func NewUnixSocketReferenceId(path string) string

func NewVsockSocketReferenceId

func NewVsockSocketReferenceId(port uint32) string

func ReflectNotImplementedError

func ReflectNotImplementedError() error

Types

type AllocatedSocket

type AllocatedSocket interface {
	// isAllocatedSocket()
	proxy.ContextDialer
	io.Closer
	Conn() net.Conn
	Ready() error
}

type AllocatedSocketReference

type AllocatedSocketReference interface {
	ReferableByReferenceId
}

type AllocatedSocketWithUnixConn

type AllocatedSocketWithUnixConn interface {
	AllocatedSocket
	UnixConn() *net.UnixConn
}

type BindableConsoleSocket

type BindableConsoleSocket interface {
	ConsoleSocket
	BindToAllocatedSocket(ctx context.Context, sock AllocatedSocket) error
}

type CgroupAdapter

type CgroupAdapter interface {
	Stat(ctx context.Context) (*stats.Metrics, error)
	ToggleControllers(ctx context.Context) error
	OpenEventChan(ctx context.Context) (<-chan *runmv1.CgroupEvent, <-chan error, error)
}

type CgroupEvent

type CgroupEvent struct {
	Low         uint64
	High        uint64
	Max         uint64
	OOM         uint64
	OOMKill     uint64
	ContainerID string
}

type ConsoleSocket

type ConsoleSocket interface {
	ReceiveMaster() (console.Console, error)
	Path() string
	// UnixConn() *net.UnixConn
	Close() error
}

type EventHandler

type EventHandler interface {
	Publish(ctx context.Context, event *PublishEvent) error

	Receive(ctx context.Context) (<-chan *PublishEvent, error)
}

type FileConn

type FileConn interface {
	syscall.Conn
	net.Conn
	Read(p []byte) (n int, err error)
	Write(p []byte) (n int, err error)
	Close() error
}

type GuestManagement

type GuestManagement interface {
	TimeSync(ctx context.Context, unixTimeNs uint64, timezone string) error
	Readiness(ctx context.Context) error
	RunCommand(ctx context.Context, cmd *exec.Cmd) error
}

type HostAllocatedStdio

type HostAllocatedStdio struct {
	StdinSocket  AllocatedSocket
	StdoutSocket AllocatedSocket
	StderrSocket AllocatedSocket

	ReferenceId string
	// contains filtered or unexported fields
}

func NewHostAllocatedStdio

func NewHostAllocatedStdio(ctx context.Context, referenceId string, stdinRef, stdoutRef, stderrRef AllocatedSocket, closeCallbacks ...func(ctx context.Context) error) *HostAllocatedStdio

func (*HostAllocatedStdio) Close

func (p *HostAllocatedStdio) Close() error

func (*HostAllocatedStdio) GetReferenceId

func (p *HostAllocatedStdio) GetReferenceId() string

func (*HostAllocatedStdio) Set

func (p *HostAllocatedStdio) Set(cmd *exec.Cmd)

func (*HostAllocatedStdio) Stderr

func (p *HostAllocatedStdio) Stderr() io.ReadCloser

func (*HostAllocatedStdio) Stdin

func (p *HostAllocatedStdio) Stdin() io.WriteCloser

func (*HostAllocatedStdio) Stdout

func (p *HostAllocatedStdio) Stdout() io.ReadCloser

type HostNullIo

type HostNullIo struct {
	IO
}

func NewHostNullIo

func NewHostNullIo() (*HostNullIo, error)

type IO

type IO interface {
	Stdin() io.WriteCloser
	Stdout() io.ReadCloser
	Stderr() io.ReadCloser
	Close() error
	// unused
	Set(cmd *exec.Cmd)
}

type Platform

type Platform interface {
	CopyConsole(ctx context.Context, console io.ReadWriteCloser, id, stdin, stdout, stderr string, wg *sync.WaitGroup) (cons RuntimeConsole, retErr error)
	ShutdownConsole(ctx context.Context, console RuntimeConsole) error
	Close() error
}

type PublishEvent

type PublishEvent struct {
	Topic string
	Data  []byte
}

type ReferableByReferenceId

type ReferableByReferenceId interface {
	GetReferenceId() string
}

type Runtime

type Runtime interface {
	// SharedDir() string
	// io: yes
	// ✅
	NewPipeIO(ctx context.Context, cioUID, ioGID int, opts ...gorunc.IOOpt) (IO, error)
	// io: yes
	NewTempConsoleSocket(ctx context.Context) (ConsoleSocket, error)
	// io: yes
	// ✅
	NewNullIO() (IO, error)
	// io: yes
	// console: yes
	// channel: yes
	// fd: yes
	Create(ctx context.Context, id, bundle string, opts *gorunc.CreateOpts) error
	// io: yes
	// console: yes
	// channel: yes
	Exec(ctx context.Context, id string, spec specs.Process, opts *gorunc.ExecOpts) error
	// fd: yes
	Checkpoint(ctx context.Context, id string, opts *gorunc.CheckpointOpts, actions ...gorunc.CheckpointAction) error
	// io: yes
	Restore(ctx context.Context, id, bundle string, opts *gorunc.RestoreOpts) (int, error)
	// ✅
	Kill(ctx context.Context, id string, signal int, opts *gorunc.KillOpts) error
	Start(ctx context.Context, id string) error
	// ✅
	Delete(ctx context.Context, id string, opts *gorunc.DeleteOpts) error
	// ✅
	Update(ctx context.Context, id string, resources *specs.LinuxResources) error
	Pause(ctx context.Context, id string) error
	Resume(ctx context.Context, id string) error
	Ps(ctx context.Context, id string) ([]int, error)
	ReadPidFile(ctx context.Context, path string) (int, error)
	SubscribeToReaperExits(ctx context.Context) (<-chan gorunc.Exit, error)
	State(context.Context, string) (*gorunc.Container, error)
	RuncRun(context.Context, string, string, *gorunc.CreateOpts) (int, error)

	Close(ctx context.Context) error
}

type RuntimeConsole

type RuntimeConsole interface {
	console.File

	// Resize resizes the console to the provided window size
	Resize(console.WinSize) error
	// ResizeFrom resizes the calling console to the size of the
	// provided console
	ResizeFrom(RuntimeConsole) error
	// SetRaw sets the console in raw mode
	SetRaw() error
	// DisableEcho disables echo on the console
	DisableEcho() error
	// Reset restores the console to its original state
	Reset() error
	// Size returns the window size of the console
	Size() (console.WinSize, error)
}

type RuntimeCreator

type RuntimeCreator interface {
	Create(ctx context.Context, opts *RuntimeOptions) (Runtime, error)
	Features(ctx context.Context) (*features.Features, error)
}

type RuntimeExtras

type RuntimeExtras interface {

	// Stats returns runtime specific metrics for a container.
	Stats(context.Context, string) (*gorunc.Stats, error)

	// Events returns events for the container.
	Events(context.Context, string, time.Duration) (chan *gorunc.Event, error)

	// List lists all containers.
	List(context.Context) ([]*gorunc.Container, error)

	// Version returns the version of runc.
	Version(context.Context) (gorunc.Version, error)

	Top(context.Context, string, string) (*gorunc.TopResults, error)
}

RuncLibrary defines an interface for interacting with runc containers. This interface mirrors the functionality provided by the go-runc package to allow for easy mocking and testing.

type RuntimeOptions

type RuntimeOptions struct {
	ProcessCreateConfig *process.CreateConfig
	Mounts              []process.Mount
	Rootfs              string
	Namespace           string
	Publisher           events.Publisher
	OciSpec             *oci.Spec
	Bundle              string
	PdeathSignal        syscall.Signal
}

type ServerStateGetter

type ServerStateGetter interface {
	GetOpenIO(referenceId string) (IO, bool)
	GetOpenVsockConnection(port uint32) (VsockAllocatedSocket, bool)
	GetOpenUnixConnection(path string) (UnixAllocatedSocket, bool)
	GetOpenConsole(referenceId string) (ConsoleSocket, bool)
}

type ServerStateSetter

type ServerStateSetter interface {
	StoreOpenIO(referenceId string, io IO)
	StoreOpenSocket(referenceId string, socket AllocatedSocket)
	StoreOpenConsole(referenceId string, console ConsoleSocket)
}

type SocketAllocator

type SocketAllocator interface {
	AllocateSocket(ctx context.Context) (AllocatedSocket, error)
}

type UnixAllocatedSocket

type UnixAllocatedSocket interface {
	AllocatedSocket
	Path() string
}

type VsockAllocatedSocket

type VsockAllocatedSocket interface {
	AllocatedSocket
	Port() uint32
}

type VsockFdProxier

type VsockFdProxier interface {
	ProxyFd(ctx context.Context, port uint32) (*net.Conn, uintptr, error)
}

type VsockProxier

type VsockProxier interface {
	ProxyVsock(ctx context.Context, port uint32) (net.Conn, error)
	ListenAndAcceptSingleVsockConnection(ctx context.Context, port uint32, dialCallback func(ctx context.Context) error) (net.Conn, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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