Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalid is returned when there is an invalid reference ErrInvalid = errors.New("invalid reference") // ErrObjectRequired is returned when the object is required ErrObjectRequired = errors.New("object required") // ErrHostnameRequired is returned when the hostname is required ErrHostnameRequired = errors.New("hostname required") )
Functions ¶
Types ¶
type Spec ¶
type Spec struct { // Locator is the host and path portion of the specification. The host // portion may refer to an actual host or just a namespace of related // images. // // Typically, the locator may used to resolve the remote to fetch specific // resources. Locator string // Object contains the identifier for the remote resource. Classically, // this is a tag but can refer to anything in a remote. By convention, any // portion that may be a partial or whole digest will be preceded by an // `@`. Anything preceding the `@` will be referred to as the "tag". // // In practice, we will see this broken down into the following formats: // // 1. <tag> // 2. <tag>@<digest spec> // 3. @<digest spec> // // We define the tag to be anything except '@' and ':'. <digest spec> may // be a full valid digest or shortened version, possibly with elided // algorithm. Object string }
Spec defines the main components of a reference specification.
A reference specification is a schema-less URI parsed into common components. The two main components, locator and object, are required to be supported by remotes. It represents a superset of the naming define in docker's reference schema. It aims to be compatible but not prescriptive.
While the interpretation of the components, locator and object, are up to the remote, we define a few common parts, accessible via helper methods.
The first is the hostname, which is part of the locator. This doesn't need to map to a physical resource, but it must parse as a hostname. We refer to this as the namespace.
The other component made accessible by helper method is the digest. This is part of the object identifier, always prefixed with an '@'. If present, the remote may use the digest portion directly or resolve it against a prefix. If the object does not include the `@` symbol, the return value for `Digest` will be empty.
func (Spec) Digest ¶
Digest returns the digest portion of the reference spec. This may be a partial or invalid digest, which may be used to lookup a complete digest.