-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
c8d/list: Fix Total
size calculation
#48330
Conversation
// readConfig reads content pointed by the descriptor and unmarshals it into a specified output. | ||
func readConfig(ctx context.Context, store content.Provider, desc ocispec.Descriptor, out interface{}) error { | ||
// readJSON reads content pointed by the descriptor and unmarshals it into a specified output. | ||
func readJSON(ctx context.Context, store content.Provider, desc ocispec.Descriptor, out interface{}) error { |
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.
Perhaps it could be extracted to the github.com/containerd/containerd/content
package.
There's already content.ReadBlob
, so I guess it could be named content.ReadJSONBlob
.
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.
Ah, except our version also translates the cerrdefs.NotFound
into errdefs.NotFound
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.
Ah, except our version also translates the cerrdefs.NotFound into errdefs.NotFound
That problem should probably go away at some point; at least, Derek is working on unifying errdefs to make them interoperable.
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
578ec00
to
6bb6bef
Compare
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.
LGTM
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.
LGTM
left one question, but good to go if that's not a concern
|
||
// contentSize was already added to total, adjust it by the difference | ||
// between the newly calculated size and the old size. | ||
d := imgContentSize - contentSize |
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.
Any risk of contentSize
being larger than imgContentSize
here (so getting negative values?)
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.
Possibly, and that's also fine here - if imgContentSize is larger then adding a negative will still adjust the total size correctly.
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.
I had the exact same thought, and then realized it was fine either way 😅
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.
Ha! Yes, it just crossed my mind, so thought I'd double check. Thanks both!
// readConfig reads content pointed by the descriptor and unmarshals it into a specified output. | ||
func readConfig(ctx context.Context, store content.Provider, desc ocispec.Descriptor, out interface{}) error { | ||
// readJSON reads content pointed by the descriptor and unmarshals it into a specified output. | ||
func readJSON(ctx context.Context, store content.Provider, desc ocispec.Descriptor, out interface{}) error { |
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.
Ah, except our version also translates the cerrdefs.NotFound into errdefs.NotFound
That problem should probably go away at some point; at least, Derek is working on unifying errdefs to make them interoperable.
- What I did
Fixed a bug where individual image sub-manifests were also accumulating the total size of the image.
- How I did it
- How to verify it
TestImageListCheckTotalSize
- Description for the changelog
No changelog, as the bug hasn't been released yet
- A picture of a cute animal (not mandatory but encouraged)