shim

package
v0.0.0-...-22b28a3 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2022 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadShim

func LoadShim(ctx context.Context, bundle *Bundle, onClose func()) (_ *shimTask, err error)

func SaveContainerState

func SaveContainerState(ctx sctx.Context, taskID string, status runtime.Status, pid uint32) error

Types

type Bundle

type Bundle struct {
	// ID of the bundle
	ID string
	// Path to the bundle
	Path string
	// Namespace of the bundle
	Namespace string
}

Bundle represents an OCI bundle

func NewBundle

func NewBundle(ctx context.Context, state, id string, spec typeurl.Any) (b *Bundle, err error)

NewBundle returns a new bundle on disk

func (*Bundle) Delete

func (b *Bundle) Delete() error

type ManagerConfig

type ManagerConfig struct {
	State        string
	Address      string
	TTRPCAddress string
}

type ShimManager

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

ShimManager manages currently running shim processes. It is mainly responsible for launching new shims and for proper shutdown and cleanup of existing instances. The manager is unaware of the underlying services shim provides and lets higher level services consume them, but don't care about lifecycle management.

func NewShimManager

func NewShimManager(ctx context.Context, config *ManagerConfig) (*ShimManager, error)

NewShimManager creates a manager for v2 shims

func (*ShimManager) Delete

func (m *ShimManager) Delete(ctx context.Context, id string) error

Delete a runtime task

func (*ShimManager) Get

func (m *ShimManager) Get(ctx context.Context, id string) (ShimProcess, error)

func (*ShimManager) Start

func (m *ShimManager) Start(ctx context.Context, id string, opts runtime.CreateOpts) (_ ShimProcess, retErr error)

Start launches a new shim instance

type ShimProcess

type ShimProcess interface {
	runtime.Process

	// ID of the shim.
	ID() string
	// Namespace of this shim.
	Namespace() string
	// Bundle is a file system path to shim's bundle.
	Bundle() string
	// Client returns the underlying TTRPC client for this shim.
	Client() *ttrpc.Client
}

ShimProcess represents a shim instance managed by the shim service.

type State

type State struct {
	// InitProcessPid is the init process id in the parent namespace
	InitProcessPid int `json:"pid"`
	// Status is the current status of the container
	Status runtime.Status
	// Bundle is the path on the filesystem to the bundle
	Bundle string `json:"bundle"`
	// Created is the unix timestamp for the creation time of the container in UTC
	Created time.Time `json:"created"`
}

type TaskManager

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

TaskManager wraps task service client on top of shim manager.

func NewTaskManager

func NewTaskManager(shims *ShimManager) *TaskManager

NewTaskManager creates a new task manager instance.

func (*TaskManager) Create

func (m *TaskManager) Create(ctx context.Context, taskID string, opts runtime.CreateOpts) (runtime.Task, error)

Create launches new shim instance and creates new task

func (*TaskManager) Delete

func (m *TaskManager) Delete(ctx context.Context, taskID string) (*runtime.Exit, error)

Delete deletes the task and shim instance

func (*TaskManager) Get

func (m *TaskManager) Get(ctx context.Context, id string) (runtime.Task, error)

Get a specific task

func (*TaskManager) Tasks

func (m *TaskManager) Tasks(ctx context.Context, all bool) ([]runtime.Task, error)

Tasks lists all tasks

Jump to

Keyboard shortcuts

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