2014-08-07 14:43:06 +00:00
|
|
|
package registry
|
|
|
|
|
2015-11-18 22:20:54 +00:00
|
|
|
import (
|
|
|
|
"github.com/docker/distribution/reference"
|
2015-12-12 02:14:52 +00:00
|
|
|
registrytypes "github.com/docker/docker/api/types/registry"
|
2015-11-18 22:20:54 +00:00
|
|
|
)
|
|
|
|
|
2015-07-21 19:40:36 +00:00
|
|
|
// RepositoryData tracks the image list, list of endpoints, and list of tokens
|
|
|
|
// for a repository
|
2014-08-07 14:43:06 +00:00
|
|
|
type RepositoryData struct {
|
2015-07-21 19:40:36 +00: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 14:43:06 +00:00
|
|
|
Endpoints []string
|
2015-07-21 19:40:36 +00:00
|
|
|
// Tokens is currently unused (remove it?)
|
|
|
|
Tokens []string
|
2014-08-07 14:43:06 +00:00
|
|
|
}
|
|
|
|
|
2015-07-21 19:40:36 +00:00
|
|
|
// ImgData is used to transfer image checksums to and from the registry
|
2014-08-07 14:43:06 +00:00
|
|
|
type ImgData struct {
|
2015-07-21 19:40:36 +00:00
|
|
|
// ID is an opaque string that identifies the image
|
2014-08-07 14:43:06 +00:00
|
|
|
ID string `json:"id"`
|
|
|
|
Checksum string `json:"checksum,omitempty"`
|
|
|
|
ChecksumPayload string `json:"-"`
|
|
|
|
Tag string `json:",omitempty"`
|
|
|
|
}
|
|
|
|
|
2015-07-21 19:40:36 +00: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 {
|
|
|
|
// Version is the registry version supplied by the registry in a HTTP
|
|
|
|
// 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 14:43:06 +00:00
|
|
|
}
|
2014-08-26 23:21:04 +00:00
|
|
|
|
2015-07-21 19:40:36 +00:00
|
|
|
// APIVersion is an integral representation of an API version (presently
|
|
|
|
// either 1 or 2)
|
2014-08-26 23:21:04 +00:00
|
|
|
type APIVersion int
|
|
|
|
|
|
|
|
func (av APIVersion) String() string {
|
|
|
|
return apiVersions[av]
|
|
|
|
}
|
|
|
|
|
|
|
|
var apiVersions = map[APIVersion]string{
|
|
|
|
1: "v1",
|
|
|
|
2: "v2",
|
|
|
|
}
|
|
|
|
|
2014-12-12 01:55:15 +00:00
|
|
|
// API Version identifiers.
|
2014-08-26 23:21:04 +00:00
|
|
|
const (
|
2014-12-12 01:55:15 +00:00
|
|
|
APIVersionUnknown = iota
|
|
|
|
APIVersion1
|
2014-08-26 23:21:04 +00:00
|
|
|
APIVersion2
|
|
|
|
)
|
2014-10-07 01:54:52 +00:00
|
|
|
|
2015-07-21 19:40:36 +00:00
|
|
|
// RepositoryInfo describes a repository
|
2014-10-07 01:54:52 +00:00
|
|
|
type RepositoryInfo struct {
|
2015-07-21 19:40:36 +00:00
|
|
|
// Index points to registry information
|
2015-12-12 02:14:52 +00:00
|
|
|
Index *registrytypes.IndexInfo
|
2015-07-21 19:40:36 +00:00
|
|
|
// RemoteName is the remote name of the repository, such as
|
|
|
|
// "library/ubuntu-12.04-base"
|
2015-11-18 22:20:54 +00:00
|
|
|
RemoteName reference.Named
|
2015-07-21 19:40:36 +00:00
|
|
|
// LocalName is the local name of the repository, such as
|
|
|
|
// "ubuntu-12.04-base"
|
2015-11-18 22:20:54 +00:00
|
|
|
LocalName reference.Named
|
2015-07-21 19:40:36 +00:00
|
|
|
// CanonicalName is the canonical name of the repository, such as
|
|
|
|
// "docker.io/library/ubuntu-12.04-base"
|
2015-11-18 22:20:54 +00:00
|
|
|
CanonicalName reference.Named
|
2015-07-21 19:40:36 +00: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-07 01:54:52 +00:00
|
|
|
}
|