hcsoci

package
v0.8.7 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2019 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetNamespaceEndpoints added in v0.8.7

func GetNamespaceEndpoints(ctx context.Context, netNS string) ([]*hns.HNSEndpoint, error)

GetNamespaceEndpoints gets all endpoints in `netNS`

func ReleaseResources

func ReleaseResources(ctx context.Context, r *Resources, vm *uvm.UtilityVM, all bool) error

TODO: Method on the resources?

Types

type Cmd added in v0.8.7

type Cmd struct {
	// Host is the process host in which to launch the process.
	Host cow.ProcessHost

	// The OCI spec for the process.
	Spec *specs.Process

	// Standard IO streams to relay to/from the process.
	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer

	// Log provides a logrus entry to use in logging IO copying status.
	Log *logrus.Entry

	// Context provides a context that terminates the process when it is done.
	Context context.Context

	// CopyAfterExitTimeout is the amount of time after process exit we allow the
	// stdout, stderr relays to continue before forcibly closing them if not
	// already completed. This is primarily a safety step against the HCS when
	// it fails to send a close on the stdout, stderr pipes when the process
	// exits and blocks the relay wait groups forever.
	CopyAfterExitTimeout time.Duration

	// Process is filled out after Start() returns.
	Process cow.Process

	// ExitState is filled out after Wait() (or Run() or Output()) completes.
	ExitState *ExitState
	// contains filtered or unexported fields
}

Cmd represents a command being prepared or run in a process host.

func Command added in v0.8.7

func Command(host cow.ProcessHost, name string, arg ...string) *Cmd

Command makes a Cmd for a given command and arguments.

func CommandContext added in v0.8.7

func CommandContext(ctx context.Context, host cow.ProcessHost, name string, arg ...string) *Cmd

CommandContext makes a Cmd for a given command and arguments. After it is launched, the process is killed when the context becomes done.

func (*Cmd) Output added in v0.8.7

func (c *Cmd) Output() ([]byte, error)

Output runs a command via Run and collects its stdout into a buffer, which it returns.

func (*Cmd) Run added in v0.8.7

func (c *Cmd) Run() error

Run is equivalent to Start followed by Wait.

func (*Cmd) Start added in v0.8.7

func (c *Cmd) Start() error

Start starts a command. The caller must ensure that if Start succeeds, Wait is eventually called to clean up resources.

func (*Cmd) Wait added in v0.8.7

func (c *Cmd) Wait() error

Wait waits for a command and its IO to complete and closes the underlying process. It can only be called once. It returns an ExitError if the command runs and returns a non-zero exit code.

type ExitError added in v0.8.7

type ExitError struct {
	*ExitState
}

ExitError is used when a process exits with a non-zero exit code.

func (*ExitError) Error added in v0.8.7

func (err *ExitError) Error() string

type ExitState added in v0.8.7

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

ExitState contains whether a process has exited and with which exit code.

func (*ExitState) ExitCode added in v0.8.7

func (s *ExitState) ExitCode() int

ExitCode returns the exit code of the process, or -1 if the exit code is not known.

type Resources

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

Resources is the structure returned as part of creating a container. It holds nothing useful to clients, hence everything is lowercased. A client would use it in a call to ReleaseResource to ensure everything is cleaned up when a container exits.

func (*Resources) NetNS

func (r *Resources) NetNS() string

NetNS returns the network namespace for the container

Jump to

Keyboard shortcuts

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