imagefile

package
v0.0.0-...-fa94ed0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const FormatUnknown string = "unknown"

FormatUnknown means that qemu-img could not determine the file's format.

Variables

This section is empty.

Functions

This section is empty.

Types

type ImageInfo

type ImageInfo struct {
	Format           string
	ActualSizeBytes  int64
	VirtualSizeBytes int64
	// This checksum is calculated from the partial disk content extracted by QEMU.
	Checksum string
}

ImageInfo includes metadata returned by `qemu-img info`.

type InfoClient

type InfoClient interface {
	GetInfo(ctx context.Context, filename string) (ImageInfo, error)
}

InfoClient runs `qemu-img info` and returns the results.

func NewInfoClient

func NewInfoClient() InfoClient

NewInfoClient returns a new instance of InfoClient.

type Inspector

type Inspector interface {
	// Inspect returns Metadata for the image file associated
	// with a reference. IO operations will be retried until the context is cancelled.
	Inspect(ctx context.Context, reference string) (Metadata, error)
}

Inspector returns metadata about image files.

func NewGCSInspector

func NewGCSInspector() Inspector

NewGCSInspector returns an inspector that inspects image files that are stored in the GCS bucket. The Inspect method expects a GCS URI to the file to be inspected.

type Metadata

type Metadata struct {
	// PhysicalSizeGB is the size of the file itself, rounded up to the nearest GB.
	PhysicalSizeGB int64

	// VirtualSizeGB is the size of the disk, after inflation. Rounded up to the nearest GB.
	VirtualSizeGB int64

	// FileFormat is the format used for encoding the VM disk.
	FileFormat string

	Checksum string
}

Metadata contains metadata about an image file.

Jump to

Keyboard shortcuts

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