MCPcopy Create free account
hub / github.com/containers/common / Exists

Method Exists

libimage/runtime.go:153–166  ·  view source on GitHub ↗

Exists returns true if the specicifed image exists in the local containers storage. Note that it may return false if an image corrupted.

(name string)

Source from the content-addressed store, hash-verified

151// Exists returns true if the specicifed image exists in the local containers
152// storage. Note that it may return false if an image corrupted.
153func (r *Runtime) Exists(name string) (bool, error) {
154 image, _, err := r.LookupImage(name, nil)
155 if err != nil && errors.Cause(err) != storage.ErrImageUnknown {
156 return false, err
157 }
158 if image == nil {
159 return false, nil
160 }
161 if err := image.isCorrupted(name); err != nil {
162 logrus.Error(err)
163 return false, nil
164 }
165 return true, nil
166}
167
168// LookupImageOptions allow for customizing local image lookups.
169type LookupImageOptions struct {

Callers 2

TestCorruptedLayersFunction · 0.80
TestRemoveImagesFunction · 0.80

Calls 3

LookupImageMethod · 0.95
isCorruptedMethod · 0.80
ErrorMethod · 0.45

Tested by 2

TestCorruptedLayersFunction · 0.64
TestRemoveImagesFunction · 0.64