-
Notifications
You must be signed in to change notification settings - Fork 7
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
Adopt CacheDiff (crate) over MetadataDiff (internal) #370
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The CacheDiff is a public crate while MetadataDiff was a temporary experimentation platform internal to this buildpack
The idea is to centralize all OS distribution information into a single attribute. It's not yet used.
schneems
force-pushed
the
schneems/pub-traits
branch
from
December 12, 2024 22:11
1216762
to
ed35f5c
Compare
The coming move to CacheDiff prefers if one attribute relates to one difference reason. V2 introduced a distribution name and distribution value which we later determined looked better if it's combined to look like a single attribute to the user "OS Distribution." This move brings the attributes inline with how they're compared, now both name and value are evaluated and emited as a single unit.
(Tests do not compile yet)
The coming move to CacheDiff prefers if one attribute relates to one difference reason. V2 introduced a distribution name and distribution value which we later determined looked better if it's combined to look like a single attribute to the user "OS Distribution." This move brings the attributes inline with how they're compared, now both name and value are evaluated and emitted as a single unit.
Does not compile yet due to tests
schneems
force-pushed
the
schneems/pub-traits
branch
from
December 12, 2024 22:20
ed35f5c
to
aaf7087
Compare
In the refactor we had two `diff` methods, now there's only one so we can use it instead of having to reference the trait. This shaves off some lines of the total diff.
schneems
force-pushed
the
schneems/pub-traits
branch
from
December 12, 2024 22:27
aaf7087
to
fd11c67
Compare
edmorley
approved these changes
Dec 13, 2024
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 was mainly a rubber stamp given it's a refactor and compiler/tests should cover this; let me know if you'd prefer a full review :-) )
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
MetadataDiff
was a prototype for how to extract cache clearing logic to a centralized trait. From there I changed the name and built a proc-macro that can generate the same logic https://github.com/heroku-buildpacks/cache_diff. The benefit of the proc macro is it works with defaults out of the box and adds consistency.This PR moves the old code using MetadataDiff to now use
CacheDiff
. In the process I refactored some logic, namely how the OS distribution information is stored as metadata. Commits are small, sequential and self described.