github.com/coreos/rocket@v1.30.1-0.20200224141603-171c416fac02/rkt/image/doc.go (about)

     1  // Copyright 2015 The rkt Authors
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  // Package image implements finding images in the store and fetching
    16  // them from local or remote locations. The only API exposed are
    17  // Finder and Fetcher - all their fields are also exposed (see action
    18  // in common.go).
    19  //
    20  // Hacking docs:
    21  //
    22  // Documentation of a specific component is in its related file. Below
    23  // is a short top-down documentation about relations between various
    24  // types in this package.
    25  //
    26  // Finder uses Fetcher to get the image from remote if it could not
    27  // find one in the store.
    28  //
    29  // Fetcher delegates its work to a specific fetcher. Specific fetchers
    30  // currently available are fileFetcher, dockerFetcher, nameFetcher and
    31  // httpFetcher.
    32  //
    33  // fileFetcher gets the images from a local filesystem. Fetcher uses
    34  // it when the image reference is either a path (relative or absolute)
    35  // or a file:// URL. In the latter case fileFetcher receives only the
    36  // Path part of the URL. fileFetcher also uses validator to verify the
    37  // image.
    38  //
    39  // dockerFetcher gets the images from docker registries. Fetcher uses
    40  // it when the image reference is a docker:// URL.
    41  //
    42  // httpFetcher gets the images from http:// or https:// URLs. It uses
    43  // httpOps for doing all the downloading, and validator to verify the
    44  // image.
    45  //
    46  // nameFetcher gets the images via a discovery process. Fetcher uses
    47  // it when the image reference is an image name. nameFetcher does the
    48  // discovery and then uses httpOps for doing all the downloading, and
    49  // validator to verify the image.
    50  //
    51  // validator checks various things in the downloaded image. It can
    52  // check whether the downloaded file is a valid image, so it can get
    53  // an image manifest from it. It also can check if the image has an
    54  // expected name or a if a signature of the image can be trusted.
    55  //
    56  // httpOps does the downloading of the images and signatures. It also
    57  // provides a fetcher for remoteAscFetcher to download the signature.
    58  // For the downloading process itself it uses downloader and
    59  // resumableSession.
    60  //
    61  // asc is used to get the signature either from a local filesystem or
    62  // from some remote location. It also provides an ascFetcher interface
    63  // and two implementations - localAscFetcher and remoteAscFetcher. The
    64  // former is standalone, the latter needs a function that does the
    65  // heavy-lifting (actually the downloading, currently provided by
    66  // httpOps).
    67  //
    68  // resumableSession is an implementation of a downloadSession
    69  // interface, so it is used together with downloader.
    70  //
    71  // downloader also provides a downloadSession interface and uses its
    72  // implementation to, uh, download stuff. It also provides a
    73  // dead-simple implementation of downloadSession -
    74  // defaultDownloadSession.
    75  //
    76  // There are also various functions and types in common.go and io.go,
    77  // which are used by the types listed above and their functions.
    78  package image