Explorar el Código

x/model: introduce Digest

Blake Mizerany hace 1 año
padre
commit
bd446a72cc
Se han modificado 1 ficheros con 19 adiciones y 13 borrados
  1. 19 13
      x/model/name.go

+ 19 - 13
x/model/name.go

@@ -28,6 +28,24 @@ const MaxNamePartLen = 128
 
 type NamePart int
 
+// Levels of concreteness
+const (
+	Host NamePart = iota
+	Namespace
+	Model
+	Tag
+	Build
+	Digest
+
+	// Invalid is a special part that is used to indicate that a part is
+	// invalid. It is not a valid part of a Name.
+	//
+	// It should be kept as the last part in the list.
+	Invalid
+
+	NumParts = Invalid - 1
+)
+
 var kindNames = map[NamePart]string{
 	Invalid:   "Invalid",
 	Host:      "Host",
@@ -35,25 +53,13 @@ var kindNames = map[NamePart]string{
 	Model:     "Name",
 	Tag:       "Tag",
 	Build:     "Build",
+	Digest:    "Digest",
 }
 
 func (k NamePart) String() string {
 	return cmp.Or(kindNames[k], "Unknown")
 }
 
-// Levels of concreteness
-const (
-	Host NamePart = iota
-	Namespace
-	Model
-	Tag
-	Build
-
-	NumParts = Build + 1
-
-	Invalid = NamePart(-1)
-)
-
 // Name is an opaque reference to a model. It holds the parts of a model
 // with the case preserved, but is not directly comparable with other Names
 // since model names can be represented with different caseing depending on