summaryrefslogtreecommitdiff
path: root/libpod/image/image.go
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin@redhat.com>2019-04-22 16:41:17 -0400
committerNalin Dahyabhai <nalin@redhat.com>2019-04-25 08:57:58 -0400
commit5c81a117f16fde190acef331f5b88022fe11c550 (patch)
treea8aa0f3baaf59bf05e10479abc5a1d89206a0e80 /libpod/image/image.go
parentb01fdcbbd5344e89c3d9f3462c1df1764277d9fd (diff)
downloadpodman-5c81a117f16fde190acef331f5b88022fe11c550.tar.gz
podman-5c81a117f16fde190acef331f5b88022fe11c550.tar.bz2
podman-5c81a117f16fde190acef331f5b88022fe11c550.zip
images: add context to GetParent/IsParent/Remove/Prune...
Add a context.Context parameter to Image.GetParent(), Image.IsParent(), Image.GetChildren(), Image.Remove(), and Runtime.PruneImages(). Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Diffstat (limited to 'libpod/image/image.go')
-rw-r--r--libpod/image/image.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/libpod/image/image.go b/libpod/image/image.go
index 757d034a2..588809bbc 100644
--- a/libpod/image/image.go
+++ b/libpod/image/image.go
@@ -353,8 +353,8 @@ func (i *Image) TopLayer() string {
// outside the context of images
// TODO: the force param does nothing as of now. Need to move container
// handling logic here eventually.
-func (i *Image) Remove(force bool) error {
- parent, err := i.GetParent()
+func (i *Image) Remove(ctx context.Context, force bool) error {
+ parent, err := i.GetParent(ctx)
if err != nil {
return err
}
@@ -363,11 +363,11 @@ func (i *Image) Remove(force bool) error {
}
i.newImageEvent(events.Remove)
for parent != nil {
- nextParent, err := parent.GetParent()
+ nextParent, err := parent.GetParent(ctx)
if err != nil {
return err
}
- children, err := parent.GetChildren()
+ children, err := parent.GetChildren(ctx)
if err != nil {
return err
}
@@ -1006,8 +1006,8 @@ func splitString(input string) string {
// IsParent goes through the layers in the store and checks if i.TopLayer is
// the parent of any other layer in store. Double check that image with that
// layer exists as well.
-func (i *Image) IsParent() (bool, error) {
- children, err := i.GetChildren()
+func (i *Image) IsParent(ctx context.Context) (bool, error) {
+ children, err := i.GetChildren(ctx)
if err != nil {
return false, err
}
@@ -1015,7 +1015,7 @@ func (i *Image) IsParent() (bool, error) {
}
// GetParent returns the image ID of the parent. Return nil if a parent is not found.
-func (i *Image) GetParent() (*Image, error) {
+func (i *Image) GetParent(ctx context.Context) (*Image, error) {
images, err := i.imageruntime.GetImages()
if err != nil {
return nil, err
@@ -1033,7 +1033,7 @@ func (i *Image) GetParent() (*Image, error) {
}
// GetChildren returns a list of the imageIDs that depend on the image
-func (i *Image) GetChildren() ([]string, error) {
+func (i *Image) GetChildren(ctx context.Context) ([]string, error) {
var children []string
images, err := i.imageruntime.GetImages()
if err != nil {