imagefetch

package
v0.14.0 Latest Latest
Warning

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

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

Documentation

Overview

Package imagefetch admits registry content before giving Docker any bytes. A Prepared capability owns bounded, verified image blobs; only its issuing Loader can import them. Docker never re-fetches content from a tenant registry. Mutable tags are re-resolved with a manifest HEAD on every preparation, and manifests the Loader already verified are reused by repository and digest.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ImportAdmission

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

ImportAdmission owns a persisted allocation and a single possible dispatch. Copies share its lifecycle. Close cancels an undispatched admission with positive evidence that Docker never received it, or waits for its exchange.

func (*ImportAdmission) CancelBeforeDispatch

func (a *ImportAdmission) CancelBeforeDispatch() (bool, error)

CancelBeforeDispatch consumes this exact admission and proves it cannot issue a daemon request. A copied capability cannot race a later dispatch past this check. False means the admission already dispatched or was consumed; an error means allocation release could not be proven. Neither permits replacement work.

func (*ImportAdmission) Close

func (a *ImportAdmission) Close() error

Close releases only an allocation that is proven never dispatched. An uncertain completed request retains its durable debit for operator recovery.

type Imported

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

Imported is the identity established by a completed exact-content import.

func (Imported) ConfigID

func (i Imported) ConfigID() string

func (Imported) ManifestID

func (i Imported) ManifestID() string

func (Imported) Platform

func (i Imported) Platform() ocispec.Platform

func (Imported) SourceReference

func (i Imported) SourceReference() string

type Importer

type Importer interface {
	ImageLoad(context.Context, io.Reader, ...client.ImageLoadOption) (image.LoadResponse, error)
}

Importer is the only daemon mutation available to a Loader.

type Loader

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

Loader owns the registry preparation and exact-content import boundary.

func NewLoader

func NewLoader(source Importer, stageRoot string, maxBytes int64, options ...Option) (*Loader, error)

NewLoader creates a bounded importer in an existing writable directory. Its caller must hold exclusive authority for that directory while this Loader is used. Copies of a Loader share the same durable debit synchronization.

func (*Loader) CleanupAbandoned

func (l *Loader) CleanupAbandoned() error

CleanupAbandoned removes only recognizable empty staging directories and zero-byte creation remnants. Call only after acquiring exclusive backend storage ownership; live preparation directories must never be scavenged. Actual content is unlinked before downloading and needs no crash scavenger.

func (*Loader) Import

func (l *Loader) Import(ctx context.Context, p *Prepared) (Imported, error)

Import is the combined reservation and dispatch convenience boundary.

func (*Loader) ImportAdmitted

func (l *Loader) ImportAdmitted(ctx context.Context, admission *ImportAdmission) (Imported, error)

ImportAdmitted dispatches only this Loader's single-use reserved capability. Original verified blobs prevent registry changes from introducing new data.

func (*Loader) PendingBytes

func (l *Loader) PendingBytes() (int64, error)

PendingBytes reports import allocations whose completion has not been established. The caller must charge these bytes before any new admission. An unreadable record is an admission refusal, never evidence of zero debt.

func (*Loader) Prepare

func (l *Loader) Prepare(ctx context.Context, ref string, platform ocispec.Platform) (*Prepared, error)

Prepare performs bounded registry I/O and decompression without extracting anything into Docker or the host filesystem.

func (*Loader) PrepareResolved

func (l *Loader) PrepareResolved(ctx context.Context, resolution Resolution) (*Prepared, error)

PrepareResolved verifies the exact selection without resolving its tag again. Staged blobs are unlinked while open, so a crash releases their disk space.

func (*Loader) ReserveImport

func (l *Loader) ReserveImport(ctx context.Context, p *Prepared) (*ImportAdmission, error)

ReserveImport durably charges allocation before a caller releases its storage admission gate. The returned owner must be closed on every subsequent path.

func (*Loader) Resolve

func (l *Loader) Resolve(ctx context.Context, ref string, platform ocispec.Platform) (Resolution, error)

Resolve verifies bounded manifest/config metadata without downloading layers.

func (*Loader) Shutdown

func (l *Loader) Shutdown(ctx context.Context) error

Shutdown closes admission and lets admitted exchanges finish within the backend's drain budget. Only expiry of that budget cancels daemon work; tenant cancellation cannot terminate an import this owner already dispatched.

func (*Loader) UnknownBytes

func (l *Loader) UnknownBytes() (int64, error)

UnknownBytes excludes live owned admissions from durable unfinished imports. A reopened loader has no such owners and therefore charges the complete debt.

func (*Loader) VerificationBudget

func (l *Loader) VerificationBudget() imagebudget.VerificationBudget

VerificationBudget is this issuer's staging and decoding ceiling. Flight admission derives its identity and reservation from this same typed value.

func (*Loader) WithBudget

func (l *Loader) WithBudget(budget imagebudget.VerificationBudget) (*Loader, error)

WithBudget derives a distinct preparation issuer for bounded recovery while retaining this owner's transport, durable debit ledger and shutdown lifetime. The caller supplies an independently verified recovery allowance, rather than changing the admission limit of the existing issuer.

type Option

type Option func(*Loader) error

Option configures registry transport while retaining the mandatory HTTPS and response-byte boundaries.

func WithRegistryTransport

func WithRegistryTransport(transport *http.Transport) Option

WithRegistryTransport projects operator trust and routing settings into an owned native transport. Fred controls HTTP protocol negotiation and replay; custom TLS dialers cannot bypass that construction boundary.

type Prepared

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

Prepared owns immutable, already verified content. Its zero value grants no import authority. Close releases all staging space, including after errors.

func (*Prepared) Budget

func (p *Prepared) Budget() imagebudget.Budget

Budget returns the separate verified content and physical allocation bounds.

func (*Prepared) Close

func (p *Prepared) Close() error

Close is idempotent and serialized against an active import.

func (*Prepared) ConfigID

func (p *Prepared) ConfigID() string

func (*Prepared) ImportBytes

func (p *Prepared) ImportBytes() int64

ImportBytes returns a conservative allowance for the daemon's archive, expanded layer data and filesystem metadata; Fred's staging is already used.

func (*Prepared) ManifestID

func (p *Prepared) ManifestID() string

ManifestID and ConfigID expose the immutable identity before dispatch, for callers that durably protect content while admission is in flight.

func (*Prepared) Metadata

func (p *Prepared) Metadata() imageexec.Metadata

func (*Prepared) Platform

func (p *Prepared) Platform() ocispec.Platform

func (*Prepared) SourceReference

func (p *Prepared) SourceReference() string

SourceReference identifies the original repository and selected manifest.

type Resolution

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

Resolution binds one immutable manifest to digest-verified configuration and an admitted platform/layer schema. Its zero value carries no authority; copies retain the same original evidence. It grants no layer/import budget.

func (Resolution) ConfigID

func (r Resolution) ConfigID() string

ConfigID identifies the exact image config selected through the verified manifest. Classic Docker can address already-extracted content by this ID even when its repository digests contain only the multi-platform index. It is selection evidence only; the local admitter still validates the image.

func (Resolution) ManifestID

func (r Resolution) ManifestID() string

func (Resolution) Platform

func (r Resolution) Platform() ocispec.Platform

func (Resolution) SourceReference

func (r Resolution) SourceReference() string

Jump to

Keyboard shortcuts

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