-
Notifications
You must be signed in to change notification settings - Fork 604
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
fix image size #310
fix image size #310
Conversation
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.
overall LGTM but minor nits
6cdffbb
to
7048508
Compare
@ktock done |
cmd/nerdctl/images.go
Outdated
walkFn := func(ctx context.Context, info snapshots.Info) error { | ||
keys[info.Name] = info.Parent | ||
return nil | ||
} | ||
if err := s.Walk(ctx, walkFn); err != nil { | ||
return 0, err | ||
} |
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.
Why does it scan all snapshots? Can we walk snapshots only in the chain? I think we can do this by following parents from the topmost snapshot using Stat
API.
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.
@ktock thank you, This is what I was looking for ==> Stat
API . I made modification.
a03a5e8
to
9e290f3
Compare
Signed-off-by: fahed dorgaa <fahed.dorgaa@gmail.com>
9e290f3
to
c6684a7
Compare
CI wasn't triggered? |
@@ -143,19 +146,51 @@ func imagesBashComplete(clicontext *cli.Context) { | |||
bashCompleteImageNames(clicontext) | |||
} | |||
|
|||
func unpackedImageSize(ctx context.Context, clicontext *cli.Context, client *containerd.Client, i images.Image) (int64, error) { | |||
type snapshotKey string |
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.
Why define new type just for a string?
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 have to define new local type to use it as a receiver to the add
method. We cannot define the add
method on non-local type string
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.
Thanks
the actual image size is equal to the ChainID size.
this PR use the Walk API and Usage on each parent of ChainID to calculate the total usage of unpacked image layers
related issue #304
Signed-off-by: fahed dorgaa fahed.dorgaa@gmail.com