Skip to content

Commit

Permalink
Print total size of compressed layers (#60)
Browse files Browse the repository at this point in the history
Before pulling an image.
  • Loading branch information
fkorotkov authored May 10, 2022
1 parent 4ebec53 commit 24375c2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Sources/tart/VMDirectory+OCI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ extension VMDirectory {
}

// Progress
defaultLogger.appendNewLine("pulling disk...")
let progress = Progress(totalUnitCount: Int64(diskLayers.map{ $0.size }.reduce(0) { $0 + $1 }))
let diskCompressedSize: Int64 = Int64(diskLayers.map {$0.size}.reduce(0) {$0 + $1})
let prettyDiskSize = String(format: "%.1f", Double(diskCompressedSize) / 1_000_000_000.0)
defaultLogger.appendNewLine("pulling disk (\(prettyDiskSize) GB compressed)...")
let progress = Progress(totalUnitCount: diskCompressedSize)
ProgressObserver(progress).log(defaultLogger)

for diskLayer in diskLayers {
Expand Down

0 comments on commit 24375c2

Please sign in to comment.