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

image

package
v1.6.1 Latest Latest
Warning

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

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

Documentation

Overview

Package image downloads the VM image of a release of aibox: the kernel and the root disk, which a release carries as one archive for each architecture. The release workflow builds the images before aibox and writes their SHA-256 into it, so aibox takes only the image it was released with.

Index

Constants

View Source
const ReleasesURL = "https://github.com/The127/aibox/releases/download"

ReleasesURL is where the files of the releases of aibox are.

Variables

View Source
var (
	// ErrChecksum is an archive that is not the one aibox was released with.
	ErrChecksum = errors.New("the image is not the one of this release")
	// ErrArchive is an archive that holds anything but the kernels and the
	// root disk.
	ErrArchive = errors.New("the archive of the image holds other files than the kernels and the root disk of its architecture")
)

Functions

func Digest

func Digest(arch string) (string, bool)

Digest is the SHA-256 of the image archive of the architecture this aibox was released with.

func KernelDigest added in v1.5.0

func KernelDigest(arch string) (string, bool)

KernelDigest is the SHA-256 of the kernel of the architecture this aibox was released with.

func NewClient

func NewClient() *http.Client

NewClient is a client for downloads that gives up on a server that does not answer, but not on a slow download.

func Prune

func Prune(parent, keep string) error

Prune removes from parent the images of the releases other than keep, and downloads a run that crashed left behind. The image of a build from a checkout, right in parent, stays.

func Released

func Released(version string) bool

Released tells whether the version is the one of a release. A build from a checkout is not: its version is (devel), a pseudo-version or marked +dirty.

func SystemDir added in v1.5.0

func SystemDir() string

SystemDir is the folder where a package of aibox puts the image, or empty.

Types

type Fetcher

type Fetcher struct {
	BaseURL  string
	Client   *http.Client
	Progress func(done, total int64)
}

Fetcher downloads images from the releases at BaseURL. Progress, if set, hears how many bytes of how many arrived so far. The total is -1 when the server does not say.

func (Fetcher) Fetch

func (f Fetcher) Fetch(ctx context.Context, version, arch, digest, dir string) error

Fetch downloads the image archive of the release for the architecture, checks it against digest and unpacks it into dir. The image appears in dir only complete and checked. Another run that fetched it meanwhile wins, and an incomplete dir is replaced.

Jump to

Keyboard shortcuts

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