github.com/docker/docker@v299999999.0.0-20200612211812-aaf470eca7b5+incompatible/registry/types.go (about)

     1  package registry // import "github.com/docker/docker/registry"
     2  
     3  import (
     4  	"github.com/docker/distribution/reference"
     5  	registrytypes "github.com/docker/docker/api/types/registry"
     6  )
     7  
     8  // RepositoryData tracks the image list, list of endpoints for a repository
     9  type RepositoryData struct {
    10  	// ImgList is a list of images in the repository
    11  	ImgList map[string]*ImgData
    12  	// Endpoints is a list of endpoints returned in X-Docker-Endpoints
    13  	Endpoints []string
    14  }
    15  
    16  // ImgData is used to transfer image checksums to and from the registry
    17  type ImgData struct {
    18  	// ID is an opaque string that identifies the image
    19  	ID              string `json:"id"`
    20  	Checksum        string `json:"checksum,omitempty"`
    21  	ChecksumPayload string `json:"-"`
    22  	Tag             string `json:",omitempty"`
    23  }
    24  
    25  // PingResult contains the information returned when pinging a registry. It
    26  // indicates the registry's version and whether the registry claims to be a
    27  // standalone registry.
    28  type PingResult struct {
    29  	// Version is the registry version supplied by the registry in an HTTP
    30  	// header
    31  	Version string `json:"version"`
    32  	// Standalone is set to true if the registry indicates it is a
    33  	// standalone registry in the X-Docker-Registry-Standalone
    34  	// header
    35  	Standalone bool `json:"standalone"`
    36  }
    37  
    38  // APIVersion is an integral representation of an API version (presently
    39  // either 1 or 2)
    40  type APIVersion int
    41  
    42  func (av APIVersion) String() string {
    43  	return apiVersions[av]
    44  }
    45  
    46  // API Version identifiers.
    47  const (
    48  	_                      = iota
    49  	APIVersion1 APIVersion = iota
    50  	APIVersion2
    51  )
    52  
    53  var apiVersions = map[APIVersion]string{
    54  	APIVersion1: "v1",
    55  	APIVersion2: "v2",
    56  }
    57  
    58  // RepositoryInfo describes a repository
    59  type RepositoryInfo struct {
    60  	Name reference.Named
    61  	// Index points to registry information
    62  	Index *registrytypes.IndexInfo
    63  	// Official indicates whether the repository is considered official.
    64  	// If the registry is official, and the normalized name does not
    65  	// contain a '/' (e.g. "foo"), then it is considered an official repo.
    66  	Official bool
    67  	// Class represents the class of the repository, such as "plugin"
    68  	// or "image".
    69  	Class string
    70  }