本文整理汇总了Golang中github.com/coreos/rkt/store/imagestore.Store.GetImageManifestJSON方法的典型用法代码示例。如果您正苦于以下问题:Golang Store.GetImageManifestJSON方法的具体用法?Golang Store.GetImageManifestJSON怎么用?Golang Store.GetImageManifestJSON使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/coreos/rkt/store/imagestore.Store
的用法示例。
在下文中一共展示了Store.GetImageManifestJSON方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: aciInfoToV1AlphaAPIImage
// aciInfoToV1AlphaAPIImage takes an aciInfo object and construct the v1alpha.Image object.
func aciInfoToV1AlphaAPIImage(store *imagestore.Store, aciInfo *imagestore.ACIInfo) (*v1alpha.Image, error) {
manifest, err := store.GetImageManifestJSON(aciInfo.BlobKey)
if err != nil {
stderr.PrintE("failed to read the image manifest", err)
return nil, err
}
var im schema.ImageManifest
if err = json.Unmarshal(manifest, &im); err != nil {
stderr.PrintE("failed to unmarshal image manifest", err)
return nil, err
}
version, ok := im.Labels.Get("version")
if !ok {
version = "latest"
}
return &v1alpha.Image{
BaseFormat: &v1alpha.ImageFormat{
// Only support appc image now. If it's a docker image, then it
// will be transformed to appc before storing in the disk store.
Type: v1alpha.ImageType_IMAGE_TYPE_APPC,
Version: schema.AppContainerVersion.String(),
},
Id: aciInfo.BlobKey,
Name: im.Name.String(),
Version: version,
ImportTimestamp: aciInfo.ImportTime.Unix(),
Manifest: manifest,
Size: aciInfo.Size + aciInfo.TreeStoreSize,
Annotations: convertAnnotationsToKeyValue(im.Annotations),
Labels: convertLabelsToKeyValue(im.Labels),
}, nil
}