firecracker

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLinuxOnly = errors.New("firecracker: real engine requires Linux with KVM")

ErrLinuxOnly is returned when the real Firecracker engine is constructed on a host without Linux/KVM support.

Functions

This section is empty.

Types

type Config

type Config struct {
	Engine vmexec.EngineConfig

	VCPUCount int64
	MemoryMiB int64

	StateDir          string
	ImageManifestPath string

	KernelImagePath   string
	KernelImageSHA256 string
	RootfsImagePath   string
	RootfsImageSHA256 string
	RootfsSizeBytes   int64

	ImageID              string
	AgentProtocolVersion int
	GuestVSockPort       uint32
	KernelArgs           string

	FirecrackerBinary string
	JailerBinary      string
	JailerUID         int
	JailerGID         int

	// AllowFullCopy permits a byte-for-byte rootfs copy when FICLONE is not
	// supported. When false, lack of reflink support fails the job pre-boot.
	AllowFullCopy bool
}

Config defines all resources and host paths needed by the Firecracker engine. Required fields intentionally have no production defaults.

func NewConfig

func NewConfig() Config

NewConfig applies only the contractually specified billing default. Callers must explicitly populate every resource, image, timeout, and host field.

func (Config) Validate

func (c Config) Validate() error

Validate rejects incomplete or unsafe startup configuration.

type Engine

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

Engine runs one fresh Firecracker microVM per job.

func New

func New(config Config) (*Engine, error)

New validates the complete configuration, establishes the Linux host boundary, and reaps stale resources before accepting jobs.

func (*Engine) Run

func (e *Engine) Run(ctx context.Context, spec vmexec.RunSpec, sink vmexec.OutputSink) (result vmexec.RunResult, returnErr error)

Run implements vmexec.Engine. Completion is never returned until the VMM has exited and all per-job resources have been removed.

Jump to

Keyboard shortcuts

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