2014-08-07 10:43:06 -04:00
|
|
|
package registry
|
|
|
|
|
2015-11-18 17:20:54 -05:00
|
|
|
import (
|
2016-09-06 14:18:12 -04:00
|
|
|
registrytypes "github.com/docker/docker/api/types/registry"
|
2015-12-04 16:55:15 -05:00
|
|
|
"github.com/docker/docker/reference"
|
2015-11-18 17:20:54 -05:00
|
|
|
)
|
|
|
|
|
2015-07-21 15:40:36 -04:00
|
|
|
// RepositoryData tracks the image list, list of endpoints, and list of tokens
|
|
|
|
// 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
|
|
|
// Tokens is currently unused (remove it?)
|
|
|
|
Tokens []string
|
2014-08-07 10:43:06 -04:00
|
|
|
}
|
|
|
|
|
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 {
|
2015-12-11 14:00:13 -05:00
|
|
|
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
|
2014-10-06 21:54:52 -04:00
|
|
|
}
|