firecracker

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package firecracker provides a backend that executes code in Firecracker microVMs. Provides strongest isolation; higher complexity and operational cost. Appropriate for high-risk multi-tenant execution.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrFirecrackerNotAvailable is returned when Firecracker is not available.
	ErrFirecrackerNotAvailable = errors.New("firecracker not available")

	// ErrMicroVMCreationFailed is returned when microVM creation fails.
	ErrMicroVMCreationFailed = errors.New("microvm creation failed")

	// ErrMicroVMExecutionFailed is returned when microVM execution fails.
	ErrMicroVMExecutionFailed = errors.New("microvm execution failed")
)

Errors for Firecracker backend operations.

Functions

This section is empty.

Types

type Backend

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

Backend executes code in Firecracker microVMs.

func New

func New(cfg Config) *Backend

New creates a new Firecracker backend with the given configuration.

func (*Backend) Execute

Execute runs code in a Firecracker microVM.

func (*Backend) Kind

func (b *Backend) Kind() runtime.BackendKind

Kind returns the backend kind identifier.

type Config

type Config struct {
	// BinaryPath is the path to the firecracker binary.
	// Default: firecracker (uses PATH)
	BinaryPath string

	// KernelPath is the path to the guest kernel.
	// Required for execution.
	KernelPath string

	// RootfsPath is the path to the root filesystem image.
	// Required for execution.
	RootfsPath string

	// SocketPath is the path for the Firecracker API socket.
	// Default: auto-generated per VM
	SocketPath string

	// VCPUCount is the number of virtual CPUs.
	// Default: 1
	VCPUCount int

	// MemSizeMB is the memory size in megabytes.
	// Default: 128
	MemSizeMB int

	// Logger is an optional logger for backend events.
	Logger Logger
}

Config configures a Firecracker backend.

type Logger

type Logger interface {
	Info(msg string, args ...any)
	Warn(msg string, args ...any)
	Error(msg string, args ...any)
}

Logger is the interface for logging.

Contract: - Concurrency: implementations must be safe for concurrent use. - Errors: logging must be best-effort and must not panic.

Jump to

Keyboard shortcuts

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