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

compression: introduce compression.Type interface #3136

Merged
merged 3 commits into from
Oct 26, 2022

Conversation

imeoer
Copy link
Contributor

@imeoer imeoer commented Sep 29, 2022

Introduce a new compression.Type interface, which needs
to be implemented for each compression type, by that we can
reduce the number of switch case statements and ensure that
we don't miss the handle of any compression types, and also
make more easily for supporting new compression types.

This is a commit for code improvement, so no logical changes.

A successful test can be found here.

@imeoer imeoer force-pushed the compression-type-interface branch 2 times, most recently from 73f82dd to 3c82a8b Compare September 30, 2022 13:56
@imeoer
Copy link
Contributor Author

imeoer commented Oct 7, 2022

cc @ktock @AkihiroSuda @tonistiigi

cache/remotecache/export.go Outdated Show resolved Hide resolved
util/compression/compression.go Outdated Show resolved Hide resolved
util/compression/compression.go Outdated Show resolved Hide resolved
@imeoer imeoer force-pushed the compression-type-interface branch 4 times, most recently from 8961a30 to 9ce0c53 Compare October 14, 2022 09:12
@imeoer
Copy link
Contributor Author

imeoer commented Oct 18, 2022

@AkihiroSuda @ktock Ping~ Please help to keep looking.

@hsiangkao
Copy link

Thanks a lot for the review! @AkihiroSuda

Introduce a new compression.Type interface, which needs
to be implemented for each compression type, by that we can
reduce the number of switch case statements and ensure that
we don't miss the handle of any compression types, and also
make more easily for supporting new compression types.

This is a commit for code improvement, so no logical changes.

Signed-off-by: Yan Song <imeoer@linux.alibaba.com>
Make the field `compression` private in case it is initialized
with nil compression.Type.

Signed-off-by: Yan Song <imeoer@linux.alibaba.com>
Signed-off-by: Yan Song <imeoer@linux.alibaba.com>
@imeoer imeoer changed the title compression: introduce compression.Compression interface compression: introduce compression.Type interface Oct 19, 2022
@hsiangkao
Copy link

Could someone help merge this commit so we could proceed the main PR? Thanks a lot!

@imeoer
Copy link
Contributor Author

imeoer commented Oct 24, 2022

@tonistiigi Ping~, please help to take a final look, thanks!

@tonistiigi tonistiigi merged commit 99f3663 into moby:master Oct 26, 2022
@imeoer
Copy link
Contributor Author

imeoer commented Oct 26, 2022

Thanks for all!

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.

6 participants