package shim

import "github.com/containerd/containerd/runtime/v1/shim"

Index

Variables

var Default = &Monitor{
	subscribers: make(map[chan runc.Exit]struct{}),
}

Default is the default monitor initialized for the package

var ErrNoSuchProcess = errors.New("no such process")

ErrNoSuchProcess is returned when the process no longer exists

Functions

func NewLocal

func NewLocal(s *Service) shimapi.ShimService

NewLocal returns a shim client implementation for issue commands to a shim

func Reap

func Reap() error

Reap should be called when the process receives an SIGCHLD. Reap will reap all exited processes and close their wait channels

Types

type Config

type Config struct {
	Path          string
	Namespace     string
	WorkDir       string
	Criu          string
	RuntimeRoot   string
	SystemdCgroup bool
}

Config contains shim specific configuration

type Monitor

type Monitor struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Monitor monitors the underlying system for process status changes

func (*Monitor) Start

func (m *Monitor) Start(c *exec.Cmd) (chan runc.Exit, error)

Start starts the command a registers the process with the reaper

func (*Monitor) Subscribe

func (m *Monitor) Subscribe() chan runc.Exit

Subscribe to process exit changes

func (*Monitor) Unsubscribe

func (m *Monitor) Unsubscribe(c chan runc.Exit)

Unsubscribe to process exit changes

func (*Monitor) Wait

func (m *Monitor) Wait(c *exec.Cmd, ec chan runc.Exit) (int, error)

Wait blocks until a process is signal as dead. User should rely on the value of the exit status to determine if the command was successful or not.

type Service

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

Service is the shim implementation of a remote shim over GRPC

func NewService

func NewService(config Config, publisher events.Publisher) (*Service, error)

NewService returns a new shim service that can be used via GRPC

func (*Service) Checkpoint

Checkpoint the container

func (*Service) CloseIO

func (s *Service) CloseIO(ctx context.Context, r *shimapi.CloseIORequest) (*ptypes.Empty, error)

CloseIO of a process

func (*Service) Create

Create a new initial process and container with the underlying OCI runtime

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, r *ptypes.Empty) (*shimapi.DeleteResponse, error)

Delete the initial process and container

func (*Service) DeleteProcess

DeleteProcess deletes an exec'd process

func (*Service) Exec

Exec an additional process inside the container

func (*Service) Kill

func (s *Service) Kill(ctx context.Context, r *shimapi.KillRequest) (*ptypes.Empty, error)

Kill a process with the provided signal

func (*Service) ListPids

ListPids returns all pids inside the container

func (*Service) Pause

func (s *Service) Pause(ctx context.Context, r *ptypes.Empty) (*ptypes.Empty, error)

Pause the container

func (*Service) ResizePty

func (s *Service) ResizePty(ctx context.Context, r *shimapi.ResizePtyRequest) (*ptypes.Empty, error)

ResizePty of a process

func (*Service) Resume

func (s *Service) Resume(ctx context.Context, r *ptypes.Empty) (*ptypes.Empty, error)

Resume the container

func (*Service) ShimInfo

func (s *Service) ShimInfo(ctx context.Context, r *ptypes.Empty) (*shimapi.ShimInfoResponse, error)

ShimInfo returns shim information such as the shim's pid

func (*Service) Start

Start a process

func (*Service) State

State returns runtime state information for a process

func (*Service) Update

Update a running container

func (*Service) Wait

Wait for a process to exit

Source Files

local.go reaper.go service.go service_unix.go

Directories

PathSynopsis
runtime/v1/shim/client
runtime/v1/shim/v1
Version
v1.3.0-beta.0
Published
Jul 31, 2019
Platform
js/wasm
Imports
34 packages
Last checked
1 minute ago

Tools for package owners.