Repository: moby/moby
File: api/types/types.go (Go)

Code before:
	ImageObject DiskUsageObject = "image"
	// VolumeObject represents a volume DiskUsageObject.
	VolumeObject DiskUsageObject = "volume"
	// BuildCacheObject represents a build-cache DiskUsageObject.
	BuildCacheObject DiskUsageObject = "build-cache"
)

// DiskUsageOptions holds parameters for system disk usage query.
type DiskUsageOptions struct {
	// Types specifies what object types to include in the response. If empty,
	// all object types are returned.
	Types []DiskUsageObject
}

// DiskUsage contains response of Engine API:
// GET "/system/df"
type DiskUsage struct {
	Images     *ImageDiskUsage
	Containers *ContainerDiskUsage
	Volumes    *VolumeDiskUsage
	BuildCache *BuildCacheDiskUsage
}

// ImageDiskUsage contains the image disk usage information.
type ImageDiskUsage struct {
	TotalSize   int64
	Reclaimable int64
	Items       []*image.Summary
}

// ContainerDiskUsage contains the container disk usage information.
type ContainerDiskUsage struct {
	TotalSize   int64
	Reclaimable int64
	Items       []*container.Summary
}

// VolumeDiskUsage contains the container disk usage information.
type VolumeDiskUsage struct {
	TotalSize   int64
	Reclaimable int64
	Items       []*volume.Volume
}

// BuildCacheDiskUsage contains the build cache disk usage information.
type BuildCacheDiskUsage struct {
	TotalSize   int64
	Reclaimable int64
	Items       []*BuildCache
}


Review comment (suggestion):
I probably need to checkout this branch locally, but would it be possible to put the types in the relevant sub-packages (containers, images, ...)

We've been trying to scope these types to relevant types, because the top-level `types/` packages became a grab-bag of everything, also enforcing (indirect) imports in places where it was less than desirable.

We could have those packages imported in `system/` for use in `docker system du` , but also consider that we may have similar commands at some point for individual object-types (`docker container du` or similar), to go along with `docker container prune`.

Code after:
	// VolumeObject represents a volume DiskUsageObject.
	VolumeObject DiskUsageObject = "volume"
	// BuildCacheObject represents a build-cache DiskUsageObject.
	BuildCacheObject DiskUsageObject = "build-cache"
)

// DiskUsageOptions holds parameters for system disk usage query.
type DiskUsageOptions struct {
	// Types specifies what object types to include in the response. If empty,
	// all object types are returned.
	Types []DiskUsageObject
}

// DiskUsage contains response of Engine API:
// GET "/system/df"
type DiskUsage struct {
	LayersSize  int64
	Images      []*image.Summary
	Containers  []*container.Summary
	Volumes     []*volume.Volume
	BuildCache  []*BuildCache
	BuilderSize int64 `json:",omitempty"` // Deprecated: deprecated in API 1.38, and no longer used since API 1.40.
}

// BuildCachePruneReport contains the response for Engine API:
// POST "/build/prune"
type BuildCachePruneReport struct {
	CachesDeleted  []string
	SpaceReclaimed uint64
}

// SecretCreateResponse contains the information returned to a client
// on the creation of a new secret.
type SecretCreateResponse struct {
	// ID is the id of the created secret.
	ID string
}

// SecretListOptions holds parameters to list secrets
type SecretListOptions struct {
	Filters filters.Args
}

// ConfigCreateResponse contains the information returned to a client
// on the creation of a new config.
type ConfigCreateResponse struct {
	// ID is the id of the created config.
	ID string
}

// ConfigListOptions holds parameters to list configs