hcs

package
v0.7.12 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2018 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrComputeSystemDoesNotExist is an error encountered when the container being operated on no longer exists
	ErrComputeSystemDoesNotExist = syscall.Errno(0xc037010e)

	// ErrElementNotFound is an error encountered when the object being referenced does not exist
	ErrElementNotFound = syscall.Errno(0x490)

	// ErrElementNotFound is an error encountered when the object being referenced does not exist
	ErrNotSupported = syscall.Errno(0x32)

	// ErrInvalidData is an error encountered when the request being sent to hcs is invalid/unsupported
	// decimal -2147024883 / hex 0x8007000d
	ErrInvalidData = syscall.Errno(0xd)

	// ErrHandleClose is an error encountered when the handle generating the notification being waited on has been closed
	ErrHandleClose = errors.New("hcsshim: the handle generating this notification has been closed")

	// ErrAlreadyClosed is an error encountered when using a handle that has been closed by the Close method
	ErrAlreadyClosed = errors.New("hcsshim: the handle has already been closed")

	// ErrInvalidNotificationType is an error encountered when an invalid notification type is used
	ErrInvalidNotificationType = errors.New("hcsshim: invalid notification type")

	// ErrInvalidProcessState is an error encountered when the process is not in a valid state for the requested operation
	ErrInvalidProcessState = errors.New("the process is in an invalid state for the attempted operation")

	// ErrTimeout is an error encountered when waiting on a notification times out
	ErrTimeout = errors.New("hcsshim: timeout waiting for notification")

	// ErrUnexpectedContainerExit is the error encountered when a container exits while waiting for
	// a different expected notification
	ErrUnexpectedContainerExit = errors.New("unexpected container exit")

	// ErrUnexpectedProcessAbort is the error encountered when communication with the compute service
	// is lost while waiting for a notification
	ErrUnexpectedProcessAbort = errors.New("lost communication with compute service")

	// ErrUnexpectedValue is an error encountered when hcs returns an invalid value
	ErrUnexpectedValue = errors.New("unexpected value returned from hcs")

	// ErrVmcomputeAlreadyStopped is an error encountered when a shutdown or terminate request is made on a stopped container
	ErrVmcomputeAlreadyStopped = syscall.Errno(0xc0370110)

	// ErrVmcomputeOperationPending is an error encountered when the operation is being completed asynchronously
	ErrVmcomputeOperationPending = syscall.Errno(0xC0370103)

	// ErrVmcomputeOperationInvalidState is an error encountered when the compute system is not in a valid state for the requested operation
	ErrVmcomputeOperationInvalidState = syscall.Errno(0xc0370105)

	// ErrProcNotFound is an error encountered when the the process cannot be found
	ErrProcNotFound = syscall.Errno(0x7f)

	// ErrVmcomputeOperationAccessIsDenied is an error which can be encountered when enumerating compute systems in RS1/RS2
	// builds when the underlying silo might be in the process of terminating. HCS was fixed in RS3.
	ErrVmcomputeOperationAccessIsDenied = syscall.Errno(0x5)

	// ErrVmcomputeInvalidJSON is an error encountered when the compute system does not support/understand the messages sent by management
	ErrVmcomputeInvalidJSON = syscall.Errno(0xc037010d)

	// ErrVmcomputeUnknownMessage is an error encountered guest compute system doesn't support the message
	ErrVmcomputeUnknownMessage = syscall.Errno(0xc037010b)

	// ErrNotSupported is an error encountered when hcs doesn't support the request
	ErrPlatformNotSupported = errors.New("unsupported platform request")
)

Functions

func GetComputeSystems

GetComputeSystems gets a list of the compute systems on the system that match the query

func IsAlreadyClosed

func IsAlreadyClosed(err error) bool

IsAlreadyClosed checks if an error is caused by the Container or Process having been already closed by a call to the Close() method.

func IsAlreadyStopped

func IsAlreadyStopped(err error) bool

IsAlreadyStopped returns a boolean indicating whether the error is caused by a Container or Process being already stopped. Note: Currently, ErrElementNotFound can mean that a Process has either already exited, or does not exist. Both IsAlreadyStopped and IsNotExist will currently return true when the error is ErrElementNotFound or ErrProcNotFound.

func IsNotExist

func IsNotExist(err error) bool

IsNotExist checks if an error is caused by the Container or Process not existing. Note: Currently, ErrElementNotFound can mean that a Process has either already exited, or does not exist. Both IsAlreadyStopped and IsNotExist will currently return true when the error is ErrElementNotFound or ErrProcNotFound.

func IsNotSupported

func IsNotSupported(err error) bool

IsNotSupported returns a boolean indicating whether the error is caused by unsupported platform requests Note: Currently Unsupported platform requests can be mean either ErrVmcomputeInvalidJSON, ErrInvalidData, ErrNotSupported or ErrVmcomputeUnknownMessage is thrown from the Platform

func IsPending

func IsPending(err error) bool

IsPending returns a boolean indicating whether the error is that the requested operation is being completed in the background.

func IsTimeout

func IsTimeout(err error) bool

IsTimeout returns a boolean indicating whether the error is caused by a timeout waiting for the operation to complete.

Types

type ErrorEvent

