image

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2016 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Overview

Package image implements finding images in the store and fetching them from local or remote locations. The only API exposed are Finder and Fetcher - all their fields are also exposed (see action in common.go).

Hacking docs:

Documentation of a specific component is in its related file. Below is a short top-down documentation about relations between various types in this package.

Finder uses Fetcher to get the image from remote if it could not find one in the store.

Fetcher delegates its work to a specific fetcher. Specific fetchers currently available are fileFetcher, dockerFetcher, nameFetcher and httpFetcher.

fileFetcher gets the images from a local filesystem. Fetcher uses it when the image reference is either a path (relative or absolute) or a file:// URL. In the latter case fileFetcher receives only the Path part of the URL. fileFetcher also uses validator to verify the image.

dockerFetcher gets the images from docker registries. Fetcher uses it when the image reference is a docker:// URL.

httpFetcher gets the images from http:// or https:// URLs. It uses httpOps for doing all the downloading, and validator to verify the image.

nameFetcher gets the images via a discovery process. Fetcher uses it when the image reference is an image name. nameFetcher does the discovery and then uses httpOps for doing all the downloading, and validator to verify the image.

validator checks various things in the downloaded image. It can check whether the downloaded file is a valid image, so it can get an image manifest from it. It also can check if the image has an expected name or a if a signature of the image can be trusted.

httpOps does the downloading of the images and signatures. It also provides a fetcher for remoteAscFetcher to download the signature. For the downloading process itself it uses downloader and resumableSession.

asc is used to get the signature either from a local filesystem or from some remote location. It also provides an ascFetcher interface and two implementations - localAscFetcher and remoteAscFetcher. The former is standalone, the latter needs a function that does the heavy-lifting (actually the downloading, currently provided by httpOps).

resumableSession is an implementation of a downloadSession interface, so it is used together with downloader.

downloader also provides a downloadSession interface and uses its implementation to, uh, download stuff. It also provides a dead-simple implementation of downloadSession - defaultDownloadSession.

There are also various functions and types in common.go and io.go, which are used by the types listed above and their functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fetcher

type Fetcher action

Fetcher will try to fetch images into the store.

func (*Fetcher) FetchImage

func (f *Fetcher) FetchImage(img string, ascPath string, imgType apps.AppImageType) (string, error)

FetchImage will take an image as either a path, a URL or a name string and import it into the store if found. If ascPath is not "", it must exist as a local file and will be used as the signature file for verification, unless verification is disabled. If f.WithDeps is true also image dependencies are fetched.

type Finder

type Finder action

Finder will try to get images from the store. If not found, it will try to fetch them.

func (*Finder) FindImage

func (f *Finder) FindImage(img string, asc string, imgType apps.AppImageType) (*types.Hash, error)

FindImage tries to get a hash of a passed image, ideally from store. Otherwise this might involve fetching it from remote with the Fetcher.

func (*Finder) FindImages

func (f *Finder) FindImages(al *apps.Apps) error

FindImages uses FindImage to attain a list of image hashes

Jump to

Keyboard shortcuts

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