shim

package
v0.1.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: MPL-2.0 Imports: 21 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// SubCommand is the first argument to the clone of the nomad agent process
	// for invoking the exec2 driver sandbox shim.
	SubCommand = "exec2-shim"

	// ExitWrongArgs indicates the shim has terminated early due to recieving
	// the wrong expected arguments. We use a special return code here since logs
	// will not have been configured yet.
	ExitWrongArgs = 40

	// ExitBadLogging indicates the shim has terminated early due to being unable
	// to open stdout or stderr output files (fifos).
	ExitBadLogging = 41
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Environment

type Environment struct {
	User         string            // user the command will run as (may be empty / synthetic)
	OutPipe      string            // io pipe path for stdout
	ErrPipe      string            // io pipe path for stderr
	Env          map[string]string // environment variables
	TaskDir      string            // task directory
	Cgroup       string            // task cgroup path
	Net          string            // allocation network namespace path
	Memory       uint64            // memory in megabytes
	MemoryMax    uint64            // memory_max in megabytes
	CPUBandwidth uint64            // cpu / cores bandwidth
}

Environment represents runtime configuration.

type ExecTwo

type ExecTwo interface {
	// Start the Task process.
	Start(context.Context) error

	// PID returns the process ID associated with exec.
	//
	// Must only be called after Start.
	PID() int

	// Wait on the process (until exit).
	//
	// Must only be called after Start.
	WaitCh() process.WaitCh

	// Stats returns current resource utilization.
	//
	// Must only be called after Start.
	Stats() *resources.Utilization

	// Signal [kill()] the process.
	//
	// Must be called after Start.
	Signal(string) error

	// Stop the process.
	//
	// Must be called after Start.
	Stop(string, time.Duration) error
}

func New

func New(env *Environment, opts *Options) ExecTwo

New an ExecTwo, an instantiation of the exec2 driver.

func Recover

func Recover(pid int, env *Environment) ExecTwo

Recover an ExecTwo, an already running instance of the execc2 driver.

type Options

type Options struct {
	Command        string
	Arguments      []string
	UnveilPaths    []string
	UnveilDefaults bool
}

Options represent Task configuration options.

Jump to

Keyboard shortcuts

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