sandbox

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package sandbox defines the interface for managing sandbox instances

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Disk

type Disk struct {
	BlockID   string
	MountPath string
	Flags     DiskFlags
}

type DiskFlags

type DiskFlags uint8
const (
	DiskFlagReadonly DiskFlags = 1 << iota
	DiskFlagVMDK     DiskFlags = 1 << iota
)

type Filesystem

type Filesystem struct {
	Tag       string
	MountPath string
	Readonly  bool
}

type NIC

type NIC struct {
	Endpoint string
	MAC      net.HardwareAddr
	Mode     int
	Features uint32
	Flags    uint32
}

type Opt

type Opt func(*Options)

func WithDisk

func WithDisk(blockID, mountPath string, flags DiskFlags) Opt

func WithFS

func WithFS(tag, mountPath string, readonly bool) Opt

func WithInitArgs

func WithInitArgs(args ...string) Opt

func WithNIC

func WithNIC(endpoint string, mac net.HardwareAddr, mode int, features, flags uint32) Opt

func WithResources

func WithResources(cpu uint8, memory uint32) Opt

func WithStateDir

func WithStateDir(dir string) Opt

type Options

type Options struct {
	Filesystems []Filesystem
	Disks       []Disk
	NICs        []NIC
	StateDir    string
	InitArgs    []string
	CPU         uint8
	Memory      uint32 // in MiB
}

type Sandbox

type Sandbox interface {
	Start(context.Context, ...Opt) error
	Stop(context.Context) error
	Client() (*ttrpc.Client, error)
	StartStream(context.Context, string) (net.Conn, error)
}

Sandbox defines the interface for creating and managing the sandbox Only a single instance is allowed, calling Start with a sandbox already created or calling Client or Stop without a created sandbox will return a precondition error.

Directories

Path Synopsis
Package vm provides a vm backed sandbox implementation
Package vm provides a vm backed sandbox implementation

Jump to

Keyboard shortcuts

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