vm

package
v0.0.0-...-fc3566a Latest Latest
Warning

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

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

Documentation

Overview

Package vm defines the interface for vm managers and instances

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Instance

type Instance interface {
	SetCPUAndMemory(ctx context.Context, cpu uint8, ram uint32) error
	AddFS(ctx context.Context, tag, mountPath string, opts ...MountOpt) error
	AddDisk(ctx context.Context, blockID, mountPath string, opts ...MountOpt) error
	AddNIC(ctx context.Context, endpoint string, mac net.HardwareAddr, mode NetworkMode, features, flags uint32) error
	Start(ctx context.Context, opts ...StartOpt) error
	Client() *ttrpc.Client
	Shutdown(context.Context) error

	// StartStream makes a connection to the VM for streaming, returning a 32-bit
	// identifier for the stream that can be used to reference the stream inside
	// the vm.
	//
	// TODO: Consider making this interface optional, a per RPC implementation
	// is possible but likely less efficient.
	StartStream(ctx context.Context) (uint32, net.Conn, error)
}

type Manager

type Manager interface {
	NewInstance(ctx context.Context, state string) (Instance, error)
}

type MountConfig

type MountConfig struct {
	Readonly bool
	Vmdk     bool
}

type MountOpt

type MountOpt func(*MountConfig)

func WithReadOnly

func WithReadOnly() MountOpt

func WithVmdk

func WithVmdk() MountOpt

type NetworkMode

type NetworkMode int
const (
	NetworkModeUnixgram NetworkMode = iota
	NetworkModeUnixstream
)

type StartOpt

type StartOpt func(*StartOpts)

func WithInitArgs

func WithInitArgs(args ...string) StartOpt

type StartOpts

type StartOpts struct {
	InitArgs []string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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