Add delete target to image remove
Adds atomicity to image delete when deleting from a list. Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
@@ -58,6 +58,7 @@ type Image struct {
|
||||
// DeleteOptions provide options on image delete
|
||||
type DeleteOptions struct {
|
||||
Synchronous bool
|
||||
Target *ocispec.Descriptor
|
||||
}
|
||||
|
||||
// DeleteOpt allows configuring a delete operation
|
||||
@@ -72,6 +73,16 @@ func SynchronousDelete() DeleteOpt {
|
||||
}
|
||||
}
|
||||
|
||||
// DeleteTarget is used to specify the target value an image is expected
|
||||
// to have when deleting. If the image has a different target, then
|
||||
// NotFound is returned.
|
||||
func DeleteTarget(target *ocispec.Descriptor) DeleteOpt {
|
||||
return func(ctx context.Context, o *DeleteOptions) error {
|
||||
o.Target = target
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// Store and interact with images
|
||||
type Store interface {
|
||||
Get(ctx context.Context, name string) (Image, error)
|
||||
|
||||
Reference in New Issue
Block a user