Merged
Conversation
Whereas `ContentAddressWithReferences` is a sum type complex because different varieties support different notions of reference, and `ContentAddressMethod` is a nested enum to support that, `ContentAddress` can be a simple pair of a method and hash. `ContentAddress` does not need to be a sum type on the outside because the choice of method doesn't effect what type of hashes we can use. Co-Authored-By: Cale Gibbard <cgibbard@gmail.com>
5ab2afe to
903700c
Compare
Ericson2314
commented
Jul 10, 2023
Comment on lines
-1859
to
+1858
| FixedOutputHash LocalStore::hashCAPath( | ||
| const FileIngestionMethod & method, const HashType & hashType, | ||
| ContentAddress LocalStore::hashCAPath( | ||
| const ContentAddressMethod & method, const HashType & hashType, | ||
| const StorePath & path) | ||
| { | ||
| return hashCAPath(method, hashType, Store::toRealPath(path), path.hashPart()); | ||
| } | ||
|
|
||
| FixedOutputHash LocalStore::hashCAPath( | ||
| const FileIngestionMethod & method, | ||
| ContentAddress LocalStore::hashCAPath( | ||
| const ContentAddressMethod & method, |
Member
Author
There was a problem hiding this comment.
These I just generalized to not use the deleted type. And this gets us closer in fact to being able to deduplicate this with some build/local-derivation-goal.cc stuff later.
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-07-10-nix-team-meeting-minutes-70/30471/1 |
edolstra
approved these changes
Jul 21, 2023
This file contains hidden or 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
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.
Motivation
Whereas
ContentAddressWithReferencesis a sum type complex because different varieties support different notions of reference, andContentAddressMethodis a nested enum to support that,ContentAddresscan be a simple pair of a method and hash.ContentAddressdoes not need to be a sum type on the outside because the choice of method doesn't effect what type of hashes we can use.Context
#3746 and #3959 got the data types in their current form, but I did not notice that this simplification became possible.
@amjoseph-nixpkgs in #3959 (comment) raised the goal of flattening the content address data types / making text less "the odd one out". I agree, and this gets us closer.
Checklist for maintainers
Maintainers: tick if completed or explain if not relevant
tests/**.shsrc/*/teststests/nixos/*Priorities
Add 👍 to pull requests you find important.