Help us shape the future of Go! Take the 2026 Go Developer Survey

guestexec

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

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package guestexec implements the bounded microVM guest exec data plane.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnauthenticated reports an invalid, stale, or replayed endpoint credential.
	ErrUnauthenticated = errors.New("microvm exec endpoint is not authenticated")
	// ErrTransport distinguishes a broken data-plane channel from a guest command exit.
	ErrTransport = errors.New("microvm exec transport fault")
	// ErrOutputOverflow reports that the guest command exceeded its output budget.
	ErrOutputOverflow = errors.New("microvm exec output exceeds bound")
	// ErrConcurrencyLimit reports that the environment's exec slots are occupied.
	ErrConcurrencyLimit = errors.New("microvm exec concurrency limit reached")
)

Functions

This section is empty.

Types

type CommandResult

type CommandResult = tool.CommandResult

CommandResult is the engine command result implemented by Runner.

type GuestServer

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

GuestServer executes bounded commands inside the authenticated guest connection.

func NewGuestServer

func NewGuestServer(cfg ServerConfig) (*GuestServer, error)

NewGuestServer constructs the guest exec endpoint.

func (*GuestServer) Handler

func (s *GuestServer) Handler() control.Handler

Handler returns the exec service for the shared authenticated guest multiplexer.

type Limits

type Limits struct {
	MaxFrameBytes  uint32
	MaxOutputBytes int64
	MaxConcurrent  int
	CancelGrace    time.Duration
}

Limits are immutable bounds applied independently by both protocol peers.

type OutputFrame

type OutputFrame struct {
	Channel string
	Data    []byte
}

OutputFrame is one globally ordered guest output chunk.

type Runner

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

Runner implements the engine's bound CommandRunner and optional CommandStreamer.

func NewRunner

func NewRunner(cfg RunnerConfig) (*Runner, error)

NewRunner constructs a guest-only bound runner. No error path has a local execution fallback.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, command string) (tool.CommandResult, error)

Run captures distinct bounded stdout and stderr channels.

func (*Runner) RunFrames

func (r *Runner) RunFrames(ctx context.Context, command string, receive func(OutputFrame) error) (int, error)

RunFrames delivers stdout and stderr chunks with their channel in global guest order.

func (*Runner) RunFramesWithTemporaryScope

func (r *Runner) RunFramesWithTemporaryScope(ctx context.Context, command string, scope tool.TemporaryScope, receive func(OutputFrame) error) (int, error)

RunFramesWithTemporaryScope preserves channel framing with the selected guest-owned temporary storage.

func (*Runner) RunStreaming

func (r *Runner) RunStreaming(ctx context.Context, command string, out io.Writer) (int, error)

RunStreaming writes stdout and stderr frames to out in guest delivery order.

func (*Runner) RunStreamingWithTemporaryScope

func (r *Runner) RunStreamingWithTemporaryScope(ctx context.Context, command string, scope tool.TemporaryScope, out io.Writer) (int, error)

RunStreamingWithTemporaryScope streams with the selected guest-owned temporary storage.

func (*Runner) RunWithTemporaryScope

func (r *Runner) RunWithTemporaryScope(ctx context.Context, command string, scope tool.TemporaryScope) (tool.CommandResult, error)

RunWithTemporaryScope runs with the selected guest-owned temporary storage.

type RunnerConfig

type RunnerConfig struct {
	Binding control.Binding
	Client  *control.Client
	Limits  Limits
}

RunnerConfig binds a runner to exactly one environment generation.

type RuntimeContract

type RuntimeContract struct {
	Identity    WorkloadIdentity
	Home        string
	Path        string
	Workdir     string
	Environment map[string]string
}

RuntimeContract is the explicit process environment restored when a rootfs is supplied directly and therefore carries no OCI configuration.

func DefaultRuntimeContract

func DefaultRuntimeContract() RuntimeContract

DefaultRuntimeContract returns the repository VM's fixed workload contract.

func (RuntimeContract) CacheDirectories

func (c RuntimeContract) CacheDirectories() []string

CacheDirectories returns the declared writable cache roots in stable order.

type ServerConfig

type ServerConfig struct {
	Binding          control.Binding
	Limits           Limits
	Shell            string
	WorkspaceRoot    string
	GitDirectory     string
	WorkloadIdentity WorkloadIdentity
	RuntimeContract  RuntimeContract
}

ServerConfig configures a guest endpoint. Production execution is fixed at /workspace.

type WorkloadIdentity

type WorkloadIdentity struct {
	UID uint32
	GID uint32
}

WorkloadIdentity is the dedicated guest UID/GID used for model-controlled commands.

func DefaultWorkloadIdentity

func DefaultWorkloadIdentity() WorkloadIdentity

DefaultWorkloadIdentity returns the fixed unprivileged production identity.

Jump to

Keyboard shortcuts

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