Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StorageUsage ¶
type StorageUsage struct {
// RootDir is the path used to determine disk capacity (always dockerDataPath).
RootDir string
// DockerBytes is the total bytes consumed by Docker artifacts:
// images, container writable layers, volumes, and build cache.
// This is NOT total disk used — other processes on the same disk are excluded.
// See sumDockerBytes for the exact accounting.
DockerBytes uint64
// ImageBytes is the deduplicated image layer data (LayersSize from docker system df).
ImageBytes uint64
// ContainerBytes is the sum of writable-layer sizes across all containers (SizeRw).
// Image layers are excluded to avoid double-counting with ImageBytes.
ContainerBytes uint64
// VolumeBytes is the sum of known volume sizes. Volumes with unknown sizes
// (e.g. non-local drivers) are excluded.
VolumeBytes uint64
// BuildCacheBytes is the sum of all build cache entry sizes.
BuildCacheBytes uint64
// TotalBytes is the total capacity of the partition hosting the Docker data directory.
TotalBytes uint64
// AvailableBytes is the bytes available to unprivileged processes on that partition.
// Total non-Docker disk used = TotalBytes - AvailableBytes - DockerBytes.
AvailableBytes uint64
}
StorageUsage is a point-in-time view of Docker storage relative to the disk that backs the Docker data directory.
func GetDockerStorageUsage ¶
func GetDockerStorageUsage(ctx context.Context, newClient agentdocker.CleanupClientFactory) (StorageUsage, error)
GetDockerStorageUsage returns a StorageUsage snapshot combining:
- disk capacity from statfs on dockerDataPath (always bind-mounted in standard deployments)
- Docker's own byte accounting via "docker system df" (through the Docker socket)
func GetDockerStorageUsageForPath ¶
func GetDockerStorageUsageForPath(ctx context.Context, newClient agentdocker.CleanupClientFactory, diskPath string) (StorageUsage, error)
GetDockerStorageUsageForPath is like GetDockerStorageUsage but scopes disk metrics to the filesystem containing diskPath instead of the default SystemVolumePath. It is used by the HTTP handler so the disk path can be overridden in tests.
Click to show internal directories.
Click to hide internal directories.