type ErrorEvent struct {
	Message    string `json:"Message,omitempty"`    // Fully formated error message
	StackTrace string `json:"StackTrace,omitempty"` // Stack trace in string form
	Provider   string `json:"Provider,omitempty"`
	EventID    uint16 `json:"EventId,omitempty"`
	Flags      uint32 `json:"Flags,omitempty"`
	Source     string `json:"Source,omitempty"`
}

func (*ErrorEvent) String

func (ev *ErrorEvent) String() string

type HcsError

type HcsError struct {
	Op     string
	Err    error
	Events []ErrorEvent
}

func (*HcsError) Error

func (e *HcsError) Error() string

type Process

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

ContainerError is an error encountered in HCS

func (*Process) Close

func (process *Process) Close() error

Close cleans up any state associated with the process but does not kill or wait on it.

func (*Process) CloseStdin

func (process *Process) CloseStdin() error

CloseStdin closes the write side of the stdin pipe so that the process is notified on the read side that there is no more data in stdin.

func (*Process) ExitCode

func (process *Process) ExitCode() (int, error)

ExitCode returns the exit code of the process. The process must have already terminated.

func (*Process) Kill

func (process *Process) Kill() error

Kill signals the process to terminate but does not wait for it to finish terminating.

func (*Process) Pid

func (process *Process) Pid() int

Pid returns the process ID of the process within the container.

func (*Process) Properties

func (process *Process) Properties() (*ProcessStatus, error)

func (*Process) ResizeConsole

func (process *Process) ResizeConsole(width, height uint16) error

ResizeConsole resizes the console of the process.

func (*Process) Signal added in v0.7.12

func (process *Process) Signal(options guestrequest.SignalProcessOptions) error

Signal signals the process with `options`.

func (*Process) Stdio

func (process *Process) Stdio() (io.WriteCloser, io.ReadCloser, io.ReadCloser, error)

Stdio returns the stdin, stdout, and stderr pipes, respectively. Closing these pipes does not close the underlying pipes; it should be possible to call this multiple times to get multiple interfaces.

func (*Process) SystemID

func (process *Process) SystemID() string

SystemID returns the ID of the process's compute system.

func (*Process) Wait

func (process *Process) Wait() error

Wait waits for the process to exit.

func (*Process) WaitTimeout

func (process *Process) WaitTimeout(timeout time.Duration) error

WaitTimeout waits for the process to exit or the duration to elapse. It returns false if timeout occurs.

type ProcessError

type ProcessError struct {
	SystemID string
	Pid      int
	Op       string
	Err      error
	Events   []ErrorEvent
}

ProcessError is an error encountered in HCS during an operation on a Process object

func (*ProcessError) Error

func (e *ProcessError) Error() string

type ProcessStatus

type ProcessStatus struct {
	ProcessID      uint32
	Exited         bool
	ExitCode       uint32
	LastWaitResult int32
}

type System

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

func CreateComputeSystem

func CreateComputeSystem(id string, hcsDocumentInterface interface{}) (*System, error)

CreateComputeSystem creates a new compute system with the given configuration but does not start it.

func OpenComputeSystem

func OpenComputeSystem(id string) (*System, error)

OpenComputeSystem opens an existing compute system by ID.

func (*System) Close

func (computeSystem *System) Close() error

Close cleans up any state associated with the compute system but does not terminate or wait for it.

func (*System) CreateProcess

func (computeSystem *System) CreateProcess(c interface{}) (*Process, error)

CreateProcess launches a new process within the computeSystem.

func (*System) ID

func (computeSystem *System) ID() string

ID returns the compute system's identifier.

func (*System) Modify

func (computeSystem *System) Modify(config interface{}) error

Modifies the System by sending a request to HCS

func (*System) OpenProcess

func (computeSystem *System) OpenProcess(pid int) (*Process, error)

OpenProcess gets an interface to an existing process within the computeSystem.

func (*System) Pause

func (computeSystem *System) Pause() error

Pause pauses the execution of the computeSystem. This feature is not enabled in TP5.

func (*System) Properties

func (computeSystem *System) Properties(types ...schema1.PropertyType) (*schema1.ContainerProperties, error)

func (*System) Resume

func (computeSystem *System) Resume() error

Resume resumes the execution of the computeSystem. This feature is not enabled in TP5.

func (*System) Shutdown

func (computeSystem *System) Shutdown() error

Shutdown requests a compute system shutdown, if IsPending() on the error returned is true, it may not actually be shut down until Wait() succeeds.

func (*System) Start

func (computeSystem *System) Start() error

Start synchronously starts the computeSystem.

func (*System) Terminate

func (computeSystem *System) Terminate() error

Terminate requests a compute system terminate, if IsPending() on the error returned is true, it may not actually be shut down until Wait() succeeds.

func (*System) Wait

func (computeSystem *System) Wait() error

Wait synchronously waits for the compute system to shutdown or terminate.

func (*System) WaitTimeout

func (computeSystem *System) WaitTimeout(timeout time.Duration) error

WaitTimeout synchronously waits for the compute system to terminate or the duration to elapse. If the timeout expires, IsTimeout(err) == true

type SystemError

type SystemError struct {
	ID     string
	Op     string
	Err    error
	Extra  string
	Events []ErrorEvent
}

SystemError is an error encountered in HCS during an operation on a Container object

func (*SystemError) Error

func (e *SystemError) Error() string

Jump to

Keyboard shortcuts

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