MCPcopy Create free account
hub / github.com/moby/moby / containerDiskUsageFromLegacyAPI

Function containerDiskUsageFromLegacyAPI

client/system_disk_usage.go:262–282  ·  view source on GitHub ↗
(du *legacyDiskUsage)

Source from the content-addressed store, hash-verified

260}
261
262func containerDiskUsageFromLegacyAPI(du *legacyDiskUsage) ContainersDiskUsage {
263 cdu := ContainersDiskUsage{
264 TotalCount: int64(len(du.Containers)),
265 Items: du.Containers,
266 }
267
268 var used int64
269 for _, c := range cdu.Items {
270 cdu.TotalSize += c.SizeRw
271 switch c.State {
272 case container.StateRunning, container.StatePaused, container.StateRestarting:
273 cdu.ActiveCount++
274 used += c.SizeRw
275 case container.StateCreated, container.StateRemoving, container.StateExited, container.StateDead:
276 // not active
277 }
278 }
279
280 cdu.Reclaimable = cdu.TotalSize - used
281 return cdu
282}
283
284func buildCacheDiskUsageFromLegacyAPI(du *legacyDiskUsage) BuildCacheDiskUsage {
285 bdu := BuildCacheDiskUsage{

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…