-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
ValidPathInfo: make ca field a proper datatype #3649
ValidPathInfo: make ca field a proper datatype #3649
Conversation
I think it makes more sense to define the data model (derivations), before the operations (store api).
…son2314/nix into validPathInfo-ca-proper-datatype
…314/nix into validPathInfo-ca-proper-datatype
Oh, I thought I could edit this because it is from a repo I have access too, but I guess that is not the case. This contains a number of other PRs:
And the culmination of our work to tighten up the API replacing strings with proper data type. We're doing this to help root out bugs with the git objects work, but we hope it can be merged separately as #3455 as it cleans up the code regardless of whether git objects ever makes it in. |
This is still WIP because we need to actually write the |
src/libstore/derivations.hh
Outdated
std::string hashAlgo; /* hash used for expected hash computation */ | ||
std::string hash; /* expected hash, may be null */ | ||
DerivationOutput(StorePath && path, std::string && hashAlgo, std::string && hash) | ||
std::optional<FileSystemHash> hash; /* hash used for expected hash computation */ |
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.
Does this make sense here?
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.
That is, a derivation might not have any file ingestion at all. If it's not fixed output, I think it will only have file ingestion through its inputs.
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.
I would recommend just using the Hash
type here.
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.
Very confusingly, the hashAlgo
string also contained the r:
. See #3439, where this comes from.
src/libstore/file-hash.hh
Outdated
|
||
/// Pair of a hash, and how the file system was ingested | ||
struct FileSystemHash { | ||
FileIngestionMethod method; |
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 might need to be optional
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.
I don't think so?
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.
Mainly because of the above comment. Not all uses of FileSystemHash will have a real "FileIngestionMethod" defined. Consider derivations.
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.
Oh, we should rename the data type then. This is strictly for content-addressed things.
Co-authored-by: Matthew Bauer <mjbauer95@gmail.com>
3ff7f7d
to
343c20a
Compare
This was a latent bug that just appeared because of the tests that were added. Remember to wait for CI! :)
…athInfo-ca-proper-datatype
…idPathInfo-ca-proper-datatype
Thanks Matt!
Fixed the rest of these before, but this one slipped through.
… into validPathInfo-ca-proper-datatype
babb27c
to
2f0e395
Compare
}; | ||
|
||
/// Pair of a hash, and how the file system was ingested | ||
struct FixedOutputHash { |
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.
I went with FixedOutputHash
for this PR, now that it is not just used in derivations.
No description provided.