-
Notifications
You must be signed in to change notification settings - Fork 600
feat(transport): add resumable transport for remote resources #2152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
pkg/v1/remote/transport/resumable.go
Outdated
| 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 | ||
| } |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(reopening)
|
Thank you for the contribution! I am going to get another person familiar with Docker on our team to look at this change. |
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