Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
| ... | ... |
@@ -38,7 +38,6 @@ import ( |
| 38 | 38 |
networktypes "github.com/moby/moby/api/types/network" |
| 39 | 39 |
registrytypes "github.com/moby/moby/api/types/registry" |
| 40 | 40 |
"github.com/moby/moby/api/types/swarm" |
| 41 |
- volumetypes "github.com/moby/moby/api/types/volume" |
|
| 42 | 41 |
"github.com/moby/sys/user" |
| 43 | 42 |
"github.com/moby/sys/userns" |
| 44 | 43 |
"github.com/pkg/errors" |
| ... | ... |
@@ -136,7 +135,7 @@ type Daemon struct {
|
| 136 | 136 |
|
| 137 | 137 |
usageContainers singleflight.Group[struct{}, *backend.ContainerDiskUsage]
|
| 138 | 138 |
usageImages singleflight.Group[struct{}, []*imagetypes.Summary]
|
| 139 |
- usageVolumes singleflight.Group[struct{}, *volumetypes.DiskUsage]
|
|
| 139 |
+ usageVolumes singleflight.Group[struct{}, *backend.VolumeDiskUsage]
|
|
| 140 | 140 |
usageLayer singleflight.Group[struct{}, int64]
|
| 141 | 141 |
|
| 142 | 142 |
pruneRunning atomic.Bool |
| ... | ... |
@@ -7,7 +7,6 @@ import ( |
| 7 | 7 |
"github.com/moby/moby/api/types/container" |
| 8 | 8 |
"github.com/moby/moby/api/types/filters" |
| 9 | 9 |
"github.com/moby/moby/api/types/image" |
| 10 |
- "github.com/moby/moby/api/types/volume" |
|
| 11 | 10 |
"github.com/moby/moby/v2/daemon/server/backend" |
| 12 | 11 |
"github.com/pkg/errors" |
| 13 | 12 |
"golang.org/x/sync/errgroup" |
| ... | ... |
@@ -70,14 +69,14 @@ func (daemon *Daemon) imageDiskUsage(ctx context.Context) ([]*image.Summary, err |
| 70 | 70 |
|
| 71 | 71 |
// localVolumesSize obtains information about volume disk usage from volumes service |
| 72 | 72 |
// and makes sure that only one size calculation is performed at the same time. |
| 73 |
-func (daemon *Daemon) localVolumesSize(ctx context.Context) (*volume.DiskUsage, error) {
|
|
| 74 |
- volumes, _, err := daemon.usageVolumes.Do(ctx, struct{}{}, func(ctx context.Context) (*volume.DiskUsage, error) {
|
|
| 73 |
+func (daemon *Daemon) localVolumesSize(ctx context.Context) (*backend.VolumeDiskUsage, error) {
|
|
| 74 |
+ volumes, _, err := daemon.usageVolumes.Do(ctx, struct{}{}, func(ctx context.Context) (*backend.VolumeDiskUsage, error) {
|
|
| 75 | 75 |
volumes, err := daemon.volumes.LocalVolumesSize(ctx) |
| 76 | 76 |
if err != nil {
|
| 77 | 77 |
return nil, err |
| 78 | 78 |
} |
| 79 | 79 |
|
| 80 |
- du := &volume.DiskUsage{Items: volumes}
|
|
| 80 |
+ du := &backend.VolumeDiskUsage{Items: volumes}
|
|
| 81 | 81 |
for _, v := range du.Items {
|
| 82 | 82 |
if v.UsageData.Size != -1 {
|
| 83 | 83 |
if v.UsageData.RefCount == 0 {
|
| ... | ... |
@@ -24,7 +24,7 @@ type DiskUsageOptions struct {
|
| 24 | 24 |
type DiskUsage struct {
|
| 25 | 25 |
Images *ImageDiskUsage |
| 26 | 26 |
Containers *ContainerDiskUsage |
| 27 |
- Volumes *volume.DiskUsage |
|
| 27 |
+ Volumes *VolumeDiskUsage |
|
| 28 | 28 |
BuildCache *BuildCacheDiskUsage |
| 29 | 29 |
} |
| 30 | 30 |
|
| ... | ... |
@@ -48,3 +48,10 @@ type ImageDiskUsage struct {
|
| 48 | 48 |
Reclaimable int64 |
| 49 | 49 |
Items []*image.Summary |
| 50 | 50 |
} |
| 51 |
+ |
|
| 52 |
+// VolumeDiskUsage contains disk usage for volumes. |
|
| 53 |
+type VolumeDiskUsage struct {
|
|
| 54 |
+ TotalSize int64 |
|
| 55 |
+ Reclaimable int64 |
|
| 56 |
+ Items []*volume.Volume |
|
| 57 |
+} |