github.com/duglin/docker@v1.13.1/registry/types.go (about)

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