Skip to content

Conversation

@dmcgowan
Copy link
Member

Move client unpacker to pkg/unpack

This new package will be used by both the client and a future service which does pull.

@k8s-ci-robot
Copy link

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 30, 2022

Build succeeded.

@dmcgowan dmcgowan force-pushed the unpacker-interface branch from 3d5e873 to a250275 Compare March 30, 2022 20:05
@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 30, 2022

Build succeeded.

@dmcgowan dmcgowan force-pushed the unpacker-interface branch from a250275 to 9ba214c Compare March 30, 2022 20:36
@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 30, 2022

Build succeeded.

@dmcgowan dmcgowan force-pushed the unpacker-interface branch from 9ba214c to 043e4a3 Compare March 30, 2022 23:36
@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 31, 2022

Build succeeded.

@dmcgowan dmcgowan force-pushed the unpacker-interface branch from 043e4a3 to 61dd515 Compare April 5, 2022 01:14
@theopenlab-ci
Copy link

theopenlab-ci bot commented Apr 5, 2022

Build succeeded.

@dmcgowan dmcgowan added this to the 1.7 milestone Apr 6, 2022
@dmcgowan dmcgowan force-pushed the unpacker-interface branch from 61dd515 to 5d1afc4 Compare April 8, 2022 05:46
@theopenlab-ci
Copy link

theopenlab-ci bot commented Apr 8, 2022

Build succeeded.

@dmcgowan dmcgowan marked this pull request as ready for review April 12, 2022 23:37
@AkihiroSuda AkihiroSuda requested review from fuweid and ktock April 15, 2022 12:34
Comment on lines 90 to 87
if u.SnapshotterName == "" {
return fmt.Errorf("snapshotter name must be provided for reference")
}
if u.Snapshotter == nil {
return fmt.Errorf("snapshotter must be provided to unpack")
}
Copy link
Member

Choose a reason for hiding this comment

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

How does that work if SnapshotterName and Snapshotter are different?

Copy link
Member

Choose a reason for hiding this comment

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

Would the caller be responsible to set them in the consistent manner?

Copy link
Member Author

@dmcgowan dmcgowan Apr 18, 2022

Choose a reason for hiding this comment

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

Could rename SnapshotterName to SnapshotterKey and skip the gc reference when not provided. We probably should have been adding a Name() string to some of our interfaces or rely on checking for String() string so callers are forced to track the name/object pairing.

Copy link
Member Author

Choose a reason for hiding this comment

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

Renamed SnapshotterName and removed it erroring. The key only needs to be consistent for the caller, but it doesn't need to cause an error.

Copy link
Member

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

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

I'm not sure I see the benefit of defining an Unpacker interface here instead of where it would be used.
Even in the client the unpacker implementation is hard-coded (ie. no way to swap the implementation).
That said I think the rest of this is useful so the unpack implementation can be easily used elsewhere.

}
var config = UnpackConfig{
DuplicationSuppressor: kmutex.NewNoop(),
func NewUnpacker(ctx context.Context, cs content.Store, opts ...UnpackerOpt) (Unpacker, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we have this return a real type instead of an interface?
The way this is, it tends to make it difficult to dig into the implementation when debugging/digging in from higher levels.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, that makes sense here. The package isn't likely to have multiple implementation inside the package anyway. I could see the possibility of the unpack being proxied, but probably not even around that interface.

@dmcgowan dmcgowan force-pushed the unpacker-interface branch from 5d1afc4 to 8d84403 Compare April 19, 2022 03:34
@theopenlab-ci
Copy link

theopenlab-ci bot commented Apr 19, 2022

Build succeeded.

}
var platformMatcher platforms.Matcher
if !uconfig.CheckPlatformSupported {
platformMatcher = platforms.All
Copy link
Member

Choose a reason for hiding this comment

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

the WithUnpackPlatform will apply platforms.All if the unpack.Platform.Platform is nil. It looks like that CheckPlatformSupported option is short circuit and useless.

Copy link
Member Author

Choose a reason for hiding this comment

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

The logic here should be the same, but agreed it is kind of odd. I think it will be clearer though in the future having unpack platforms be explicit and separate from the fetcher's platform matcher if there is reason for them not to be the same.

@fuweid
Copy link
Member

fuweid commented Apr 19, 2022

import_test.go:76: failed to copy: stream error: stream ID 1; HTTP_1_1_REQUIRED; received from peer

hmm... reruning

@theopenlab-ci
Copy link

theopenlab-ci bot commented Apr 19, 2022

Build succeeded.

Move client unpacker to pkg/unpack

Signed-off-by: Derek McGowan <[email protected]>
Require platforms to be non-empty to avoid no-op unpack

Signed-off-by: Derek McGowan <[email protected]>
@dmcgowan dmcgowan force-pushed the unpacker-interface branch from b80faae to 39692e7 Compare April 20, 2022 01:22
@theopenlab-ci
Copy link

theopenlab-ci bot commented Apr 20, 2022

Build succeeded.

Copy link
Member

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@kzys kzys left a comment

Choose a reason for hiding this comment

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

LGTM

@ktock @fuweid Can you take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

7 participants