image

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrParseReference = errors.New("parse image reference")
	ErrPullImage      = errors.New("pull image")
	ErrImageDigest    = errors.New("get image digest")
	ErrCreateDir      = errors.New("create directory")
	ErrCreateTemp     = errors.New("create temp")
	ErrExtract        = errors.New("extract image")
	ErrCreateExt4     = errors.New("create ext4")
	ErrToolNotFound   = errors.New("tool not found")
	ErrTarball        = errors.New("tarball")
	ErrStoreSave      = errors.New("save to store")
	ErrStoreRead      = errors.New("read from store")
	ErrMetadata       = errors.New("metadata")
	ErrImageNotFound  = errors.New("image not found")
	ErrLayerFS        = errors.New("invalid layer filesystem type")
)

Functions

func GC added in v0.1.23

func GC(cacheDir string) (int, error)

func RemoveRegistryCache added in v0.1.9

func RemoveRegistryCache(tag string, cacheDir string) error

RemoveRegistryCache removes a registry-cached image by tag.

func SaveRegistryCache added in v0.1.19

func SaveRegistryCache(tag string, cacheDir string, layers []LayerRef, meta ImageMeta) error

SaveRegistryCache records metadata for a registry-cached image.

Types

type BuildOptions

type BuildOptions struct {
	CacheDir  string
	ForcePull bool
}

type BuildResult

type BuildResult struct {
	// RootfsPath is retained as a convenience alias to the first lower layer path.
	RootfsPath string
	// LowerPaths are ordered from OCI base layer -> top layer.
	LowerPaths   []string
	LowerFSTypes []string
	Layers       []LayerRef
	// CanonicalLayers are the per-OCI-layer blobs used for dedupe and GC.
	CanonicalLayers []LayerRef

	Digest       string
	LayerDigests []string
	Size         int64
	Cached       bool
	OCI          *OCIConfig
}

func GetRegistryCache added in v0.1.19

func GetRegistryCache(tag string, cacheDir string) (*BuildResult, error)

GetRegistryCache returns a registry-cached image metadata entry as a BuildResult.

type Builder

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

func NewBuilder

func NewBuilder(opts *BuildOptions) *Builder

func (*Builder) Build

func (b *Builder) Build(ctx context.Context, imageRef string) (*BuildResult, error)

func (*Builder) Import added in v0.1.4

func (b *Builder) Import(ctx context.Context, reader io.Reader, tag string) (*BuildResult, error)

func (*Builder) SaveTag added in v0.1.4

func (b *Builder) SaveTag(tag string, result *BuildResult) error

func (*Builder) Store added in v0.1.4

func (b *Builder) Store() *Store

type ImageInfo added in v0.1.4

type ImageInfo struct {
	Tag        string
	RootfsPath string
	Meta       ImageMeta
}

func ListRegistryCache added in v0.1.4

func ListRegistryCache(cacheDir string) ([]ImageInfo, error)

ListRegistryCache lists images cached from registry pulls (non-local store).

type ImageMeta added in v0.1.4

type ImageMeta struct {
	Tag       string     `json:"tag"`
	Digest    string     `json:"digest,omitempty"`
	Size      int64      `json:"size"`
	CreatedAt time.Time  `json:"created_at"`
	Source    string     `json:"source,omitempty"`
	OCI       *OCIConfig `json:"oci,omitempty"`
	// RuntimeRootfsPath optionally pins the preferred runtime lower blob (hot squash cache).
	RuntimeRootfsPath string `json:"-"`
}

type LayerRef added in v0.1.23

type LayerRef struct {
	Digest string
	FSType string
	Size   int64
	Path   string
}

type OCIConfig added in v0.1.10

type OCIConfig struct {
	User       string            `json:"user,omitempty"`
	WorkingDir string            `json:"working_dir,omitempty"`
	Entrypoint []string          `json:"entrypoint,omitempty"`
	Cmd        []string          `json:"cmd,omitempty"`
	Env        map[string]string `json:"env,omitempty"`
}

type Store added in v0.1.4

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

func NewStore added in v0.1.4

func NewStore(baseDir string) *Store

func (*Store) BlobPath added in v0.1.23

func (s *Store) BlobPath(digest string) string

func (*Store) BlobPathWithFS added in v0.1.23

func (s *Store) BlobPathWithFS(digest, fsType string) string

func (*Store) CacheRoot added in v0.1.23

func (s *Store) CacheRoot() string

func (*Store) GC added in v0.1.23

func (s *Store) GC() (int, error)

func (*Store) Get added in v0.1.4

func (s *Store) Get(tag string) (*BuildResult, error)

func (*Store) List added in v0.1.4

func (s *Store) List() ([]ImageInfo, error)

func (*Store) Remove added in v0.1.4

func (s *Store) Remove(tag string) error

func (*Store) Save added in v0.1.4

func (s *Store) Save(tag string, layers []LayerRef, meta ImageMeta) error

Jump to

Keyboard shortcuts

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