2018-02-05 16:05:59 -05:00
|
|
|
package registry // import "github.com/docker/docker/registry"
|
2014-08-07 10:43:06 -04:00
|
|
|
|
2015-11-18 17:20:54 -05:00
|
|
|
import (
|
2017-01-25 19:54:18 -05:00
|
|
|
"github.com/docker/distribution/reference"
|
2016-09-06 14:18:12 -04:00
|
|
|
registrytypes "github.com/docker/docker/api/types/registry"
|
2015-11-18 17:20:54 -05:00
|
|
|
)
|
|
|
|
|
2016-12-15 09:57:23 -05:00
|
|
|
// RepositoryData tracks the image list, list of endpoints for a repository
|
2014-08-07 10:43:06 -04:00
|
|
|
type RepositoryData struct {
|
2015-07-21 15:40:36 -04:00
|
|
|
// ImgList is a list of images in the repository
|
|
|
|
ImgList map[string]*ImgData
|
|
|
|
// Endpoints is a list of endpoints returned in X-Docker-Endpoints
|
2014-08-07 10:43:06 -04:00
|
|
|
Endpoints []string
|
|
|
|
}
|
|
|
|
|
2015-07-21 15:40:36 -04:00
|
|
|
// ImgData is used to transfer image checksums to and from the registry
|
2014-08-07 10:43:06 -04:00
|
|
|
type ImgData struct {
|
2015-07-21 15:40:36 -04:00
|
|
|
// ID is an opaque string that identifies the image
|
2014-08-07 10:43:06 -04:00
|
|
|
ID string `json:"id"`
|
|
|
|
Checksum string `json:"checksum,omitempty"`
|
|
|
|
ChecksumPayload string `json:"-"`
|
|
|
|
Tag string `json:",omitempty"`
|
|
|
|
}
|
|
|
|
|
2015-07-21 15:40:36 -04:00
|
|
|
// PingResult contains the information returned when pinging a registry. It
|
|
|
|
// indicates the registry's version and whether the registry claims to be a
|
|
|
|
// standalone registry.
|
|
|
|
type PingResult struct {
|
2016-05-07 21:36:10 -04:00
|
|
|
// Version is the registry version supplied by the registry in an HTTP
|
2015-07-21 15:40:36 -04:00
|
|
|
// header
|
|
|
|
Version string `json:"version"`
|
|
|
|
// Standalone is set to true if the registry indicates it is a
|
|
|
|
// standalone registry in the X-Docker-Registry-Standalone
|
|
|
|
// header
|
|
|
|
Standalone bool `json:"standalone"`
|
2014-08-07 10:43:06 -04:00
|
|
|
}
|
2014-08-26 19:21:04 -04:00
|
|
|
|
2015-07-21 15:40:36 -04:00
|
|
|
// APIVersion is an integral representation of an API version (presently
|
|
|
|
// either 1 or 2)
|
2014-08-26 19:21:04 -04:00
|
|
|
type APIVersion int
|
|
|
|
|
|
|
|
func (av APIVersion) String() string {
|
|
|
|
return apiVersions[av]
|
|
|
|
}
|
|
|
|
|
2014-12-11 20:55:15 -05:00
|
|
|
// API Version identifiers.
|
2014-08-26 19:21:04 -04:00
|
|
|
const (
|
2016-03-01 02:07:41 -05:00
|
|
|
_ = iota
|
|
|
|
APIVersion1 APIVersion = iota
|
2014-08-26 19:21:04 -04:00
|
|
|
APIVersion2
|
|
|
|
)
|
2014-10-06 21:54:52 -04:00
|
|
|
|
2016-03-01 02:07:41 -05:00
|
|
|
var apiVersions = map[APIVersion]string{
|
|
|
|
APIVersion1: "v1",
|
|
|
|
APIVersion2: "v2",
|
|
|
|
}
|
|
|
|
|
2015-07-21 15:40:36 -04:00
|
|
|
// RepositoryInfo describes a repository
|
2014-10-06 21:54:52 -04:00
|
|
|
type RepositoryInfo struct {
|
2017-01-25 19:54:18 -05:00
|
|
|
Name reference.Named
|
2015-07-21 15:40:36 -04:00
|
|
|
// Index points to registry information
|
2015-12-11 21:14:52 -05:00
|
|
|
Index *registrytypes.IndexInfo
|
2015-07-21 15:40:36 -04:00
|
|
|
// Official indicates whether the repository is considered official.
|
|
|
|
// If the registry is official, and the normalized name does not
|
|
|
|
// contain a '/' (e.g. "foo"), then it is considered an official repo.
|
|
|
|
Official bool
|
2016-11-15 18:06:48 -05:00
|
|
|
// Class represents the class of the repository, such as "plugin"
|
|
|
|
// or "image".
|
|
|
|
Class string
|
2014-10-06 21:54:52 -04:00
|
|
|
}
|