mirror of
https://github.com/containers/podman.git
synced 2025-12-02 11:08:36 +08:00
vendor containers/common@e27c30ee9b
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
38
vendor/github.com/containers/common/libimage/runtime.go
generated
vendored
38
vendor/github.com/containers/common/libimage/runtime.go
generated
vendored
@@ -537,6 +537,8 @@ type ListImagesOptions struct {
|
||||
// used). The definition of an external container can be set by
|
||||
// callers.
|
||||
IsExternalContainerFunc IsExternalContainerFunc
|
||||
// SetListData will populate the Image.ListData fields of returned images.
|
||||
SetListData bool
|
||||
}
|
||||
|
||||
// ListImages lists images in the local container storage. If names are
|
||||
@@ -565,7 +567,41 @@ func (r *Runtime) ListImages(ctx context.Context, names []string, options *ListI
|
||||
}
|
||||
}
|
||||
|
||||
return r.filterImages(ctx, images, options)
|
||||
filtered, err := r.filterImages(ctx, images, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !options.SetListData {
|
||||
return filtered, nil
|
||||
}
|
||||
|
||||
// If explicitly requested by the user, pre-compute and cache the
|
||||
// dangling and parent information of all filtered images. That will
|
||||
// considerably speed things up for callers who need this information
|
||||
// as the layer tree will computed once for all instead of once for
|
||||
// each individual image (see containers/podman/issues/17828).
|
||||
|
||||
tree, err := r.layerTree(images)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for i := range filtered {
|
||||
isDangling, err := filtered[i].isDangling(ctx, tree)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
filtered[i].ListData.IsDangling = &isDangling
|
||||
|
||||
parent, err := filtered[i].parent(ctx, tree)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
filtered[i].ListData.Parent = parent
|
||||
}
|
||||
|
||||
return filtered, nil
|
||||
}
|
||||
|
||||
// RemoveImagesOptions allow for customizing image removal.
|
||||
|
||||
Reference in New Issue
Block a user