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
client: Add helper function which checks if an image is unpacked #1668
Conversation
You wanna add an integration tests for this client function? I don't think it would be too hard to test with our setup. |
Codecov Report
@@ Coverage Diff @@
## master #1668 +/- ##
=======================================
Coverage 49.03% 49.03%
=======================================
Files 27 27
Lines 4087 4087
=======================================
Hits 2004 2004
Misses 1664 1664
Partials 419 419 Continue to review full report at Codecov.
|
@@ -63,6 +66,26 @@ func (i *image) Config(ctx context.Context) (ocispec.Descriptor, error) { | |||
return i.i.Config(ctx, provider, platforms.Default()) | |||
} | |||
|
|||
func (i *image) IsUnpacked(ctx context.Context, snapshotterName string) (bool, error) { | |||
sn := i.client.SnapshotService(snapshotterName) |
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.
should we move this logic to images.Check
?
If so, may have to create a return type for it
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.
/cc @stevvooe
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.
Check is a really busy method already with all those return results.
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.
could have it return a type, like I originally suggested. But it kinda feel that Check
should give me that too.
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 can update the Check return results to be a type - would we want that in this same PR?
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.
Can be a separate PR
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.
This needs to be added as a separate helper function for the image type in the images
package. Once we review that, we can add the sugar in the containerd client.
I'm still not thrilled with this never ending interface model -- it doesn't scale as functionality changes. See the go-grpc package for a reference as to where this leads. We need to writing helpers that are a function of the type, rather than adding methods to the type itself, unless it operates on a core or hidden abstraction.
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.
This needs to be added as a separate helper function for the image type in the images package. Once we review that, we can add the sugar in the containerd client.
The current unpack logic is not put into the images
package and I think it is better that way so that we don't introduce the snapshot
package interfaces to the images
package. This would also introduce the naming patterns used by the clients for referencing snapshots, which is more opinionated than what should be included in the images
package. If we want to keep the implementations for these helpers out of the root, we could probably move Unpack
and this new function to rootfs
.
I'm still not thrilled with this never ending interface model
I agree the Image
interface does not seem to going in the right direction. Is there a need for this interface as all, why don't we just export image
and use *Image
from the client as well. Then we could be more flexible in adding methods or helpers for that type.
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.
Just chatted with @dmcgowan about this. Proposed solution to have the IsUnpacked
function take in a SnapshotterService
and containerd.Image
- that way it is no longer a member function or part of the interface. Thoughts?
94aec33
to
f40287c
Compare
The implementation looks good but need to add the helper function in the images package first. |
No objections. Do we still want an interface for images at all though?
On Wed, Oct 25, 2017, 10:15 AM Jessica Valarezo ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In image.go
<#1668 (comment)>
:
> @@ -63,6 +66,26 @@ func (i *image) Config(ctx context.Context) (ocispec.Descriptor, error) {
return i.i.Config(ctx, provider, platforms.Default())
}
+func (i *image) IsUnpacked(ctx context.Context, snapshotterName string) (bool, error) {
+ sn := i.client.SnapshotService(snapshotterName)
Just chatted with @dmcgowan <https://github.com/dmcgowan> about this.
Proposed solution to have the Unpack function take in a SnapshotterService
and containerd.Image - that way it is no longer a member function.
Thoughts?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1668 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/APUifur81Pi-0mMLGHJFpTq0OxnNuIAFks5svm-XgaJpZM4QBCdZ>
.
--
Sent from my phone.
|
@jessvalarezo Let's go ahead and get this rebased, as is. We'll merge and make tweaks on the backend as needed. The current interface is fine and meets the current requirements. |
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
f40287c
to
1552ee2
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
Check if an image has been unpacked. (see last column)
Closes #1572.
Signed-off-by: Jess Valarezo valarezo.jessica@gmail.com