@@ -42,17 +42,22 @@ var (
42
42
tagRegexp = regexp .MustCompile (`^[\w][\w.-]{0,127}$` )
43
43
)
44
44
45
- // Reference references to a descriptor in the registry.
45
+ // Reference references either a resource descriptor (where Reference.Reference
46
+ // is a tag or a digest), or a resource repository (where Reference.Reference
47
+ // is the empty string).
46
48
type Reference struct {
47
- // Registry is the name of the registry.
48
- // It is usually the domain name of the registry optionally with a port.
49
+ // Registry is the name of the registry. It is usually the domain name of
50
+ // the registry optionally with a port.
49
51
Registry string
50
52
51
53
// Repository is the name of the repository.
52
54
Repository string
53
55
54
- // Reference is the reference of the object in the repository.
55
- // A reference can be a tag or a digest.
56
+ // Reference is the reference of the object in the repository. This field
57
+ // can take any one of the four valid forms (see ParseReference). In the
58
+ // case where it's the empty string, it necessarily implies valid form D,
59
+ // and where it is non-empty, then it is either a tag, or a digest
60
+ // (implying one of valid forms A, B, or C).
56
61
Reference string
57
62
}
58
63
@@ -61,25 +66,41 @@ type Reference struct {
61
66
// Note: An "image" is an "artifact", however, an "artifact" is not necessarily
62
67
// an "image".
63
68
//
64
- // The parameter `artifact` is an opaque polymorphic string, composed of two
65
- // other opaque tokens; namely `socketaddr` and `path`: These can in turn take
66
- // on their own polymorphic forms. To do this, the Backus–Naur Form (BNF)
67
- // notation has been adopted, with the exception that *lowercase* labels here
68
- // imply opaque values (composed of other components), and *uppercase* labels
69
- // imply resolute/final values (can not be expanded further into subcomponents).
69
+ // The token `artifact` is composed of other tokens, and those in turn are
70
+ // composed of others. This definition recursivity requires a notation capable
71
+ // of recursion, thus the following two forms have been adopted:
70
72
//
71
- // <artifact> ::= <socketaddr> "/" <path>
73
+ // 1. Backus–Naur Form (BNF) has been adopted to address the recursive nature
74
+ // of the definition.
75
+ // 2. Token opacity is revealed via its label letter-casing. That is, "opaque"
76
+ // tokens (i.e., tokens that are not final, and must therefore be further
77
+ // broken down into their constituents) are denoted in *lowercase*, while
78
+ // final tokens (i.e., leaf-node tokens that are final) are denoted in
79
+ // *uppercase*.
72
80
//
73
- // <socketaddr> ::= <host> | <host> ":" <PORT>
74
- // <host> ::= <ip> | <FQDN>
75
- // <ip> ::= <IPV4-ADDR> | <IPV6-ADDR>
81
+ // Finally, note that a number of the opaque tokens are polymorphic in nature;
82
+ // that is, they can take on one of numerous forms, not restricted to a single
83
+ // defining form.
76
84
//
77
- // <path> ::= <REPOSITORY> | <REPOSITORY> <reference>
78
- // <reference> ::= "@" <digest> | ":" <TAG> "@" <DIGEST> | ":" <TAG>
79
- // <digest> ::= <ALGO> ":" <HASH>
85
+ // The top-level token, `artifact`, is composed of two (opaque) tokens; namely
86
+ // `socketaddr` and `path`:
80
87
//
81
- // That is, of all the possible forms that `path` can take, there are exactly 4
82
- // that are considered valid. Expanding the BNF notation for `path`, the 4 are:
88
+ // <artifact> ::= <socketaddr> "/" <path>
89
+ //
90
+ // The former is described as follows:
91
+ //
92
+ // <socketaddr> ::= <host> | <host> ":" <PORT>
93
+ // <host> ::= <ip> | <FQDN>
94
+ // <ip> ::= <IPV4-ADDR> | <IPV6-ADDR>
95
+ //
96
+ // The latter, which is of greater interest here, is described as follows:
97
+ //
98
+ // <path> ::= <REPOSITORY> | <REPOSITORY> <reference>
99
+ // <reference> ::= "@" <digest> | ":" <TAG> "@" <DIGEST> | ":" <TAG>
100
+ // <digest> ::= <ALGO> ":" <HASH>
101
+ //
102
+ // This second token--`path`--can take on exactly four forms, each of which will
103
+ // now be illustrated:
83
104
//
84
105
// <--- path --------------------------------------------> | - Decode `path`
85
106
// <=== REPOSITORY ===> <--- reference ------------------> | - Decode `reference`
0 commit comments