本文整理汇总了Golang中registry/storage.Storage.GetReader方法的典型用法代码示例。如果您正苦于以下问题:Golang Storage.GetReader方法的具体用法?Golang Storage.GetReader怎么用?Golang Storage.GetReader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类registry/storage.Storage
的用法示例。
在下文中一共展示了Storage.GetReader方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: GetImageFilesJson
// return json file listing for given image id
// Download the specified layer and determine the file contents. If the cache already exists, just return it.
func GetImageFilesJson(s storage.Storage, imageID string) ([]byte, error) {
// if the files json exists in the cache, return it
filesJson, err := GetImageFilesCache(s, imageID)
if err != nil {
return filesJson, nil
}
// cache doesn't exist. download remote layer
// docker-registry 0.6.5 has an lzma decompress here. it actually doesn't seem to be used so i've omitted it
// will add it later if need be.
tarFilesInfo := NewTarFilesInfo()
if reader, err := s.GetReader(storage.ImageLayerPath(imageID)); err != nil {
return nil, err
} else if err := tarFilesInfo.Load(reader); err != nil {
return nil, err
}
return tarFilesInfo.Json()
}