types.go 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. package registry
  2. import (
  3. "github.com/docker/docker/reference"
  4. registrytypes "github.com/docker/engine-api/types/registry"
  5. )
  6. // RepositoryData tracks the image list, list of endpoints, and list of tokens
  7. // for a repository
  8. type RepositoryData struct {
  9. // ImgList is a list of images in the repository
  10. ImgList map[string]*ImgData
  11. // Endpoints is a list of endpoints returned in X-Docker-Endpoints
  12. Endpoints []string
  13. // Tokens is currently unused (remove it?)
  14. Tokens []string
  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. // PingResult contains the information returned when pinging a registry. It
  25. // indicates the registry's version and whether the registry claims to be a
  26. // standalone registry.
  27. type PingResult struct {
  28. // Version is the registry version supplied by the registry in an HTTP
  29. // header
  30. Version string `json:"version"`
  31. // Standalone is set to true if the registry indicates it is a
  32. // standalone registry in the X-Docker-Registry-Standalone
  33. // header
  34. Standalone bool `json:"standalone"`
  35. }
  36. // APIVersion is an integral representation of an API version (presently
  37. // either 1 or 2)
  38. type APIVersion int
  39. func (av APIVersion) String() string {
  40. return apiVersions[av]
  41. }
  42. // API Version identifiers.
  43. const (
  44. _ = iota
  45. APIVersion1 APIVersion = iota
  46. APIVersion2
  47. )
  48. var apiVersions = map[APIVersion]string{
  49. APIVersion1: "v1",
  50. APIVersion2: "v2",
  51. }
  52. // RepositoryInfo describes a repository
  53. type RepositoryInfo struct {
  54. reference.Named
  55. // Index points to registry information
  56. Index *registrytypes.IndexInfo
  57. // Official indicates whether the repository is considered official.
  58. // If the registry is official, and the normalized name does not
  59. // contain a '/' (e.g. "foo"), then it is considered an official repo.
  60. Official bool
  61. }