imagepull

package
v1.34.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package imagepull discloses the container images a command is about to download, estimates their size from the registry without pulling, and enforces the offline mode that lets a user on a metered connection skip every pull and rebuild that is not strictly required.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DryRun

func DryRun() bool

DryRun reports whether the command should report what it would download and stop before downloading it.

func Human

func Human(n int64) string

Human renders a byte count the way a download is normally quoted.

func Note

func Note(bytes int64) string

Note renders a size for appending to a one-line pull announcement. Empty when the registry did not answer, so the line reads normally without it.

func Offline

func Offline() bool

Offline reports whether lerd should skip pulls and rebuilds unless the image is missing outright.

func SetDryRun

func SetDryRun(v bool)

SetDryRun records the --dry-run flag.

func SetOffline

func SetOffline(v bool)

SetOffline records the --no-pull flag. LERD_OFFLINE sets the same mode for callers that never parse flags (the daemon, the watcher, the MCP server).

func Size

func Size(ref string) (int64, bool)

Size returns the compressed download size of ref in bytes, read from the registry manifest without pulling anything. ok is false for a locally built image and whenever the registry cannot be reached or understood, in which case callers disclose the pull without a number rather than failing.

Types

type Item

type Item struct {
	Name   string // what the user recognises; falls back to Ref when empty
	Ref    string // registry reference to size up; empty for a pure local build
	Reason string // why this download is happening
	Build  bool   // a local build, which downloads its base image
	Bytes  int64  // estimated download size, 0 when unknown
}

Item is one image a command is about to download or build.

func Build

func Build(name, baseRef, reason string) Item

Build describes a local image build. baseRef is the image the build downloads before it can run, and may be empty when nothing is fetched.

func Pull

func Pull(ref, reason string) Item

Pull describes an image lerd is about to fetch from a registry.

type Plan

type Plan []Item

Plan is everything a single command will download, disclosed in one block before the first byte moves.

func (Plan) Fill

func (p Plan) Fill() Plan

Fill looks up the download size of every item, concurrently. Items whose size cannot be read keep a zero and are disclosed without a number.

func (Plan) Report

func (p Plan) Report(w io.Writer)

Report writes the disclosure block: what will be downloaded, how big it is and why. Nothing is written for an empty plan.

func (Plan) Total

func (p Plan) Total() int64

Total is the sum of the known sizes in the plan.

Jump to

Keyboard shortcuts

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