Просмотр исходного кода

Update manifest format to rename blobsums and use arrays of dictionaries

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Derek McGowan 10 лет назад
Родитель
Сommit
15d5c7f10f
2 измененных файлов с 20 добавлено и 12 удалено
  1. 6 6
      graph/pull.go
  2. 14 6
      registry/types.go

+ 6 - 6
graph/pull.go

@@ -458,7 +458,7 @@ func (s *TagStore) pullV2Tag(eng *engine.Engine, r *registry.Session, out io.Wri
 		return false, fmt.Errorf("error verifying manifest: %s", err)
 		return false, fmt.Errorf("error verifying manifest: %s", err)
 	}
 	}
 
 
-	if len(manifest.BlobSums) != len(manifest.History) {
+	if len(manifest.FSLayers) != len(manifest.History) {
 		return false, fmt.Errorf("length of history not equal to number of layers")
 		return false, fmt.Errorf("length of history not equal to number of layers")
 	}
 	}
 
 
@@ -468,16 +468,16 @@ func (s *TagStore) pullV2Tag(eng *engine.Engine, r *registry.Session, out io.Wri
 		out.Write(sf.FormatStatus(tag, "Pulling from %s", localName))
 		out.Write(sf.FormatStatus(tag, "Pulling from %s", localName))
 	}
 	}
 
 
-	if len(manifest.BlobSums) == 0 {
+	if len(manifest.FSLayers) == 0 {
 		return false, fmt.Errorf("no blobSums in manifest")
 		return false, fmt.Errorf("no blobSums in manifest")
 	}
 	}
 
 
-	downloads := make([]downloadInfo, len(manifest.BlobSums))
+	downloads := make([]downloadInfo, len(manifest.FSLayers))
 
 
-	for i := len(manifest.BlobSums) - 1; i >= 0; i-- {
+	for i := len(manifest.FSLayers) - 1; i >= 0; i-- {
 		var (
 		var (
-			sumStr  = manifest.BlobSums[i]
-			imgJSON = []byte(manifest.History[i])
+			sumStr  = manifest.FSLayers[i].BlobSum
+			imgJSON = []byte(manifest.History[i].V1Compatibility)
 		)
 		)
 
 
 		img, err := image.NewImgJSON(imgJSON)
 		img, err := image.NewImgJSON(imgJSON)

+ 14 - 6
registry/types.go

@@ -32,13 +32,21 @@ type RegistryInfo struct {
 	Standalone bool   `json:"standalone"`
 	Standalone bool   `json:"standalone"`
 }
 }
 
 
+type FSLayer struct {
+	BlobSum string `json:"blobSum"`
+}
+
+type ManifestHistory struct {
+	V1Compatibility string `json:"v1Compatibility"`
+}
+
 type ManifestData struct {
 type ManifestData struct {
-	Name          string   `json:"name"`
-	Tag           string   `json:"tag"`
-	Architecture  string   `json:"architecture"`
-	BlobSums      []string `json:"blobSums"`
-	History       []string `json:"history"`
-	SchemaVersion int      `json:"schemaVersion"`
+	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 APIVersion int
 type APIVersion int