Documentation ¶
Index ¶
- Constants
- Variables
- func IsNotExist(err error) bool
- type Container
- func (c *Container) Close() error
- func (c *Container) CreateProcess(ctx context.Context, config interface{}) (_ cow.Process, err error)
- func (c *Container) ID() string
- func (c *Container) IsOCI() bool
- func (c *Container) Modify(ctx context.Context, config interface{}) (err error)
- func (c *Container) OS() string
- func (c *Container) Properties(ctx context.Context, types ...schema1.PropertyType) (_ *schema1.ContainerProperties, err error)
- func (c *Container) PropertiesV2(ctx context.Context, types ...hcsschema.PropertyType) (_ *hcsschema.Properties, err error)
- func (c *Container) Shutdown(ctx context.Context) (err error)
- func (c *Container) Start(ctx context.Context) (err error)
- func (c *Container) Terminate(ctx context.Context) (err error)
- func (c *Container) Wait() error
- type GuestConnection
- func (gc *GuestConnection) Capabilities() *schema1.GuestDefinedCapabilities
- func (gc *GuestConnection) CloneContainer(ctx context.Context, cid string) (_ *Container, err error)
- func (gc *GuestConnection) Close() error
- func (gc *GuestConnection) CreateContainer(ctx context.Context, cid string, config interface{}) (_ *Container, err error)
- func (gc *GuestConnection) CreateProcess(ctx context.Context, settings interface{}) (_ cow.Process, err error)
- func (gc *GuestConnection) DeleteContainerState(ctx context.Context, cid string) (err error)
- func (gc *GuestConnection) DumpStacks(ctx context.Context) (response string, err error)
- func (gc *GuestConnection) IsOCI() bool
- func (gc *GuestConnection) Modify(ctx context.Context, settings interface{}) (err error)
- func (gc *GuestConnection) OS() string
- func (gc *GuestConnection) Protocol() uint32
- func (gc *GuestConnection) UpdateContainer(ctx context.Context, cid string, resources interface{}) (err error)
- type GuestConnectionConfig
- type IoListenFunc
- type Process
- func (p *Process) Close() error
- func (p *Process) CloseStderr(ctx context.Context) (err error)
- func (p *Process) CloseStdin(ctx context.Context) (err error)
- func (p *Process) CloseStdout(ctx context.Context) (err error)
- func (p *Process) ExitCode() (_ int, err error)
- func (p *Process) Kill(ctx context.Context) (_ bool, err error)
- func (p *Process) Pid() int
- func (p *Process) ResizeConsole(ctx context.Context, width, height uint16) (err error)
- func (p *Process) Signal(ctx context.Context, options interface{}) (_ bool, err error)
- func (p *Process) Stdio() (stdin io.Writer, stdout, stderr io.Reader)
- func (p *Process) Wait() error
Constants ¶
const LinuxGcsVsockPort = 0x40000000
LinuxGcsVsockPort is the vsock port number that the Linux GCS will connect to.
Variables ¶
var WindowsGcsHvHostID = guid.GUID{ Data1: 0x894cc2d6, Data2: 0x9d79, Data3: 0x424f, Data4: [8]uint8{0x93, 0xfe, 0x42, 0x96, 0x9a, 0xe6, 0xd8, 0xd1}, }
WindowsGcsHvHostID is the hvsock address for the parent of the VM running the GCS
var WindowsGcsHvsockServiceID = guid.GUID{ Data1: 0xacef5661, Data2: 0x84a1, Data3: 0x4e44, Data4: [8]uint8{0x85, 0x6b, 0x62, 0x45, 0xe6, 0x9f, 0x46, 0x20}, }
WindowsGcsHvsockServiceID is the hvsock service ID that the Windows GCS will connect to.
Functions ¶
func IsNotExist ¶ added in v0.8.15
IsNotExist is a helper function to determine if the inner rpc error is Not Exist
Types ¶
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
Container implements the cow.Container interface for containers created via GuestConnection.
func (*Container) CreateProcess ¶
func (c *Container) CreateProcess(ctx context.Context, config interface{}) (_ cow.Process, err error)
CreateProcess creates a process in the container.
func (*Container) IsOCI ¶
IsOCI specifies whether CreateProcess should be called with an OCI specification in its input.
func (*Container) Properties ¶
func (c *Container) Properties(ctx context.Context, types ...schema1.PropertyType) (_ *schema1.ContainerProperties, err error)
Properties returns the requested container properties targeting a V1 schema container.
func (*Container) PropertiesV2 ¶
func (c *Container) PropertiesV2(ctx context.Context, types ...hcsschema.PropertyType) (_ *hcsschema.Properties, err error)
PropertiesV2 returns the requested container properties targeting a V2 schema container.
func (*Container) Shutdown ¶
Shutdown sends a graceful shutdown request to the container. The container might not be terminated by the time the request completes (and might never terminate).
type GuestConnection ¶
type GuestConnection struct {
// contains filtered or unexported fields
}
GuestConnection represents a connection to the GCS.
func (*GuestConnection) Capabilities ¶
func (gc *GuestConnection) Capabilities() *schema1.GuestDefinedCapabilities
Capabilities returns the guest's declared capabilities.
func (*GuestConnection) CloneContainer ¶ added in v0.8.15
func (gc *GuestConnection) CloneContainer(ctx context.Context, cid string) (_ *Container, err error)
CloneContainer just creates the wrappers and sets up notification requests for a container that is already running inside the UVM (after cloning).
func (*GuestConnection) Close ¶
func (gc *GuestConnection) Close() error
Close terminates the guest connection. It is undefined to call any other methods on the connection after this is called.
func (*GuestConnection) CreateContainer ¶
func (gc *GuestConnection) CreateContainer(ctx context.Context, cid string, config interface{}) (_ *Container, err error)
CreateContainer creates a container using ID `cid` and `cfg`. The request will likely not be cancellable even if `ctx` becomes done.
func (*GuestConnection) CreateProcess ¶
func (gc *GuestConnection) CreateProcess(ctx context.Context, settings interface{}) (_ cow.Process, err error)
CreateProcess creates a process in the container host.
func (*GuestConnection) DeleteContainerState ¶ added in v0.8.8
func (gc *GuestConnection) DeleteContainerState(ctx context.Context, cid string) (err error)
func (*GuestConnection) DumpStacks ¶
func (gc *GuestConnection) DumpStacks(ctx context.Context) (response string, err error)
func (*GuestConnection) IsOCI ¶
func (gc *GuestConnection) IsOCI() bool
IsOCI returns false, indicating that CreateProcess should not be called with an OCI process spec.
func (*GuestConnection) Modify ¶
func (gc *GuestConnection) Modify(ctx context.Context, settings interface{}) (err error)
Modify sends a modify settings request to the null container. This is generally used to prepare virtual hardware that has been added to the guest.
func (*GuestConnection) OS ¶
func (gc *GuestConnection) OS() string
OS returns the operating system of the container's host, "windows" or "linux".
func (*GuestConnection) Protocol ¶
func (gc *GuestConnection) Protocol() uint32
Protocol returns the protocol version that is in use.
func (*GuestConnection) UpdateContainer ¶ added in v0.8.15
func (gc *GuestConnection) UpdateContainer(ctx context.Context, cid string, resources interface{}) (err error)
type GuestConnectionConfig ¶
type GuestConnectionConfig struct { // Conn specifies the connection to use for the bridge. It will be closed // when there is an error or Close is called. Conn io.ReadWriteCloser // Log specifies the logrus entry to use for async log messages. Log *logrus.Entry // IoListen is the function to use to create listeners for the stdio connections. IoListen IoListenFunc }
GuestConnectionConfig contains options for creating a guest connection.
func (*GuestConnectionConfig) Connect ¶
func (gcc *GuestConnectionConfig) Connect(ctx context.Context, isColdStart bool) (_ *GuestConnection, err error)
Connect establishes a GCS connection. `gcc.Conn` will be closed by this function.
type IoListenFunc ¶
IoListenFunc is a type for a function that creates a listener for a VM for the vsock port `port`.
func HvsockIoListen ¶
func HvsockIoListen(vmID guid.GUID) IoListenFunc
HvsockIoListen returns an implementation of IoListenFunc that listens on the specified vsock port for the VM specified by `vmID`.
type Process ¶
type Process struct {
// contains filtered or unexported fields
}
Process represents a process in a container or container host.
func (*Process) Close ¶
Close releases resources associated with the process and closes the associated standard IO streams.
func (*Process) CloseStderr ¶ added in v0.8.17
func (*Process) CloseStdin ¶
CloseStdin causes the process to read EOF on its stdin stream.
func (*Process) CloseStdout ¶ added in v0.8.17
func (*Process) ExitCode ¶
ExitCode returns the process's exit code, or an error if the process is still running or the exit code is otherwise unknown.
func (*Process) Kill ¶
Kill sends a forceful terminate signal to the process and returns whether the signal was delivered. The process might not be terminated by the time this returns.
func (*Process) ResizeConsole ¶
ResizeConsole requests that the pty associated with the process resize its window.