Skip to content

Conversation

@derekhjray
Copy link
Contributor

Add resumable transport support for pulling images from registry, which is useful for huge image pulling operation, and avoid downloading all image/layer data again when error hanpens

Comment on lines 95 to 115
resume:
if n, err = rb.rc.Read(p); n > 0 {
rb.transferred += int64(n)
}

if err == nil {
return
}

if errors.Is(err, io.EOF) && rb.total >= 0 && rb.transferred == rb.total {
return
}

if err = rb.resume(err); err == nil {
if n == 0 {
// zero bytes read, try reading again with new response.Body
goto resume
}

// already read some bytes from previous response.Body, returns and waits for next Read operation
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please avoid labels and express this as a loop.

Copy link
Contributor

Choose a reason for hiding this comment

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

My bad, I'm not familiar with Github's systems. I'll raise this in a review.

Copy link
Contributor

Choose a reason for hiding this comment

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

(reopening)

@Subserial
Copy link
Contributor

Thank you for the contribution! I am going to get another person familiar with Docker on our team to look at this change.

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