From 15d5c7f10f56faeaa04f6374341e1cfd3e03cab1 Mon Sep 17 00:00:00 2001 From: Derek McGowan Date: Thu, 9 Oct 2014 17:34:34 -0700 Subject: [PATCH] Update manifest format to rename blobsums and use arrays of dictionaries Signed-off-by: Derek McGowan (github: dmcgowan) --- graph/pull.go | 12 ++++++------ registry/types.go | 20 ++++++++++++++------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/graph/pull.go b/graph/pull.go index 97f4d0f578..39e8926c8a 100644 --- a/graph/pull.go +++ b/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) } - 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") } @@ -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)) } - if len(manifest.BlobSums) == 0 { + if len(manifest.FSLayers) == 0 { 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 ( - 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) diff --git a/registry/types.go b/registry/types.go index 2ba5af0da4..3b429f19af 100644 --- a/registry/types.go +++ b/registry/types.go @@ -32,13 +32,21 @@ type RegistryInfo struct { Standalone bool `json:"standalone"` } +type FSLayer struct { + BlobSum string `json:"blobSum"` +} + +type ManifestHistory struct { + V1Compatibility string `json:"v1Compatibility"` +} + 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