Skip to content

Commit f3dbd64

Browse files
committed
give the tuple field names and rename size to sizeInBytes
1 parent 009e932 commit f3dbd64

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

Sources/ContainerClient/Core/ClientImage.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ extension ClientImage {
296296
/// Calculate disk usage for images
297297
/// - Parameter activeReferences: Set of image references currently in use by containers
298298
/// - Returns: Tuple of (total count, active count, total size, reclaimable size)
299-
public static func calculateDiskUsage(activeReferences: Set<String>) async throws -> (Int, Int, UInt64, UInt64) {
299+
public static func calculateDiskUsage(activeReferences: Set<String>) async throws -> (totalCount: Int, activeCount: Int, totalSize: UInt64, reclaimableSize: UInt64) {
300300
let client = newXPCClient()
301301
let request = newRequest(.imageDiskUsage)
302302

@@ -310,7 +310,7 @@ extension ClientImage {
310310
let size = response.uint64(key: .imageSize)
311311
let reclaimable = response.uint64(key: .reclaimableSize)
312312

313-
return (total, active, size, reclaimable)
313+
return (totalCount: total, activeCount: active, totalSize: size, reclaimableSize: reclaimable)
314314
}
315315

316316
public static func fetch(reference: String, platform: Platform? = nil, scheme: RequestScheme = .auto, progressUpdate: ProgressUpdateHandler? = nil) async throws -> ClientImage

Sources/ContainerClient/Core/DiskUsage.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ public struct ResourceUsage: Sendable, Codable {
4343
public var active: Int
4444

4545
/// Total size in bytes
46-
public var size: UInt64
46+
public var sizeInBytes: UInt64
4747

4848
/// Reclaimable size in bytes (from unused/inactive resources)
4949
public var reclaimable: UInt64
5050

51-
public init(total: Int, active: Int, size: UInt64, reclaimable: UInt64) {
51+
public init(total: Int, active: Int, sizeInBytes: UInt64, reclaimable: UInt64) {
5252
self.total = total
5353
self.active = active
54-
self.size = size
54+
self.sizeInBytes = sizeInBytes
5555
self.reclaimable = reclaimable
5656
}
5757
}

Sources/ContainerCommands/System/SystemDF.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,26 +65,26 @@ extension Application {
6565
"Images",
6666
"\(stats.images.total)",
6767
"\(stats.images.active)",
68-
formatSize(stats.images.size),
69-
formatReclaimable(stats.images.reclaimable, total: stats.images.size),
68+
formatSize(stats.images.sizeInBytes),
69+
formatReclaimable(stats.images.reclaimable, total: stats.images.sizeInBytes),
7070
])
7171

7272
// Containers row
7373
rows.append([
7474
"Containers",
7575
"\(stats.containers.total)",
7676
"\(stats.containers.active)",
77-
formatSize(stats.containers.size),
78-
formatReclaimable(stats.containers.reclaimable, total: stats.containers.size),
77+
formatSize(stats.containers.sizeInBytes),
78+
formatReclaimable(stats.containers.reclaimable, total: stats.containers.sizeInBytes),
7979
])
8080

8181
// Volumes row
8282
rows.append([
8383
"Local Volumes",
8484
"\(stats.volumes.total)",
8585
"\(stats.volumes.active)",
86-
formatSize(stats.volumes.size),
87-
formatReclaimable(stats.volumes.reclaimable, total: stats.volumes.size),
86+
formatSize(stats.volumes.sizeInBytes),
87+
formatReclaimable(stats.volumes.reclaimable, total: stats.volumes.sizeInBytes),
8888
])
8989

9090
let tableFormatter = TableOutput(rows: rows)

Sources/Services/ContainerAPIService/DiskUsage/DiskUsageService.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,29 +49,29 @@ public actor DiskUsageService {
4949

5050
let stats = DiskUsageStats(
5151
images: ResourceUsage(
52-
total: imageData.0,
53-
active: imageData.1,
54-
size: imageData.2,
55-
reclaimable: imageData.3
52+
total: imageData.totalCount,
53+
active: imageData.activeCount,
54+
sizeInBytes: imageData.totalSize,
55+
reclaimable: imageData.reclaimableSize
5656
),
5757
containers: ResourceUsage(
5858
total: containerData.0,
5959
active: containerData.1,
60-
size: containerData.2,
60+
sizeInBytes: containerData.2,
6161
reclaimable: containerData.3
6262
),
6363
volumes: ResourceUsage(
6464
total: volumeData.0,
6565
active: volumeData.1,
66-
size: volumeData.2,
66+
sizeInBytes: volumeData.2,
6767
reclaimable: volumeData.3
6868
)
6969
)
7070

7171
log.debug(
7272
"disk usage calculation complete",
7373
metadata: [
74-
"images_total": "\(imageData.0)",
74+
"images_total": "\(imageData.totalCount)",
7575
"containers_total": "\(containerData.0)",
7676
"volumes_total": "\(volumeData.0)",
7777
])

0 commit comments

Comments
 (0)