package v2

import "github.com/containerd/containerd/runtime/v2"

Index

Functions

func NewTaskClient

func NewTaskClient(client interface{}) (v2.TaskService, error)

NewTaskClient returns a new task client interface which handles both GRPC and TTRPC servers depending on the client object type passed in.

Supported client types are: - *ttrpc.Client - grpc.ClientConnInterface

In 1.7 we support TaskService v2 (for backward compatibility with existing shims) and GRPC TaskService v3. In 2.0 we'll switch to TaskService v3 only for both TTRPC and GRPC, which will remove overhead of mapping v2 structs to v3 structs.

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 LoadBundle

func LoadBundle(ctx context.Context, root, id string) (*Bundle, error)

LoadBundle loads an existing bundle from disk

func NewBundle

func NewBundle(ctx context.Context, root, 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

Delete a bundle atomically

type Config

type Config struct {
	// Supported platforms
	Platforms []string `toml:"platforms"`
	// SchedCore enabled linux core scheduling
	SchedCore bool `toml:"sched_core"`
}

Config for the v2 runtime

type ManagerConfig

type ManagerConfig struct {
	Root         string
	State        string
	Store        containers.Store
	Events       *exchange.Exchange
	Address      string
	TTRPCAddress string
	SchedCore    bool
	SandboxStore sandbox.Store
}

type ShimInstance

type ShimInstance interface {
	io.Closer

	// 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 or GRPC client object for this shim.
	// The underlying object can be either *ttrpc.Client or grpc.ClientConnInterface.
	Client() any
	// Delete will close the client and remove bundle from disk.
	Delete(ctx context.Context) error
}

ShimInstance represents running shim process managed by ShimManager.

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) (ShimInstance, error)

func (*ShimManager) ID

func (m *ShimManager) ID() string

ID of the shim manager

func (*ShimManager) Start

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

Start launches a new shim instance

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) ID

func (m *TaskManager) ID() string

ID of the task manager

func (*TaskManager) Tasks

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

Tasks lists all tasks

Source Files

binary.go bridge.go bundle.go bundle_linux.go manager.go manager_unix.go process.go shim.go shim_load.go shim_unix.go

Directories

PathSynopsis
runtime/v2/example
runtime/v2/example/cmd
runtime/v2/logging
runtime/v2/runc
runtime/v2/runc/manager
runtime/v2/runc/options
runtime/v2/runc/pause
runtime/v2/runc/task
runtime/v2/runc/task/plugin
runtime/v2/runc/v1
runtime/v2/runc/v2
runtime/v2/shim
Version
v1.7.0-rc.2
Published
Mar 7, 2023
Platform
linux/amd64
Imports
50 packages
Last checked
3 minutes ago

Tools for package owners.