cache

package
v0.0.0-...-674084c Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package cache has code for downloading and caching container images, in such a way that each can be used as overlay filesystems.

Container images come as a set of layers as gzipped tarballs, and a manifest, which lists the layers by name. The name of a layer is its (SHA256) digest.

Since layers are content-addressed and can be shared between images, the layers from all images are lumped together into a directory.

Manifests are stored in a file named for its digest; tags are symlinked to the "real" file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache is a base directory for an image cache

func New

func New(userCacheDir string) *Cache

New constructs an instance of Cache given a cache directory. Usually the cache directory would be obtained with `os.UserCacheDir()`.

func (*Cache) Download

func (c *Cache) Download(ref name.Reference) error

Download makes sure the manifest and layers for a particular image are present in the cache.

func (*Cache) EnsureImage

func (cache *Cache) EnsureImage(image string) (vfs.FileSystem, error)

EnsureImage constructs a filesystem for a given image, downloading it if necessary.

func (*Cache) FileSystemForImage

func (cache *Cache) FileSystemForImage(image name.Reference) (vfs.FileSystem, error)

FileSystemForImage takes an image name and ref (tag), and constructs a vfs.FileSystem from the image's layers as found in the cache. It assumes the manifest and layers will be present in the cache.

Jump to

Keyboard shortcuts

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