Skip to content
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

Towards eliminating v1util #872

Merged
merged 9 commits into from Dec 17, 2020
Merged

Towards eliminating v1util #872

merged 9 commits into from Dec 17, 2020

Conversation

mattmoor
Copy link
Collaborator

This blows apart v1util into smaller (mostly internal) packages, keeping only aliases of what we have today under pkg/v1/v1util to avoid breaking downstreams, but adding a deprecation notice, which should trigger golangci-lint to start flagging users of the deprecated methods.

@@ -335,7 +335,7 @@ func layerTime(layer v1.Layer, t time.Time) (v1.Layer, error) {
b := w.Bytes()
// gzip the contents, then create the layer
opener := func() (io.ReadCloser, error) {
return v1util.GzipReadCloser(ioutil.NopCloser(bytes.NewReader(b))), nil
return gzip.GzipReadCloser(ioutil.NopCloser(bytes.NewReader(b))), nil
Copy link
Collaborator

Choose a reason for hiding this comment

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

Drop the stutter?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What do you want to call the Gunzip variant :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

You got me there.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was piggybacking on the sentiment @imjasonh had below that renaming things becomes reeeeaaaaal easy under internal/, so this is trivial to fixup later if we find a name we like. 🤷

Copy link
Collaborator

@jonjohnsonjr jonjohnsonjr left a comment

Choose a reason for hiding this comment

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

I think the convention is Deprecated: per https://github.com/golang/go/wiki/Deprecated

@imjasonh
Copy link
Collaborator

pkg/v1/v1util -> pkg/v1/internal has roughly the same effect, and is simply mechanical. Splitting it into separate internal packages and moving some to still-exported symbols in v1 seems like more work than necessary.

@mattmoor
Copy link
Collaborator Author

pkg/v1/v1util -> pkg/v1/internal has roughly the same effect, and is simply mechanical

Are you suggesting we have a literal internal package? I kinda thought part of moving away from v1util was to get better package naming.

and moving some to still-exported symbols in v1 seems like more work than necessary

Not parsing, but exposing the things that were previously public under v1util with Deprecated: was intentional to not break folks immediately.

@jonjohnsonjr
Copy link
Collaborator

Not parsing, but exposing the things that were previously public under v1util with Deprecated: was intentional to not break folks immediately.

+1, we owe them one release of deprecated before we drop it, IMO.

@mattmoor
Copy link
Collaborator Author

I can TODO(#1234) removing, if we want to track this better.

@imjasonh
Copy link
Collaborator

Are you suggesting we have a literal internal package? I kinda thought part of moving away from v1util was to get better package naming.

I'm suggesting we stage the change first by making it internal (to shake off external deps), then we have the flexibility to move methods as unexported where they're used if we want.

Package naming and organization matters a lot less to me inside internal where it's clear it's only for our own uses.

Not parsing, but exposing the things that were previously public under v1util with Deprecated: was intentional to not break folks immediately.

Yeah, that's fine, I was talking about v1.VerifyReadCloser, which I think we should keep internal unless we know somewhere important someone's depending on it.

@mattmoor
Copy link
Collaborator Author

I'm suggesting we stage the change first by making it internal (to shake off external deps)

Just making it internal is breaking, and I don't think we should just break folks currently using it (until a few days ago this included ko, are we sure Bazel isn't using this?).

The intent of staging things this way was to make it clear that the external exposure is Deprecated (and will break), while simultaneously enabling us to restructure things in a way that's consistent with what y'all are asking for with pkg/v1/internal/estargz.

Package naming and organization matters a lot less to me inside internal where it's clear it's only for our own uses

I completely agree, which is why I didn't sweat the "stutter" stuff right away.

I was talking about v1.VerifyReadCloser

I'm happy to make this private, I don't really care, but digest verification just felt like something folks would want, but it is not a hill I'd die on 😉

@mattmoor
Copy link
Collaborator Author

Alright, we now have verify.ReadCloser in an internal package (aliased as deprecated v1util.VerifyReadCloser)

@imjasonh
Copy link
Collaborator

To be clear I'm absolutely on board with aliasing + deprecating for now. It was the atomizing into internal packages I was commenting about. Sorry that wasn't clear.

@mattmoor
Copy link
Collaborator Author

It feels like we are quibbling about internal structure, which we all agreed that we can now change whenever we want. I went with this because it seemed like it was consistent with what was being suggested for estargz, and it seemed like we all agreed about this on slack:

image

The "consistent structure" I was talking about above was "the atomizing" 😅

Perhaps we're talking past each other, so it may be simplest to hop on a zoom (🤔 now I'm wondering if this is a ploy to see the 🐶 , very :sus:)

@codecov-io
Copy link

codecov-io commented Dec 17, 2020

Codecov Report

Merging #872 (245630d) into master (8b5370a) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #872   +/-   ##
=======================================
  Coverage   74.28%   74.28%           
=======================================
  Files         106      106           
  Lines        4476     4476           
=======================================
  Hits         3325     3325           
  Misses        656      656           
  Partials      495      495           
Impacted Files Coverage Δ
pkg/v1/internal/and/and_closer.go 100.00% <ø> (ø)
pkg/v1/internal/gzip/zip.go 100.00% <100.00%> (ø)
pkg/v1/internal/verify/verify.go 100.00% <100.00%> (ø)
pkg/v1/mutate/mutate.go 71.97% <100.00%> (ø)
pkg/v1/partial/compressed.go 73.68% <100.00%> (ø)
pkg/v1/partial/uncompressed.go 73.52% <100.00%> (ø)
pkg/v1/remote/descriptor.go 73.78% <100.00%> (ø)
pkg/v1/remote/image.go 79.45% <100.00%> (ø)
pkg/v1/tarball/image.go 77.77% <100.00%> (ø)
pkg/v1/tarball/layer.go 71.83% <100.00%> (ø)
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8b5370a...245630d. Read the comment docs.

@mattmoor
Copy link
Collaborator Author

@imjasonh I think this covers the key points that we discussed. I am happy to keep making changes, which should be easy now that this stuff is under internal/. Let me know if you want to chat, and I can /zoom you.

@mattmoor mattmoor merged commit 481434c into google:master Dec 17, 2020
@mattmoor mattmoor deleted the blowup-v1util branch December 17, 2020 00:35
@imjasonh
Copy link
Collaborator

Lgtm, thanks for putting up with my quibbling 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants