registry

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2014 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Where we store the config file
	CONFIGFILE = ".dockercfg"

	// Only used for user auth + account creation
	INDEXSERVER    = "https://index.docker.io/v1/"
	REGISTRYSERVER = "https://registry-1.docker.io/v1/"
)
View Source
const (
	APIVersion1 = iota + 1
	APIVersion2
)

Variables

View Source
var (
	ErrAlreadyExists         = errors.New("Image already exists")
	ErrInvalidRepositoryName = errors.New("Invalid repository name (ex: \"registry.domain.tld/myrepos\")")
	ErrDoesNotExist          = errors.New("Image does not exist")
)
View Source
var (
	ErrConfigFileMissing = errors.New("The Auth config file is missing")
)

Functions

func AddRequiredHeadersToRedirectedRequests added in v0.12.0

func AddRequiredHeadersToRedirectedRequests(req *http.Request, via []*http.Request) error

func HTTPRequestFactory added in v0.11.0

func HTTPRequestFactory(metaHeaders map[string][]string) *utils.HTTPRequestFactory

func IndexServerAddress added in v0.10.0

func IndexServerAddress() string

func Login added in v0.10.0

func Login(authConfig *AuthConfig, factory *utils.HTTPRequestFactory) (string, error)

try to register/login to the registry server

func ResolveRepositoryName added in v0.5.0

func ResolveRepositoryName(reposName string) (string, string, error)

Resolves a repository name to a hostname + name

func SaveConfig added in v0.10.0

func SaveConfig(configFile *ConfigFile) error

save the auth config

Types

type APIVersion added in v1.3.0

type APIVersion int
var DefaultAPIVersion APIVersion = APIVersion1

func (APIVersion) String added in v1.3.0

func (av APIVersion) String() string

type AuthConfig added in v0.10.0

type AuthConfig struct {
	Username      string `json:"username,omitempty"`
	Password      string `json:"password,omitempty"`
	Auth          string `json:"auth"`
	Email         string `json:"email"`
	ServerAddress string `json:"serveraddress,omitempty"`
}

type ConfigFile added in v0.10.0

type ConfigFile struct {
	Configs map[string]AuthConfig `json:"configs,omitempty"`
	// contains filtered or unexported fields
}

func LoadConfig added in v0.10.0

func LoadConfig(rootPath string) (*ConfigFile, error)

load up the auth config information and return values FIXME: use the internal golang config parser

func (*ConfigFile) ResolveAuthConfig added in v0.10.0

func (config *ConfigFile) ResolveAuthConfig(hostname string) AuthConfig

this method matches a auth configuration to a server address or a url

type Endpoint added in v1.3.0

type Endpoint struct {
	URL     *url.URL
	Version APIVersion
}

func NewEndpoint added in v1.3.0

func NewEndpoint(hostname string) (*Endpoint, error)

func (Endpoint) Ping added in v1.3.0

func (e Endpoint) Ping() (RegistryInfo, error)

func (Endpoint) String added in v1.3.0

func (e Endpoint) String() string

Get the formated URL for the root of this registry Endpoint

func (Endpoint) VersionString added in v1.3.0

func (e Endpoint) VersionString(version APIVersion) string

type FSLayer added in v1.3.0

type FSLayer struct {
	BlobSum string `json:"blobSum"`
}

type ImgData

type ImgData struct {
	ID              string `json:"id"`
	Checksum        string `json:"checksum,omitempty"`
	ChecksumPayload string `json:"-"`
	Tag             string `json:",omitempty"`
}

type ManifestData added in v1.3.0

type ManifestData struct {
	Name          string             `json:"name"`
	Tag           string             `json:"tag"`
	Architecture  string             `json:"architecture"`
	FSLayers      []*FSLayer         `json:"fsLayers"`
	History       []*ManifestHistory `json:"history"`
	SchemaVersion int                `json:"schemaVersion"`
}

type ManifestHistory added in v1.3.0

type ManifestHistory struct {
	V1Compatibility string `json:"v1Compatibility"`
}

type RegistryInfo added in v0.11.0

type RegistryInfo struct {
	Version    string `json:"version"`
	Standalone bool   `json:"standalone"`
}

type RepositoryData

type RepositoryData struct {
	ImgList   map[string]*ImgData
	Endpoints []string
	Tokens    []string
}

type SearchResult added in v0.6.6

type SearchResult struct {
	StarCount   int    `json:"star_count"`
	IsOfficial  bool   `json:"is_official"`
	Name        string `json:"name"`
	IsTrusted   bool   `json:"is_trusted"`
	Description string `json:"description"`
}

type SearchResults

type SearchResults struct {
	Query      string         `json:"query"`
	NumResults int            `json:"num_results"`
	Results    []SearchResult `json:"results"`
}

type Service added in v0.11.0

type Service struct {
}

Service exposes registry capabilities in the standard Engine interface. Once installed, it extends the engine with the following calls:

'auth': Authenticate against the public registry
'search': Search for images on the public registry
'pull': Download images from any registry (TODO)
'push': Upload images to any registry (TODO)

func NewService added in v0.11.0

func NewService() *Service

NewService returns a new instance of Service ready to be installed no an engine.

func (*Service) Auth added in v0.11.0

func (s *Service) Auth(job *engine.Job) engine.Status

Auth contacts the public registry with the provided credentials, and returns OK if authentication was sucessful. It can be used to verify the validity of a client's credentials.

func (*Service) Install added in v0.11.0

