本文整理汇总了Golang中github.com/coreos/rkt/store.Store.GetACI方法的典型用法代码示例。如果您正苦于以下问题:Golang Store.GetACI方法的具体用法?Golang Store.GetACI怎么用?Golang Store.GetACI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/coreos/rkt/store.Store
的用法示例。
在下文中一共展示了Store.GetACI方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: getStoreKeyFromApp
func getStoreKeyFromApp(s *store.Store, img string) (string, error) {
app, err := discovery.NewAppFromString(img)
if err != nil {
return "", fmt.Errorf("cannot parse the image name: %v", err)
}
labels, err := types.LabelsFromMap(app.Labels)
if err != nil {
return "", fmt.Errorf("invalid labels in the name: %v", err)
}
key, err := s.GetACI(app.Name, labels)
if err != nil {
return "", fmt.Errorf("cannot find image: %v", err)
}
return key, nil
}
示例2: getStoreKeyFromApp
func getStoreKeyFromApp(s *store.Store, img string) (string, error) {
app, err := discovery.NewAppFromString(img)
if err != nil {
return "", fmt.Errorf("cannot parse the image name %q: %v", img, err)
}
labels, err := types.LabelsFromMap(app.Labels)
if err != nil {
return "", fmt.Errorf("invalid labels in the image %q: %v", img, err)
}
key, err := s.GetACI(app.Name, labels)
if err != nil {
switch err.(type) {
case store.ACINotFoundError:
return "", err
default:
return "", fmt.Errorf("cannot find image %q: %v", img, err)
}
}
return key, nil
}
示例3: getKeyFromAppOrHash
func getKeyFromAppOrHash(s *store.Store, input string) (string, error) {
var key string
if _, err := types.NewHash(input); err == nil {
key, err = s.ResolveKey(input)
if err != nil {
return "", fmt.Errorf("cannot resolve key: %v", err)
}
} else {
app, err := discovery.NewAppFromString(input)
if err != nil {
return "", fmt.Errorf("cannot parse the image name: %v", err)
}
labels, err := types.LabelsFromMap(app.Labels)
if err != nil {
return "", fmt.Errorf("invalid labels in the name: %v", err)
}
key, err = s.GetACI(app.Name, labels)
if err != nil {
return "", fmt.Errorf("cannot find image: %v", err)
}
}
return key, nil
}