Skip to content

Add progress handler for rootfs unpacking#515

Open
DePasqualeOrg wants to merge 13 commits intoapple:mainfrom
DePasqualeOrg:unpacking-progress
Open

Add progress handler for rootfs unpacking#515
DePasqualeOrg wants to merge 13 commits intoapple:mainfrom
DePasqualeOrg:unpacking-progress

Conversation

@DePasqualeOrg
Copy link
Contributor

@DePasqualeOrg DePasqualeOrg commented Feb 4, 2026

I've added an optional progress handler for rootfs unpacking so that consumers can show progress. The Ubuntu image takes about 8 seconds to unpack on my machine, and I'm developing an app where it would be useful to show progress in the UI.

Total size is determined in an optional first pass that scans archive headers. Bytes written are then reported during unpacking. The optional first pass adds 15 (Alpine) to 115 (Ubuntu) ms to unpacking duration on my machine, depending on image size.

@DePasqualeOrg DePasqualeOrg marked this pull request as draft February 4, 2026 08:50
@DePasqualeOrg DePasqualeOrg marked this pull request as ready for review February 4, 2026 18:43
@jglogan jglogan self-requested a review February 9, 2026 17:14
@adityaramani adityaramani requested a review from dkovba March 8, 2026 07:58
Copy link
Contributor

@dkovba dkovba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution!

@dkovba dkovba requested a review from dcantah March 11, 2026 20:41
@dkovba
Copy link
Contributor

dkovba commented Mar 12, 2026

@DePasqualeOrg Please run make fmt to fix the PR check.

- Use Int for item counts
- Restore Task.checkCancellation() in layer resolution loop
- Use a single shared temp directory for layer archives in tests
- Replace force-unwrapped URL with a default value in timing tests
Copy link
Contributor

@dkovba dkovba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One final thing.

try Task.checkCancellation()
guard entry.path != nil else { continue }
totalItems += 1
if entry.fileType == .regular, let size = entry.size {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if entry.fileType == .regular, let size = entry.size {
if entry.fileType == .regular, entry.hardlink == nil, let size = entry.size {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems we don't emit add-size events for hard links, and shouldn't count them in the total size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants