All methods are singular; while pruning will impact multiple items,
it's more consistent to use singular for all operations.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -72,7 +72,7 @@ type ContainerAPIClient interface {
|
| 72 | 72 |
ContainerWait(ctx context.Context, container string, options ContainerWaitOptions) ContainerWaitResult |
| 73 | 73 |
CopyFromContainer(ctx context.Context, container string, options CopyFromContainerOptions) (CopyFromContainerResult, error) |
| 74 | 74 |
CopyToContainer(ctx context.Context, container string, options CopyToContainerOptions) (CopyToContainerResult, error) |
| 75 |
- ContainersPrune(ctx context.Context, opts ContainerPruneOptions) (ContainerPruneResult, error) |
|
| 75 |
+ ContainerPrune(ctx context.Context, opts ContainerPruneOptions) (ContainerPruneResult, error) |
|
| 76 | 76 |
} |
| 77 | 77 |
|
| 78 | 78 |
type ExecAPIClient interface {
|
| ... | ... |
@@ -101,7 +101,7 @@ type ImageAPIClient interface {
|
| 101 | 101 |
ImageRemove(ctx context.Context, image string, options ImageRemoveOptions) (ImageRemoveResult, error) |
| 102 | 102 |
ImageSearch(ctx context.Context, term string, options ImageSearchOptions) (ImageSearchResult, error) |
| 103 | 103 |
ImageTag(ctx context.Context, options ImageTagOptions) (ImageTagResult, error) |
| 104 |
- ImagesPrune(ctx context.Context, opts ImagePruneOptions) (ImagePruneResult, error) |
|
| 104 |
+ ImagePrune(ctx context.Context, opts ImagePruneOptions) (ImagePruneResult, error) |
|
| 105 | 105 |
|
| 106 | 106 |
ImageInspect(ctx context.Context, image string, _ ...ImageInspectOption) (ImageInspectResult, error) |
| 107 | 107 |
ImageHistory(ctx context.Context, image string, _ ...ImageHistoryOption) (ImageHistoryResult, error) |
| ... | ... |
@@ -117,7 +117,7 @@ type NetworkAPIClient interface {
|
| 117 | 117 |
NetworkInspect(ctx context.Context, network string, options NetworkInspectOptions) (NetworkInspectResult, error) |
| 118 | 118 |
NetworkList(ctx context.Context, options NetworkListOptions) (NetworkListResult, error) |
| 119 | 119 |
NetworkRemove(ctx context.Context, network string, options NetworkRemoveOptions) (NetworkRemoveResult, error) |
| 120 |
- NetworksPrune(ctx context.Context, opts NetworkPruneOptions) (NetworkPruneResult, error) |
|
| 120 |
+ NetworkPrune(ctx context.Context, opts NetworkPruneOptions) (NetworkPruneResult, error) |
|
| 121 | 121 |
} |
| 122 | 122 |
|
| 123 | 123 |
// NodeAPIClient defines API client methods for the nodes |
| ... | ... |
@@ -181,7 +181,7 @@ type VolumeAPIClient interface {
|
| 181 | 181 |
VolumeInspect(ctx context.Context, volumeID string, options VolumeInspectOptions) (VolumeInspectResult, error) |
| 182 | 182 |
VolumeList(ctx context.Context, options VolumeListOptions) (VolumeListResult, error) |
| 183 | 183 |
VolumeRemove(ctx context.Context, volumeID string, options VolumeRemoveOptions) (VolumeRemoveResult, error) |
| 184 |
- VolumesPrune(ctx context.Context, options VolumePruneOptions) (VolumePruneResult, error) |
|
| 184 |
+ VolumePrune(ctx context.Context, options VolumePruneOptions) (VolumePruneResult, error) |
|
| 185 | 185 |
VolumeUpdate(ctx context.Context, volumeID string, options VolumeUpdateOptions) (VolumeUpdateResult, error) |
| 186 | 186 |
} |
| 187 | 187 |
|
| ... | ... |
@@ -14,13 +14,13 @@ type ContainerPruneOptions struct {
|
| 14 | 14 |
Filters Filters |
| 15 | 15 |
} |
| 16 | 16 |
|
| 17 |
-// ContainerPruneResult holds the result from the [Client.ContainersPrune] method. |
|
| 17 |
+// ContainerPruneResult holds the result from the [Client.ContainerPrune] method. |
|
| 18 | 18 |
type ContainerPruneResult struct {
|
| 19 | 19 |
Report container.PruneReport |
| 20 | 20 |
} |
| 21 | 21 |
|
| 22 |
-// ContainersPrune requests the daemon to delete unused data |
|
| 23 |
-func (cli *Client) ContainersPrune(ctx context.Context, opts ContainerPruneOptions) (ContainerPruneResult, error) {
|
|
| 22 |
+// ContainerPrune requests the daemon to delete unused data |
|
| 23 |
+func (cli *Client) ContainerPrune(ctx context.Context, opts ContainerPruneOptions) (ContainerPruneResult, error) {
|
|
| 24 | 24 |
query := url.Values{}
|
| 25 | 25 |
opts.Filters.updateURLValues(query) |
| 26 | 26 |
|
| ... | ... |
@@ -11,15 +11,15 @@ import ( |
| 11 | 11 |
is "gotest.tools/v3/assert/cmp" |
| 12 | 12 |
) |
| 13 | 13 |
|
| 14 |
-func TestContainersPruneError(t *testing.T) {
|
|
| 14 |
+func TestContainerPruneError(t *testing.T) {
|
|
| 15 | 15 |
client, err := New(WithMockClient(errorMock(http.StatusInternalServerError, "Server error"))) |
| 16 | 16 |
assert.NilError(t, err) |
| 17 | 17 |
|
| 18 |
- _, err = client.ContainersPrune(context.Background(), ContainerPruneOptions{})
|
|
| 18 |
+ _, err = client.ContainerPrune(context.Background(), ContainerPruneOptions{})
|
|
| 19 | 19 |
assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal)) |
| 20 | 20 |
} |
| 21 | 21 |
|
| 22 |
-func TestContainersPrune(t *testing.T) {
|
|
| 22 |
+func TestContainerPrune(t *testing.T) {
|
|
| 23 | 23 |
const expectedURL = "/containers/prune" |
| 24 | 24 |
|
| 25 | 25 |
listCases := []struct {
|
| ... | ... |
@@ -89,7 +89,7 @@ func TestContainersPrune(t *testing.T) {
|
| 89 | 89 |
})) |
| 90 | 90 |
assert.NilError(t, err) |
| 91 | 91 |
|
| 92 |
- req, err := client.ContainersPrune(context.Background(), ContainerPruneOptions{Filters: listCase.filters})
|
|
| 92 |
+ req, err := client.ContainerPrune(context.Background(), ContainerPruneOptions{Filters: listCase.filters})
|
|
| 93 | 93 |
assert.NilError(t, err) |
| 94 | 94 |
assert.Check(t, is.Len(req.Report.ContainersDeleted, 2)) |
| 95 | 95 |
assert.Check(t, is.Equal(uint64(9999), req.Report.SpaceReclaimed)) |
| ... | ... |
@@ -14,13 +14,13 @@ type ImagePruneOptions struct {
|
| 14 | 14 |
Filters Filters |
| 15 | 15 |
} |
| 16 | 16 |
|
| 17 |
-// ImagePruneResult holds the result from the [Client.ImagesPrune] method. |
|
| 17 |
+// ImagePruneResult holds the result from the [Client.ImagePrune] method. |
|
| 18 | 18 |
type ImagePruneResult struct {
|
| 19 | 19 |
Report image.PruneReport |
| 20 | 20 |
} |
| 21 | 21 |
|
| 22 |
-// ImagesPrune requests the daemon to delete unused data |
|
| 23 |
-func (cli *Client) ImagesPrune(ctx context.Context, opts ImagePruneOptions) (ImagePruneResult, error) {
|
|
| 22 |
+// ImagePrune requests the daemon to delete unused data |
|
| 23 |
+func (cli *Client) ImagePrune(ctx context.Context, opts ImagePruneOptions) (ImagePruneResult, error) {
|
|
| 24 | 24 |
query := url.Values{}
|
| 25 | 25 |
opts.Filters.updateURLValues(query) |
| 26 | 26 |
|
| ... | ... |
@@ -12,15 +12,15 @@ import ( |
| 12 | 12 |
is "gotest.tools/v3/assert/cmp" |
| 13 | 13 |
) |
| 14 | 14 |
|
| 15 |
-func TestImagesPruneError(t *testing.T) {
|
|
| 15 |
+func TestImagePruneError(t *testing.T) {
|
|
| 16 | 16 |
client, err := New(WithMockClient(errorMock(http.StatusInternalServerError, "Server error"))) |
| 17 | 17 |
assert.NilError(t, err) |
| 18 | 18 |
|
| 19 |
- _, err = client.ImagesPrune(context.Background(), ImagePruneOptions{})
|
|
| 19 |
+ _, err = client.ImagePrune(context.Background(), ImagePruneOptions{})
|
|
| 20 | 20 |
assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal)) |
| 21 | 21 |
} |
| 22 | 22 |
|
| 23 |
-func TestImagesPrune(t *testing.T) {
|
|
| 23 |
+func TestImagePrune(t *testing.T) {
|
|
| 24 | 24 |
const expectedURL = "/images/prune" |
| 25 | 25 |
|
| 26 | 26 |
listCases := []struct {
|
| ... | ... |
@@ -83,7 +83,7 @@ func TestImagesPrune(t *testing.T) {
|
| 83 | 83 |
})) |
| 84 | 84 |
assert.NilError(t, err) |
| 85 | 85 |
|
| 86 |
- res, err := client.ImagesPrune(context.Background(), ImagePruneOptions{Filters: listCase.filters})
|
|
| 86 |
+ res, err := client.ImagePrune(context.Background(), ImagePruneOptions{Filters: listCase.filters})
|
|
| 87 | 87 |
assert.NilError(t, err) |
| 88 | 88 |
assert.Check(t, is.Len(res.Report.ImagesDeleted, 2)) |
| 89 | 89 |
assert.Check(t, is.Equal(uint64(9999), res.Report.SpaceReclaimed)) |
| ... | ... |
@@ -14,13 +14,13 @@ type NetworkPruneOptions struct {
|
| 14 | 14 |
Filters Filters |
| 15 | 15 |
} |
| 16 | 16 |
|
| 17 |
-// NetworkPruneResult holds the result from the [Client.NetworksPrune] method. |
|
| 17 |
+// NetworkPruneResult holds the result from the [Client.NetworkPrune] method. |
|
| 18 | 18 |
type NetworkPruneResult struct {
|
| 19 | 19 |
Report network.PruneReport |
| 20 | 20 |
} |
| 21 | 21 |
|
| 22 |
-// NetworksPrune requests the daemon to delete unused networks |
|
| 23 |
-func (cli *Client) NetworksPrune(ctx context.Context, opts NetworkPruneOptions) (NetworkPruneResult, error) {
|
|
| 22 |
+// NetworkPrune requests the daemon to delete unused networks |
|
| 23 |
+func (cli *Client) NetworkPrune(ctx context.Context, opts NetworkPruneOptions) (NetworkPruneResult, error) {
|
|
| 24 | 24 |
query := url.Values{}
|
| 25 | 25 |
opts.Filters.updateURLValues(query) |
| 26 | 26 |
|
| ... | ... |
@@ -11,17 +11,17 @@ import ( |
| 11 | 11 |
is "gotest.tools/v3/assert/cmp" |
| 12 | 12 |
) |
| 13 | 13 |
|
| 14 |
-func TestNetworksPruneError(t *testing.T) {
|
|
| 14 |
+func TestNetworkPruneError(t *testing.T) {
|
|
| 15 | 15 |
client, err := New( |
| 16 | 16 |
WithMockClient(errorMock(http.StatusInternalServerError, "Server error")), |
| 17 | 17 |
) |
| 18 | 18 |
assert.NilError(t, err) |
| 19 | 19 |
|
| 20 |
- _, err = client.NetworksPrune(context.Background(), NetworkPruneOptions{})
|
|
| 20 |
+ _, err = client.NetworkPrune(context.Background(), NetworkPruneOptions{})
|
|
| 21 | 21 |
assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal)) |
| 22 | 22 |
} |
| 23 | 23 |
|
| 24 |
-func TestNetworksPrune(t *testing.T) {
|
|
| 24 |
+func TestNetworkPrune(t *testing.T) {
|
|
| 25 | 25 |
const expectedURL = "/networks/prune" |
| 26 | 26 |
|
| 27 | 27 |
listCases := []struct {
|
| ... | ... |
@@ -82,7 +82,7 @@ func TestNetworksPrune(t *testing.T) {
|
| 82 | 82 |
) |
| 83 | 83 |
assert.NilError(t, err) |
| 84 | 84 |
|
| 85 |
- res, err := client.NetworksPrune(context.Background(), NetworkPruneOptions{Filters: listCase.filters})
|
|
| 85 |
+ res, err := client.NetworkPrune(context.Background(), NetworkPruneOptions{Filters: listCase.filters})
|
|
| 86 | 86 |
assert.NilError(t, err) |
| 87 | 87 |
assert.Check(t, is.Len(res.Report.NetworksDeleted, 2)) |
| 88 | 88 |
} |
| ... | ... |
@@ -20,13 +20,13 @@ type VolumePruneOptions struct {
|
| 20 | 20 |
Filters Filters |
| 21 | 21 |
} |
| 22 | 22 |
|
| 23 |
-// VolumePruneResult holds the result from the [Client.VolumesPrune] method. |
|
| 23 |
+// VolumePruneResult holds the result from the [Client.VolumePrune] method. |
|
| 24 | 24 |
type VolumePruneResult struct {
|
| 25 | 25 |
Report volume.PruneReport |
| 26 | 26 |
} |
| 27 | 27 |
|
| 28 |
-// VolumesPrune requests the daemon to delete unused data |
|
| 29 |
-func (cli *Client) VolumesPrune(ctx context.Context, options VolumePruneOptions) (VolumePruneResult, error) {
|
|
| 28 |
+// VolumePrune requests the daemon to delete unused data |
|
| 29 |
+func (cli *Client) VolumePrune(ctx context.Context, options VolumePruneOptions) (VolumePruneResult, error) {
|
|
| 30 | 30 |
if options.All {
|
| 31 | 31 |
if _, ok := options.Filters["all"]; ok {
|
| 32 | 32 |
return VolumePruneResult{}, errdefs.ErrInvalidArgument.WithMessage(`conflicting options: cannot specify both "all" and "all" filter`)
|
| ... | ... |
@@ -79,7 +79,7 @@ func TestVolumePrune(t *testing.T) {
|
| 79 | 79 |
})) |
| 80 | 80 |
assert.NilError(t, err) |
| 81 | 81 |
|
| 82 |
- _, err = client.VolumesPrune(t.Context(), tc.opts) |
|
| 82 |
+ _, err = client.VolumePrune(t.Context(), tc.opts) |
|
| 83 | 83 |
if tc.expectedError != "" {
|
| 84 | 84 |
assert.Check(t, is.ErrorType(err, errdefs.IsInvalidArgument)) |
| 85 | 85 |
assert.Check(t, is.Error(err, tc.expectedError)) |
| ... | ... |
@@ -33,8 +33,8 @@ var imagesAcceptedFilters = map[string]bool{
|
| 33 | 33 |
// one is in progress |
| 34 | 34 |
var errPruneRunning = errdefs.Conflict(errors.New("a prune operation is already running"))
|
| 35 | 35 |
|
| 36 |
-// ImagesPrune removes unused images |
|
| 37 |
-func (i *ImageService) ImagesPrune(ctx context.Context, fltrs filters.Args) (*image.PruneReport, error) {
|
|
| 36 |
+// ImagePrune removes unused images |
|
| 37 |
+func (i *ImageService) ImagePrune(ctx context.Context, fltrs filters.Args) (*image.PruneReport, error) {
|
|
| 38 | 38 |
if !i.pruneRunning.CompareAndSwap(false, true) {
|
| 39 | 39 |
return nil, errPruneRunning |
| 40 | 40 |
} |
| ... | ... |
@@ -36,7 +36,7 @@ type ImageService interface {
|
| 36 | 36 |
Images(ctx context.Context, opts imagebackend.ListOptions) ([]*imagetype.Summary, error) |
| 37 | 37 |
LogImageEvent(ctx context.Context, imageID, refName string, action events.Action) |
| 38 | 38 |
CountImages(ctx context.Context) int |
| 39 |
- ImagesPrune(ctx context.Context, pruneFilters filters.Args) (*imagetype.PruneReport, error) |
|
| 39 |
+ ImagePrune(ctx context.Context, pruneFilters filters.Args) (*imagetype.PruneReport, error) |
|
| 40 | 40 |
ImportImage(ctx context.Context, ref reference.Named, platform *ocispec.Platform, msg string, layerReader io.Reader, changes []string) (image.ID, error) |
| 41 | 41 |
TagImage(ctx context.Context, imageID image.ID, newTag reference.Named) error |
| 42 | 42 |
GetImage(ctx context.Context, refOrID string, options imagebackend.GetImageOpts) (*image.Image, error) |
| ... | ... |
@@ -31,8 +31,8 @@ var imagesAcceptedFilters = map[string]bool{
|
| 31 | 31 |
// one is in progress |
| 32 | 32 |
var errPruneRunning = errdefs.Conflict(errors.New("a prune operation is already running"))
|
| 33 | 33 |
|
| 34 |
-// ImagesPrune removes unused images |
|
| 35 |
-func (i *ImageService) ImagesPrune(ctx context.Context, pruneFilters filters.Args) (*imagetypes.PruneReport, error) {
|
|
| 34 |
+// ImagePrune removes unused images |
|
| 35 |
+func (i *ImageService) ImagePrune(ctx context.Context, pruneFilters filters.Args) (*imagetypes.PruneReport, error) {
|
|
| 36 | 36 |
if !i.pruneRunning.CompareAndSwap(false, true) {
|
| 37 | 37 |
return nil, errPruneRunning |
| 38 | 38 |
} |
| ... | ... |
@@ -148,7 +148,7 @@ deleteImagesLoop: |
| 148 | 148 |
} |
| 149 | 149 |
|
| 150 | 150 |
if canceled {
|
| 151 |
- log.G(ctx).Debugf("ImagesPrune operation cancelled: %#v", *rep)
|
|
| 151 |
+ log.G(ctx).Debugf("ImagePrune operation cancelled: %#v", *rep)
|
|
| 152 | 152 |
} |
| 153 | 153 |
i.eventsService.Log(events.ActionPrune, events.ImageEventType, events.Actor{
|
| 154 | 154 |
Attributes: map[string]string{
|
| ... | ... |
@@ -31,8 +31,8 @@ var ( |
| 31 | 31 |
} |
| 32 | 32 |
) |
| 33 | 33 |
|
| 34 |
-// ContainersPrune removes unused containers |
|
| 35 |
-func (daemon *Daemon) ContainersPrune(ctx context.Context, pruneFilters filters.Args) (*container.PruneReport, error) {
|
|
| 34 |
+// ContainerPrune removes unused containers |
|
| 35 |
+func (daemon *Daemon) ContainerPrune(ctx context.Context, pruneFilters filters.Args) (*container.PruneReport, error) {
|
|
| 36 | 36 |
if !daemon.pruneRunning.CompareAndSwap(false, true) {
|
| 37 | 37 |
return nil, errPruneRunning |
| 38 | 38 |
} |
| ... | ... |
@@ -56,7 +56,7 @@ func (daemon *Daemon) ContainersPrune(ctx context.Context, pruneFilters filters. |
| 56 | 56 |
for _, c := range allContainers {
|
| 57 | 57 |
select {
|
| 58 | 58 |
case <-ctx.Done(): |
| 59 |
- log.G(ctx).Debugf("ContainersPrune operation cancelled: %#v", *rep)
|
|
| 59 |
+ log.G(ctx).Debugf("ContainerPrune operation cancelled: %#v", *rep)
|
|
| 60 | 60 |
return rep, nil |
| 61 | 61 |
default: |
| 62 | 62 |
} |
| ... | ... |
@@ -90,8 +90,8 @@ func (daemon *Daemon) ContainersPrune(ctx context.Context, pruneFilters filters. |
| 90 | 90 |
return rep, nil |
| 91 | 91 |
} |
| 92 | 92 |
|
| 93 |
-// localNetworksPrune removes unused local networks |
|
| 94 |
-func (daemon *Daemon) localNetworksPrune(ctx context.Context, pruneFilters dnetwork.Filter) *network.PruneReport {
|
|
| 93 |
+// localNetworkPrune removes unused local networks |
|
| 94 |
+func (daemon *Daemon) localNetworkPrune(ctx context.Context, pruneFilters dnetwork.Filter) *network.PruneReport {
|
|
| 95 | 95 |
rep := &network.PruneReport{}
|
| 96 | 96 |
|
| 97 | 97 |
// When the function returns true, the walk will stop. |
| ... | ... |
@@ -126,8 +126,8 @@ func (daemon *Daemon) localNetworksPrune(ctx context.Context, pruneFilters dnetw |
| 126 | 126 |
|
| 127 | 127 |
var networkIsInUse = lazyregexp.New(`network ([[:alnum:]]+) is in use`) |
| 128 | 128 |
|
| 129 |
-// clusterNetworksPrune removes unused cluster networks |
|
| 130 |
-func (daemon *Daemon) clusterNetworksPrune(ctx context.Context, pruneFilters dnetwork.Filter) (*network.PruneReport, error) {
|
|
| 129 |
+// clusterNetworkPrune removes unused cluster networks |
|
| 130 |
+func (daemon *Daemon) clusterNetworkPrune(ctx context.Context, pruneFilters dnetwork.Filter) (*network.PruneReport, error) {
|
|
| 131 | 131 |
rep := &network.PruneReport{}
|
| 132 | 132 |
|
| 133 | 133 |
cluster := daemon.GetCluster() |
| ... | ... |
@@ -168,8 +168,8 @@ func (daemon *Daemon) clusterNetworksPrune(ctx context.Context, pruneFilters dne |
| 168 | 168 |
return rep, nil |
| 169 | 169 |
} |
| 170 | 170 |
|
| 171 |
-// NetworksPrune removes unused networks |
|
| 172 |
-func (daemon *Daemon) NetworksPrune(ctx context.Context, filterArgs filters.Args) (*network.PruneReport, error) {
|
|
| 171 |
+// NetworkPrune removes unused networks |
|
| 172 |
+func (daemon *Daemon) NetworkPrune(ctx context.Context, filterArgs filters.Args) (*network.PruneReport, error) {
|
|
| 173 | 173 |
if !daemon.pruneRunning.CompareAndSwap(false, true) {
|
| 174 | 174 |
return nil, errPruneRunning |
| 175 | 175 |
} |
| ... | ... |
@@ -181,16 +181,16 @@ func (daemon *Daemon) NetworksPrune(ctx context.Context, filterArgs filters.Args |
| 181 | 181 |
} |
| 182 | 182 |
|
| 183 | 183 |
rep := &network.PruneReport{}
|
| 184 |
- if clusterRep, err := daemon.clusterNetworksPrune(ctx, pruneFilters); err == nil {
|
|
| 184 |
+ if clusterRep, err := daemon.clusterNetworkPrune(ctx, pruneFilters); err == nil {
|
|
| 185 | 185 |
rep.NetworksDeleted = append(rep.NetworksDeleted, clusterRep.NetworksDeleted...) |
| 186 | 186 |
} |
| 187 | 187 |
|
| 188 |
- localRep := daemon.localNetworksPrune(ctx, pruneFilters) |
|
| 188 |
+ localRep := daemon.localNetworkPrune(ctx, pruneFilters) |
|
| 189 | 189 |
rep.NetworksDeleted = append(rep.NetworksDeleted, localRep.NetworksDeleted...) |
| 190 | 190 |
|
| 191 | 191 |
select {
|
| 192 | 192 |
case <-ctx.Done(): |
| 193 |
- log.G(ctx).Debugf("NetworksPrune operation cancelled: %#v", *rep)
|
|
| 193 |
+ log.G(ctx).Debugf("NetworkPrune operation cancelled: %#v", *rep)
|
|
| 194 | 194 |
return rep, nil |
| 195 | 195 |
default: |
| 196 | 196 |
} |
| ... | ... |
@@ -63,7 +63,7 @@ type attachBackend interface {
|
| 63 | 63 |
|
| 64 | 64 |
// systemBackend includes functions to implement to provide system wide containers functionality |
| 65 | 65 |
type systemBackend interface {
|
| 66 |
- ContainersPrune(ctx context.Context, pruneFilters filters.Args) (*container.PruneReport, error) |
|
| 66 |
+ ContainerPrune(ctx context.Context, pruneFilters filters.Args) (*container.PruneReport, error) |
|
| 67 | 67 |
} |
| 68 | 68 |
|
| 69 | 69 |
type commitBackend interface {
|
| ... | ... |
@@ -1160,7 +1160,7 @@ func (c *containerRouter) postContainersPrune(ctx context.Context, w http.Respon |
| 1160 | 1160 |
return err |
| 1161 | 1161 |
} |
| 1162 | 1162 |
|
| 1163 |
- pruneReport, err := c.backend.ContainersPrune(ctx, pruneFilters) |
|
| 1163 |
+ pruneReport, err := c.backend.ContainerPrune(ctx, pruneFilters) |
|
| 1164 | 1164 |
if err != nil {
|
| 1165 | 1165 |
return err |
| 1166 | 1166 |
} |
| ... | ... |
@@ -28,7 +28,7 @@ type imageBackend interface {
|
| 28 | 28 |
GetImage(ctx context.Context, refOrID string, options imagebackend.GetImageOpts) (*dockerimage.Image, error) |
| 29 | 29 |
ImageInspect(ctx context.Context, refOrID string, options imagebackend.ImageInspectOpts) (*imagebackend.InspectData, error) |
| 30 | 30 |
TagImage(ctx context.Context, id dockerimage.ID, newRef reference.Named) error |
| 31 |
- ImagesPrune(ctx context.Context, pruneFilters filters.Args) (*image.PruneReport, error) |
|
| 31 |
+ ImagePrune(ctx context.Context, pruneFilters filters.Args) (*image.PruneReport, error) |
|
| 32 | 32 |
} |
| 33 | 33 |
|
| 34 | 34 |
type importExportBackend interface {
|
| ... | ... |
@@ -630,7 +630,7 @@ func (ir *imageRouter) postImagesPrune(ctx context.Context, w http.ResponseWrite |
| 630 | 630 |
return err |
| 631 | 631 |
} |
| 632 | 632 |
|
| 633 |
- pruneReport, err := ir.backend.ImagesPrune(ctx, pruneFilters) |
|
| 633 |
+ pruneReport, err := ir.backend.ImagePrune(ctx, pruneFilters) |
|
| 634 | 634 |
if err != nil {
|
| 635 | 635 |
return err |
| 636 | 636 |
} |
| ... | ... |
@@ -18,7 +18,7 @@ type Backend interface {
|
| 18 | 18 |
ConnectContainerToNetwork(ctx context.Context, containerName, networkName string, endpointConfig *network.EndpointSettings) error |
| 19 | 19 |
DisconnectContainerFromNetwork(containerName string, networkName string, force bool) error |
| 20 | 20 |
DeleteNetwork(networkID string) error |
| 21 |
- NetworksPrune(ctx context.Context, pruneFilters filters.Args) (*network.PruneReport, error) |
|
| 21 |
+ NetworkPrune(ctx context.Context, pruneFilters filters.Args) (*network.PruneReport, error) |
|
| 22 | 22 |
} |
| 23 | 23 |
|
| 24 | 24 |
// ClusterBackend is all the methods that need to be implemented |
| ... | ... |
@@ -36,7 +36,7 @@ func (n *networkRouter) initRoutes() {
|
| 36 | 36 |
router.NewPostRoute("/networks/create", n.postNetworkCreate),
|
| 37 | 37 |
router.NewPostRoute("/networks/{id:.*}/connect", n.postNetworkConnect),
|
| 38 | 38 |
router.NewPostRoute("/networks/{id:.*}/disconnect", n.postNetworkDisconnect),
|
| 39 |
- router.NewPostRoute("/networks/prune", n.postNetworksPrune, router.WithMinimumAPIVersion("1.25")),
|
|
| 39 |
+ router.NewPostRoute("/networks/prune", n.postNetworkPrune, router.WithMinimumAPIVersion("1.25")),
|
|
| 40 | 40 |
// DELETE |
| 41 | 41 |
router.NewDeleteRoute("/networks/{id:.*}", n.deleteNetwork),
|
| 42 | 42 |
} |
| ... | ... |
@@ -334,7 +334,7 @@ func (n *networkRouter) deleteNetwork(ctx context.Context, w http.ResponseWriter |
| 334 | 334 |
return nil |
| 335 | 335 |
} |
| 336 | 336 |
|
| 337 |
-func (n *networkRouter) postNetworksPrune(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
|
| 337 |
+func (n *networkRouter) postNetworkPrune(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
|
| 338 | 338 |
if err := httputils.ParseForm(r); err != nil {
|
| 339 | 339 |
return err |
| 340 | 340 |
} |
| ... | ... |
@@ -344,7 +344,7 @@ func (n *networkRouter) postNetworksPrune(ctx context.Context, w http.ResponseWr |
| 344 | 344 |
return err |
| 345 | 345 |
} |
| 346 | 346 |
|
| 347 |
- pruneReport, err := n.backend.NetworksPrune(ctx, pruneFilters) |
|
| 347 |
+ pruneReport, err := n.backend.NetworkPrune(ctx, pruneFilters) |
|
| 348 | 348 |
if err != nil {
|
| 349 | 349 |
return err |
| 350 | 350 |
} |
| ... | ... |
@@ -38,7 +38,7 @@ func TestPruneDontDeleteUsedDangling(t *testing.T) {
|
| 38 | 38 |
container.WithImage(danglingID), |
| 39 | 39 |
container.WithCmd("sleep", "60"))
|
| 40 | 40 |
|
| 41 |
- res, err := apiClient.ImagesPrune(ctx, client.ImagePruneOptions{
|
|
| 41 |
+ res, err := apiClient.ImagePrune(ctx, client.ImagePruneOptions{
|
|
| 42 | 42 |
Filters: make(client.Filters).Add("dangling", "true"),
|
| 43 | 43 |
}) |
| 44 | 44 |
assert.NilError(t, err) |
| ... | ... |
@@ -87,7 +87,7 @@ func TestPruneLexographicalOrder(t *testing.T) {
|
| 87 | 87 |
cid := container.Create(ctx, t, apiClient, container.WithImage(id)) |
| 88 | 88 |
defer container.Remove(ctx, t, apiClient, cid, client.ContainerRemoveOptions{Force: true})
|
| 89 | 89 |
|
| 90 |
- res, err := apiClient.ImagesPrune(ctx, client.ImagePruneOptions{
|
|
| 90 |
+ res, err := apiClient.ImagePrune(ctx, client.ImagePruneOptions{
|
|
| 91 | 91 |
Filters: make(client.Filters).Add("dangling", "false"),
|
| 92 | 92 |
}) |
| 93 | 93 |
assert.NilError(t, err) |
| ... | ... |
@@ -219,7 +219,7 @@ func TestPruneDontDeleteUsedImage(t *testing.T) {
|
| 219 | 219 |
defer container.Remove(ctx, t, apiClient, cid, client.ContainerRemoveOptions{Force: true})
|
| 220 | 220 |
|
| 221 | 221 |
// dangling=false also prunes unused images |
| 222 |
- res, err := apiClient.ImagesPrune(ctx, client.ImagePruneOptions{
|
|
| 222 |
+ res, err := apiClient.ImagePrune(ctx, client.ImagePruneOptions{
|
|
| 223 | 223 |
Filters: make(client.Filters).Add("dangling", "false"),
|
| 224 | 224 |
}) |
| 225 | 225 |
assert.NilError(t, err) |
| ... | ... |
@@ -109,7 +109,7 @@ func TestAuthZPluginV2RejectVolumeRequests(t *testing.T) {
|
| 109 | 109 |
assert.Assert(t, err != nil) |
| 110 | 110 |
assert.ErrorContains(t, err, fmt.Sprintf("Error response from daemon: plugin %s failed with error:", authzPluginNameWithTag))
|
| 111 | 111 |
|
| 112 |
- _, err = c.VolumesPrune(ctx, client.VolumePruneOptions{})
|
|
| 112 |
+ _, err = c.VolumePrune(ctx, client.VolumePruneOptions{})
|
|
| 113 | 113 |
assert.Assert(t, err != nil) |
| 114 | 114 |
assert.ErrorContains(t, err, fmt.Sprintf("Error response from daemon: plugin %s failed with error:", authzPluginNameWithTag))
|
| 115 | 115 |
} |
| ... | ... |
@@ -273,7 +273,7 @@ func TestVolumePruneAnonymous(t *testing.T) {
|
| 273 | 273 |
namedV := created.Volume |
| 274 | 274 |
|
| 275 | 275 |
// Prune anonymous volumes |
| 276 |
- prune, err := apiClient.VolumesPrune(ctx, client.VolumePruneOptions{})
|
|
| 276 |
+ prune, err := apiClient.VolumePrune(ctx, client.VolumePruneOptions{})
|
|
| 277 | 277 |
assert.NilError(t, err) |
| 278 | 278 |
report := prune.Report |
| 279 | 279 |
assert.Check(t, is.Equal(len(report.VolumesDeleted), 1)) |
| ... | ... |
@@ -285,7 +285,7 @@ func TestVolumePruneAnonymous(t *testing.T) {
|
| 285 | 285 |
// Prune all volumes |
| 286 | 286 |
_, err = apiClient.VolumeCreate(ctx, client.VolumeCreateOptions{})
|
| 287 | 287 |
assert.NilError(t, err) |
| 288 |
- prune, err = apiClient.VolumesPrune(ctx, client.VolumePruneOptions{
|
|
| 288 |
+ prune, err = apiClient.VolumePrune(ctx, client.VolumePruneOptions{
|
|
| 289 | 289 |
All: true, |
| 290 | 290 |
}) |
| 291 | 291 |
assert.NilError(t, err) |
| ... | ... |
@@ -297,7 +297,7 @@ func TestVolumePruneAnonymous(t *testing.T) {
|
| 297 | 297 |
_, err = apiClient.VolumeCreate(ctx, client.VolumeCreateOptions{Name: "test"})
|
| 298 | 298 |
assert.NilError(t, err) |
| 299 | 299 |
|
| 300 |
- prune, err = apiClient.VolumesPrune(ctx, client.VolumePruneOptions{
|
|
| 300 |
+ prune, err = apiClient.VolumePrune(ctx, client.VolumePruneOptions{
|
|
| 301 | 301 |
All: true, |
| 302 | 302 |
}) |
| 303 | 303 |
|
| ... | ... |
@@ -318,7 +318,7 @@ func TestVolumePruneAnonymous(t *testing.T) {
|
| 318 | 318 |
assert.NilError(t, err) |
| 319 | 319 |
namedV = created.Volume |
| 320 | 320 |
|
| 321 |
- prune, err = clientOld.VolumesPrune(ctx, client.VolumePruneOptions{})
|
|
| 321 |
+ prune, err = clientOld.VolumePrune(ctx, client.VolumePruneOptions{})
|
|
| 322 | 322 |
assert.NilError(t, err) |
| 323 | 323 |
report = prune.Report |
| 324 | 324 |
assert.Check(t, is.Equal(len(report.VolumesDeleted), 2)) |
| ... | ... |
@@ -354,7 +354,7 @@ VOLUME ` + volDest |
| 354 | 354 |
_, err = apiClient.ContainerRemove(ctx, id, client.ContainerRemoveOptions{})
|
| 355 | 355 |
assert.NilError(t, err) |
| 356 | 356 |
|
| 357 |
- res, err := apiClient.VolumesPrune(ctx, client.VolumePruneOptions{})
|
|
| 357 |
+ res, err := apiClient.VolumePrune(ctx, client.VolumePruneOptions{})
|
|
| 358 | 358 |
assert.NilError(t, err) |
| 359 | 359 |
assert.Assert(t, is.Contains(res.Report.VolumesDeleted, volumeName)) |
| 360 | 360 |
} |
| ... | ... |
@@ -72,7 +72,7 @@ type ContainerAPIClient interface {
|
| 72 | 72 |
ContainerWait(ctx context.Context, container string, options ContainerWaitOptions) ContainerWaitResult |
| 73 | 73 |
CopyFromContainer(ctx context.Context, container string, options CopyFromContainerOptions) (CopyFromContainerResult, error) |
| 74 | 74 |
CopyToContainer(ctx context.Context, container string, options CopyToContainerOptions) (CopyToContainerResult, error) |
| 75 |
- ContainersPrune(ctx context.Context, opts ContainerPruneOptions) (ContainerPruneResult, error) |
|
| 75 |
+ ContainerPrune(ctx context.Context, opts ContainerPruneOptions) (ContainerPruneResult, error) |
|
| 76 | 76 |
} |
| 77 | 77 |
|
| 78 | 78 |
type ExecAPIClient interface {
|
| ... | ... |
@@ -101,7 +101,7 @@ type ImageAPIClient interface {
|
| 101 | 101 |
ImageRemove(ctx context.Context, image string, options ImageRemoveOptions) (ImageRemoveResult, error) |
| 102 | 102 |
ImageSearch(ctx context.Context, term string, options ImageSearchOptions) (ImageSearchResult, error) |
| 103 | 103 |
ImageTag(ctx context.Context, options ImageTagOptions) (ImageTagResult, error) |
| 104 |
- ImagesPrune(ctx context.Context, opts ImagePruneOptions) (ImagePruneResult, error) |
|
| 104 |
+ ImagePrune(ctx context.Context, opts ImagePruneOptions) (ImagePruneResult, error) |
|
| 105 | 105 |
|
| 106 | 106 |
ImageInspect(ctx context.Context, image string, _ ...ImageInspectOption) (ImageInspectResult, error) |
| 107 | 107 |
ImageHistory(ctx context.Context, image string, _ ...ImageHistoryOption) (ImageHistoryResult, error) |
| ... | ... |
@@ -117,7 +117,7 @@ type NetworkAPIClient interface {
|
| 117 | 117 |
NetworkInspect(ctx context.Context, network string, options NetworkInspectOptions) (NetworkInspectResult, error) |
| 118 | 118 |
NetworkList(ctx context.Context, options NetworkListOptions) (NetworkListResult, error) |
| 119 | 119 |
NetworkRemove(ctx context.Context, network string, options NetworkRemoveOptions) (NetworkRemoveResult, error) |
| 120 |
- NetworksPrune(ctx context.Context, opts NetworkPruneOptions) (NetworkPruneResult, error) |
|
| 120 |
+ NetworkPrune(ctx context.Context, opts NetworkPruneOptions) (NetworkPruneResult, error) |
|
| 121 | 121 |
} |
| 122 | 122 |
|
| 123 | 123 |
// NodeAPIClient defines API client methods for the nodes |
| ... | ... |
@@ -181,7 +181,7 @@ type VolumeAPIClient interface {
|
| 181 | 181 |
VolumeInspect(ctx context.Context, volumeID string, options VolumeInspectOptions) (VolumeInspectResult, error) |
| 182 | 182 |
VolumeList(ctx context.Context, options VolumeListOptions) (VolumeListResult, error) |
| 183 | 183 |
VolumeRemove(ctx context.Context, volumeID string, options VolumeRemoveOptions) (VolumeRemoveResult, error) |
| 184 |
- VolumesPrune(ctx context.Context, options VolumePruneOptions) (VolumePruneResult, error) |
|
| 184 |
+ VolumePrune(ctx context.Context, options VolumePruneOptions) (VolumePruneResult, error) |
|
| 185 | 185 |
VolumeUpdate(ctx context.Context, volumeID string, options VolumeUpdateOptions) (VolumeUpdateResult, error) |
| 186 | 186 |
} |
| 187 | 187 |
|
| ... | ... |
@@ -14,13 +14,13 @@ type ContainerPruneOptions struct {
|
| 14 | 14 |
Filters Filters |
| 15 | 15 |
} |
| 16 | 16 |
|
| 17 |
-// ContainerPruneResult holds the result from the [Client.ContainersPrune] method. |
|
| 17 |
+// ContainerPruneResult holds the result from the [Client.ContainerPrune] method. |
|
| 18 | 18 |
type ContainerPruneResult struct {
|
| 19 | 19 |
Report container.PruneReport |
| 20 | 20 |
} |
| 21 | 21 |
|
| 22 |
-// ContainersPrune requests the daemon to delete unused data |
|
| 23 |
-func (cli *Client) ContainersPrune(ctx context.Context, opts ContainerPruneOptions) (ContainerPruneResult, error) {
|
|
| 22 |
+// ContainerPrune requests the daemon to delete unused data |
|
| 23 |
+func (cli *Client) ContainerPrune(ctx context.Context, opts ContainerPruneOptions) (ContainerPruneResult, error) {
|
|
| 24 | 24 |
query := url.Values{}
|
| 25 | 25 |
opts.Filters.updateURLValues(query) |
| 26 | 26 |
|
| ... | ... |
@@ -14,13 +14,13 @@ type ImagePruneOptions struct {
|
| 14 | 14 |
Filters Filters |
| 15 | 15 |
} |
| 16 | 16 |
|
| 17 |
-// ImagePruneResult holds the result from the [Client.ImagesPrune] method. |
|
| 17 |
+// ImagePruneResult holds the result from the [Client.ImagePrune] method. |
|
| 18 | 18 |
type ImagePruneResult struct {
|
| 19 | 19 |
Report image.PruneReport |
| 20 | 20 |
} |
| 21 | 21 |
|
| 22 |
-// ImagesPrune requests the daemon to delete unused data |
|
| 23 |
-func (cli *Client) ImagesPrune(ctx context.Context, opts ImagePruneOptions) (ImagePruneResult, error) {
|
|
| 22 |
+// ImagePrune requests the daemon to delete unused data |
|
| 23 |
+func (cli *Client) ImagePrune(ctx context.Context, opts ImagePruneOptions) (ImagePruneResult, error) {
|
|
| 24 | 24 |
query := url.Values{}
|
| 25 | 25 |
opts.Filters.updateURLValues(query) |
| 26 | 26 |
|
| ... | ... |
@@ -14,13 +14,13 @@ type NetworkPruneOptions struct {
|
| 14 | 14 |
Filters Filters |
| 15 | 15 |
} |
| 16 | 16 |
|
| 17 |
-// NetworkPruneResult holds the result from the [Client.NetworksPrune] method. |
|
| 17 |
+// NetworkPruneResult holds the result from the [Client.NetworkPrune] method. |
|
| 18 | 18 |
type NetworkPruneResult struct {
|
| 19 | 19 |
Report network.PruneReport |
| 20 | 20 |
} |
| 21 | 21 |
|
| 22 |
-// NetworksPrune requests the daemon to delete unused networks |
|
| 23 |
-func (cli *Client) NetworksPrune(ctx context.Context, opts NetworkPruneOptions) (NetworkPruneResult, error) {
|
|
| 22 |
+// NetworkPrune requests the daemon to delete unused networks |
|
| 23 |
+func (cli *Client) NetworkPrune(ctx context.Context, opts NetworkPruneOptions) (NetworkPruneResult, error) {
|
|
| 24 | 24 |
query := url.Values{}
|
| 25 | 25 |
opts.Filters.updateURLValues(query) |
| 26 | 26 |
|
| ... | ... |
@@ -20,13 +20,13 @@ type VolumePruneOptions struct {
|
| 20 | 20 |
Filters Filters |
| 21 | 21 |
} |
| 22 | 22 |
|
| 23 |
-// VolumePruneResult holds the result from the [Client.VolumesPrune] method. |
|
| 23 |
+// VolumePruneResult holds the result from the [Client.VolumePrune] method. |
|
| 24 | 24 |
type VolumePruneResult struct {
|
| 25 | 25 |
Report volume.PruneReport |
| 26 | 26 |
} |
| 27 | 27 |
|
| 28 |
-// VolumesPrune requests the daemon to delete unused data |
|
| 29 |
-func (cli *Client) VolumesPrune(ctx context.Context, options VolumePruneOptions) (VolumePruneResult, error) {
|
|
| 28 |
+// VolumePrune requests the daemon to delete unused data |
|
| 29 |
+func (cli *Client) VolumePrune(ctx context.Context, options VolumePruneOptions) (VolumePruneResult, error) {
|
|
| 30 | 30 |
if options.All {
|
| 31 | 31 |
if _, ok := options.Filters["all"]; ok {
|
| 32 | 32 |
return VolumePruneResult{}, errdefs.ErrInvalidArgument.WithMessage(`conflicting options: cannot specify both "all" and "all" filter`)
|