Documentation
¶
Index ¶
- func ExecInUvm(ctx context.Context, vm *uvm.UtilityVM, req *shimdiag.ExecProcessRequest) (int, error)
- func GetNamespaceEndpoints(ctx context.Context, netNS string) ([]*hns.HNSEndpoint, error)
- func ReleaseResources(ctx context.Context, r *Resources, vm *uvm.UtilityVM, all bool) error
- type AutoManagedVHD
- type Cmd
- type ExitError
- type ExitState
- type ResourceCloser
- type Resources
- type UpstreamIO
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetNamespaceEndpoints ¶ added in v0.8.7
GetNamespaceEndpoints gets all endpoints in `netNS`
func ReleaseResources ¶
ReleaseResources releases/frees all of the resources associated with a container. This includes Plan9 shares, vsmb mounts, pipe mounts, network endpoints, scsi mounts, vpci devices and layers. TODO: make method on Resources struct.
Types ¶
type AutoManagedVHD ¶ added in v0.8.8
type AutoManagedVHD struct {
// contains filtered or unexported fields
}
AutoManagedVHD struct representing a VHD that will be cleaned up automatically.
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
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
Output runs a command via Run and collects its stdout into a buffer, which it returns.
type ExitError ¶ added in v0.8.7
type ExitError struct {
*ExitState
}
ExitError is used when a process exits with a non-zero exit code.
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.
type ResourceCloser ¶ added in v0.8.8
ResourceCloser is a generic interface for the releasing of a resource. If a resource implements this interface(which they all should), freeing of that resource should entail one call to <resourceName>.Release(ctx)
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 ReleaseResources to ensure everything is cleaned up when a container exits.
type UpstreamIO ¶ added in v0.8.9
type UpstreamIO interface {
// Close closes all open io.
//
// This call is idempotent and safe to call multiple times.
Close(ctx context.Context)
// CloseStdin closes just `Stdin()` if open.
//
// This call is idempotent and safe to call multiple times.
CloseStdin(ctx context.Context)
// Stdin returns the open `stdin` reader. If `stdin` was never opened this
// will return `nil`.
Stdin() io.Reader
// StdinPath returns the original path used to open the `Stdin()` reader.
StdinPath() string
// Stdout returns the open `stdout` writer. If `stdout` was never opened
// this will return `nil`.
Stdout() io.Writer
// StdoutPath returns the original path used to open the `Stdout()` writer.
StdoutPath() string
// Stderr returns the open `stderr` writer. If `stderr` was never opened
// this will return `nil`.
Stderr() io.Writer
// StderrPath returns the original path used to open the `Stderr()` writer.
StderrPath() string
// Terminal returns `true` if the connection is emulating a terminal. If
// `true` `Stderr()` will always return `nil` and `StderrPath()` will always
// return `""`.
Terminal() bool
}
UpstreamIO is an interface describing the IO to connect to above the shim. Depending on the callers settings there may be no opened IO.
func NewNpipeIO ¶ added in v0.8.9
func NewNpipeIO(ctx context.Context, stdin, stdout, stderr string, terminal bool) (_ UpstreamIO, err error)
NewNpipeIO creates connected upstream io. It is the callers responsibility to validate that `if terminal == true`, `stderr == ""`.