1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Update manifest format to rename blobsums and use arrays of dictionaries

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
This commit is contained in:
Derek McGowan 2014-10-09 17:34:34 -07:00
parent 456f493659
commit 15d5c7f10f
2 changed files with 20 additions and 12 deletions

View file

@ -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] sumStr = manifest.FSLayers[i].BlobSum
imgJSON = []byte(manifest.History[i]) imgJSON = []byte(manifest.History[i].V1Compatibility)
) )
img, err := image.NewImgJSON(imgJSON) img, err := image.NewImgJSON(imgJSON)

View file

@ -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"` Name string `json:"name"`
Tag string `json:"tag"` Tag string `json:"tag"`
Architecture string `json:"architecture"` Architecture string `json:"architecture"`
BlobSums []string `json:"blobSums"` FSLayers []*FSLayer `json:"fsLayers"`
History []string `json:"history"` History []*ManifestHistory `json:"history"`
SchemaVersion int `json:"schemaVersion"` SchemaVersion int `json:"schemaVersion"`
} }
type APIVersion int type APIVersion int