func (s *Service) Install(eng *engine.Engine) error

Install installs registry capabilities to eng.

func (*Service) Search added in v0.11.0

func (s *Service) Search(job *engine.Job) engine.Status

Search queries the public registry for images matching the specified search terms, and returns the results.

Argument syntax: search TERM

Option environment:

'authConfig': json-encoded credentials to authenticate against the registry.
	The search extends to images only accessible via the credentials.

'metaHeaders': extra HTTP headers to include in the request to the registry.
	The headers should be passed as a json-encoded dictionary.

Output:

Results are sent as a collection of structured messages (using engine.Table).
Each result is sent as a separate message.
Results are ordered by number of stars on the public registry.

type Session added in v1.2.0

type Session struct {
	// contains filtered or unexported fields
}

func NewSession added in v1.2.0

func NewSession(authConfig *AuthConfig, factory *utils.HTTPRequestFactory, endpoint *Endpoint, timeout bool) (r *Session, err error)

func (*Session) GetAuthConfig added in v1.2.0

func (r *Session) GetAuthConfig(withPasswd bool) *AuthConfig

func (*Session) GetRemoteHistory added in v1.2.0

func (r *Session) GetRemoteHistory(imgID, registry string, token []string) ([]string, error)

Retrieve the history of a given image from the Registry. Return a list of the parent's json (requested image included)

func (*Session) GetRemoteImageJSON added in v1.2.0

func (r *Session) GetRemoteImageJSON(imgID, registry string, token []string) ([]byte, int, error)

Retrieve an image from the Registry.

func (*Session) GetRemoteImageLayer added in v1.2.0

func (r *Session) GetRemoteImageLayer(imgID, registry string, token []string, imgSize int64) (io.ReadCloser, error)

func (*Session) GetRemoteTags added in v1.2.0

func (r *Session) GetRemoteTags(registries []string, repository string, token []string) (map[string]string, error)

func (*Session) GetRepositoryData added in v1.2.0

func (r *Session) GetRepositoryData(remote string) (*RepositoryData, error)

func (*Session) GetV2ImageBlob added in v1.3.0

func (r *Session) GetV2ImageBlob(imageName, sumType, sum string, blobWrtr io.Writer, token []string) error

func (*Session) GetV2ImageBlobReader added in v1.3.0

func (r *Session) GetV2ImageBlobReader(imageName, sumType, sum string, token []string) (io.ReadCloser, int64, error)

func (*Session) GetV2ImageManifest added in v1.3.0

func (r *Session) GetV2ImageManifest(imageName, tagName string, token []string) ([]byte, error)
  1. Check if TarSum of each layer exists /v2/ 1.a) if 200, continue 1.b) if 300, then push the 1.c) if anything else, err
  2. PUT the created/signed manifest

func (*Session) GetV2RemoteTags added in v1.3.0

func (r *Session) GetV2RemoteTags(imageName string, token []string) ([]string, error)

Given a repository name, returns a json array of string tags

func (*Session) GetV2Version added in v1.3.0

func (r *Session) GetV2Version(token []string) (*RegistryInfo, error)

func (*Session) LookupRemoteImage added in v1.2.0

func (r *Session) LookupRemoteImage(imgID, registry string, token []string) bool

Check if an image exists in the Registry TODO: This method should return the errors instead of masking them and returning false

func (*Session) PostV2ImageMountBlob added in v1.3.0

func (r *Session) PostV2ImageMountBlob(imageName, sumType, sum string, token []string) (bool, error)

- Succeeded to mount for this image scope - Failed with no error (So continue to Push the Blob) - Failed with error

func (*Session) PushImageChecksumRegistry added in v1.2.0

func (r *Session) PushImageChecksumRegistry(imgData *ImgData, registry string, token []string) error

func (*Session) PushImageJSONIndex added in v1.2.0

func (r *Session) PushImageJSONIndex(remote string, imgList []*ImgData, validate bool, regs []string) (*RepositoryData, error)

func (*Session) PushImageJSONRegistry added in v1.2.0

func (r *Session) PushImageJSONRegistry(imgData *ImgData, jsonRaw []byte, registry string, token []string) error

Push a local image to the registry

func (*Session) PushImageLayerRegistry added in v1.2.0

func (r *Session) PushImageLayerRegistry(imgID string, layer io.Reader, registry string, token []string, jsonRaw []byte) (checksum string, checksumPayload string, err error)

func (*Session) PushRegistryTag added in v1.2.0

func (r *Session) PushRegistryTag(remote, revision, tag, registry string, token []string) error

push a tag on the registry. Remote has the format '<user>/<repo>

func (*Session) PutV2ImageBlob added in v1.3.0

func (r *Session) PutV2ImageBlob(imageName, sumType string, blobRdr io.Reader, token []string) (serverChecksum string, err error)

Push the image to the server for storage. 'layer' is an uncompressed reader of the blob to be pushed. The server will generate it's own checksum calculation.

func (*Session) PutV2ImageManifest added in v1.3.0

func (r *Session) PutV2ImageManifest(imageName, tagName string, manifestRdr io.Reader, token []string) error

Finally Push the (signed) manifest of the blobs we've just pushed

func (*Session) SearchRepositories added in v1.2.0

func (r *Session) SearchRepositories(term string) (*SearchResults, error)

type TimeoutType added in v1.2.0

type TimeoutType uint32
const (
	NoTimeout TimeoutType = iota
	ReceiveTimeout
	ConnectTimeout
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL