package jobcontainers

import "github.com/Microsoft/hcsshim/internal/jobcontainers"

Index

Functions

func Create

func Create(ctx context.Context, id string, s *specs.Spec) (_ cow.Container, err error)

Create creates a new JobContainer from `s`.

Types

type JobContainer

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

JobContainer represents a lightweight container composed from a job object.

func (*JobContainer) Close

func (c *JobContainer) Close() error

Close closes any open handles.

func (*JobContainer) CreateProcess

func (c *JobContainer) CreateProcess(ctx context.Context, config interface{}) (_ cow.Process, err error)

CreateProcess creates a process on the host, starts it, adds it to the containers job object and then waits for exit.

func (*JobContainer) ID

func (c *JobContainer) ID() string

ID returns the ID of the container. This is the name used to create the job object.

func (*JobContainer) IsOCI

func (c *JobContainer) IsOCI() bool

IsOCI - Just to satisfy the cow.ProcessHost interface. Follow the WCOW behavior

func (*JobContainer) Modify

func (c *JobContainer) Modify(ctx context.Context, config interface{}) (err error)

func (*JobContainer) OS

func (c *JobContainer) OS() string

OS returns the operating system name as a string. This should always be windows.

func (*JobContainer) Properties

Properties returns properties relating to the job container. This is an HCS construct but to adhere to the interface for containers on Windows it is partially implemented. The only supported property is schema1.PropertyTypeProcessList.

func (*JobContainer) PropertiesV2

func (c *JobContainer) PropertiesV2(ctx context.Context, types ...hcsschema.PropertyType) (*hcsschema.Properties, error)

PropertiesV2 returns properties relating to the job container. This is an HCS construct but to adhere to the interface for containers on Windows it is partially implemented. The only supported property is schema2.PTStatistics.

func (*JobContainer) Release

func (c *JobContainer) Release(ctx context.Context) error

Release unmounts all of the container layers. Safe to call multiple times, if no storage is mounted this call will just return nil.

func (*JobContainer) Shutdown

func (c *JobContainer) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down the container.

func (*JobContainer) Start

func (c *JobContainer) Start(ctx context.Context) error

Start starts the container. There's nothing to "start" for job containers, so this just sets the start timestamp.

func (*JobContainer) Terminate

func (c *JobContainer) Terminate(ctx context.Context) error

Terminate terminates the job object (kills every process in the job).

func (*JobContainer) Wait

func (c *JobContainer) Wait() error

Wait synchronously waits for the container to shutdown or terminate. If the container has already exited returns the previous error (if any).

func (*JobContainer) WaitChannel

func (c *JobContainer) WaitChannel() <-chan struct{}

func (*JobContainer) WaitError

func (c *JobContainer) WaitError() error

type JobProcess

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

JobProcess represents a process run in a job object.

func (*JobProcess) Close

func (p *JobProcess) Close() error

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

func (*JobProcess) CloseStderr

func (p *JobProcess) CloseStderr(ctx context.Context) error

CloseStderr closes the stderr pipe of the process.

func (*JobProcess) CloseStdin

func (p *JobProcess) CloseStdin(ctx context.Context) error

CloseStdin closes the stdin pipe of the process.

func (*JobProcess) CloseStdout

func (p *JobProcess) CloseStdout(ctx context.Context) error

CloseStdout closes the stdout pipe of the process.

func (*JobProcess) ExitCode

func (p *JobProcess) ExitCode() (int, error)

ExitCode returns the exit code of the process.

func (*JobProcess) Kill

func (p *JobProcess) Kill(ctx context.Context) (bool, error)

Kill signals the process to terminate. Returns a bool signifying whether the signal was successfully delivered.

func (*JobProcess) Pid

func (p *JobProcess) Pid() int

Pid returns the processes PID

func (*JobProcess) ResizeConsole

func (p *JobProcess) ResizeConsole(ctx context.Context, width, height uint16) error

func (*JobProcess) Signal

func (p *JobProcess) Signal(ctx context.Context, options interface{}) (bool, error)

Signal sends a signal to the process and returns whether the signal was delivered.

func (*JobProcess) Start

func (p *JobProcess) Start() error

Start starts the job object process

func (*JobProcess) Stdio

func (p *JobProcess) Stdio() (io.Writer, io.Reader, io.Reader)

Stdio returns the stdio pipes of the process

func (*JobProcess) Wait

func (p *JobProcess) Wait() error

Wait waits for the process to exit. If the process has already exited returns the previous error (if any).

Source Files

env.go jobcontainer.go logon.go oci.go path.go process.go storage.go

Version
v0.8.25
Published
Dec 14, 2022
Platform
js/wasm
Imports
32 packages
Last checked
2 hours ago

Tools for package owners.