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
Add a way to get all the outputs of a derivation with their label #3678
Conversation
src/libstore/store-api.cc
Outdated
return outputPaths; | ||
} | ||
|
||
StringSet Store::queryDerivationOutputNames(const StorePath & path) |
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.
Maybe add a comment saying these are obsolete / deprecated ?
src/libstore/path.hh
Outdated
@@ -61,6 +61,7 @@ struct StorePath : rust::Value<3 * sizeof(void *) + 24, ffi_StorePath_drop> | |||
|
|||
typedef std::set<StorePath> StorePathSet; | |||
typedef std::vector<StorePath> StorePaths; | |||
typedef std::map<string, StorePath> StorePathMap; |
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 might call this OutputPathMap
instead, as StorePathMap
sounds to me like std::map<StorePath, ???>
.
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.
Indeed, that makes sense. Changed in 53edff2
src/libstore/daemon.cc
Outdated
@@ -308,8 +308,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store, | |||
|
|||
case wopQueryReferences: | |||
case wopQueryReferrers: | |||
case wopQueryValidDerivers: | |||
case wopQueryDerivationOutputs: { |
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.
Do you know what the policy is on supporting on protocol versions? I don't!
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.
The daemon should support older clients. So we can't remove APIs like this.
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.
Woops sorry, I'll restore them
Do we actually need these functions? The outputs of a derivation are also available by doing |
As a cleanup I've removed |
I agree having 3 of them is unnecessary, but this new on seams good to me? In #3523 (comment) you talk about not wanting to rely on derivations existing on disk as much. Avoiding |
Atm yes, but that won't be true anymore in a CA setting where the output paths don't match what's in the drv (which is the reason why I needed this in the first place) |
4913e9e
to
53edff2
Compare
53edff2
to
e23910e
Compare
I've rebased it on top of master. No idea what the OSX failure is. It seems totally unrelated |
Yes, we currently fetch the latest |
Generalize `queryDerivationOutputNames` and `queryDerivationOutputs` by adding a `queryDerivationOutputMap` that returns the map `outputName=>outputPath` (not that this is not equivalent to merging the results of `queryDerivationOutputs` and `queryDerivationOutputNames` as sets don't preserve the order, so we would end up with an incorrect mapping). squash! Add a way to get all the outputs of a derivation with their label Rename StorePathMap to OutputPathMap
e23910e
to
d38f860
Compare
Thanks, merged! |
Generalize
queryDerivationOutputNames
andqueryDerivationOutputs
by adding aqueryDerivationOutputMap
that returns the mapoutputName=>outputPath
.This is needed by #3528 as it needs a way to get the path of a specific derivation output, which (afaik) isn't possible with the current API
(not that this is not equivalent to merging the results of
queryDerivationOutputs
andqueryDerivationOutputNames
as sets don't preserve the order, so we would end up with an incorrect mapping).