Browse code

Update manifest format to rename blobsums and use arrays of dictionaries

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)

Derek McGowan authored on 2014/10/10 09:34:34
Showing 2 changed files
... ...
@@ -458,7 +458,7 @@ func (s *TagStore) pullV2Tag(eng *engine.Engine, r *registry.Session, out io.Wri
458 458
 		return false, fmt.Errorf("error verifying manifest: %s", err)
459 459
 	}
460 460
 
461
-	if len(manifest.BlobSums) != len(manifest.History) {
461
+	if len(manifest.FSLayers) != len(manifest.History) {
462 462
 		return false, fmt.Errorf("length of history not equal to number of layers")
463 463
 	}
464 464
 
... ...
@@ -468,16 +468,16 @@ func (s *TagStore) pullV2Tag(eng *engine.Engine, r *registry.Session, out io.Wri
468 468
 		out.Write(sf.FormatStatus(tag, "Pulling from %s", localName))
469 469
 	}
470 470
 
471
-	if len(manifest.BlobSums) == 0 {
471
+	if len(manifest.FSLayers) == 0 {
472 472
 		return false, fmt.Errorf("no blobSums in manifest")
473 473
 	}
474 474
 
475
-	downloads := make([]downloadInfo, len(manifest.BlobSums))
475
+	downloads := make([]downloadInfo, len(manifest.FSLayers))
476 476
 
477
-	for i := len(manifest.BlobSums) - 1; i >= 0; i-- {
477
+	for i := len(manifest.FSLayers) - 1; i >= 0; i-- {
478 478
 		var (
479
-			sumStr  = manifest.BlobSums[i]
480
-			imgJSON = []byte(manifest.History[i])
479
+			sumStr  = manifest.FSLayers[i].BlobSum
480
+			imgJSON = []byte(manifest.History[i].V1Compatibility)
481 481
 		)
482 482
 
483 483
 		img, err := image.NewImgJSON(imgJSON)
... ...
@@ -32,13 +32,21 @@ type RegistryInfo struct {
32 32
 	Standalone bool   `json:"standalone"`
33 33
 }
34 34
 
35
+type FSLayer struct {
36
+	BlobSum string `json:"blobSum"`
37
+}
38
+
39
+type ManifestHistory struct {
40
+	V1Compatibility string `json:"v1Compatibility"`
41
+}
42
+
35 43
 type ManifestData struct {
36
-	Name          string   `json:"name"`
37
-	Tag           string   `json:"tag"`
38
-	Architecture  string   `json:"architecture"`
39
-	BlobSums      []string `json:"blobSums"`
40
-	History       []string `json:"history"`
41
-	SchemaVersion int      `json:"schemaVersion"`
44
+	Name          string             `json:"name"`
45
+	Tag           string             `json:"tag"`
46
+	Architecture  string             `json:"architecture"`
47
+	FSLayers      []*FSLayer         `json:"fsLayers"`
48
+	History       []*ManifestHistory `json:"history"`
49
+	SchemaVersion int                `json:"schemaVersion"`
42 50
 }
43 51
 
44 52
 type APIVersion int