libstore: rename query{,Static}PartialDerivationOutputMap
neither are actually partial now, and the the non-Static variant has a non-Partial wrapper which merely returns the Partial result unchanged. Change-Id: I5fa86682883c2305cc12c711ccff58537b7a278d
This commit is contained in:
@@ -401,7 +401,7 @@ static void main_nix_build(AsyncIoRoot & aio, std::string programName, Strings a
|
||||
|
||||
if (shellDrv) {
|
||||
auto shellDrvOutputs =
|
||||
aio.blockOn(store->queryPartialDerivationOutputMap(shellDrv.value(), &*evalStore));
|
||||
aio.blockOn(store->queryDerivationOutputMap(shellDrv.value(), &*evalStore));
|
||||
shell = store->printStorePath(shellDrvOutputs.at("out")) + "/bin/bash";
|
||||
}
|
||||
|
||||
@@ -445,7 +445,7 @@ static void main_nix_build(AsyncIoRoot & aio, std::string programName, Strings a
|
||||
|
||||
auto accumInputClosure = [&](const StorePath & inputDrv, const StringSet & inputNode) {
|
||||
auto outputs =
|
||||
aio.blockOn(store->queryPartialDerivationOutputMap(inputDrv, &*evalStore));
|
||||
aio.blockOn(store->queryDerivationOutputMap(inputDrv, &*evalStore));
|
||||
for (auto & i : inputNode) {
|
||||
auto o = outputs.at(i);
|
||||
aio.blockOn(store->computeFSClosure(o, inputs));
|
||||
@@ -591,7 +591,7 @@ static void main_nix_build(AsyncIoRoot & aio, std::string programName, Strings a
|
||||
drvPrefix += fmt("-%d", counter + 1);
|
||||
|
||||
auto builtOutputs =
|
||||
aio.blockOn(store->queryPartialDerivationOutputMap(drvPath, &*evalStore));
|
||||
aio.blockOn(store->queryDerivationOutputMap(drvPath, &*evalStore));
|
||||
|
||||
auto outputPath = builtOutputs.at(outputName);
|
||||
|
||||
|
||||
@@ -438,7 +438,7 @@ try {
|
||||
for (auto & i : inputClosure)
|
||||
if (i.isDerivation()) {
|
||||
auto depOutputs =
|
||||
TRY_AWAIT(worker.store.queryPartialDerivationOutputMap(i, &worker.evalStore));
|
||||
TRY_AWAIT(worker.store.queryDerivationOutputMap(i, &worker.evalStore));
|
||||
for (auto & j : depOutputs)
|
||||
outputsToDrv.insert_or_assign(j.second, i);
|
||||
}
|
||||
|
||||
@@ -387,7 +387,7 @@ static void performOp(AsyncIoRoot & aio, TunnelLogger * logger, ref<Store> store
|
||||
case WorkerProto::Op::QueryDerivationOutputMap: {
|
||||
auto path = store->parseStorePath(readString(from));
|
||||
logger->startWork();
|
||||
auto outputs = aio.blockOn(store->queryPartialDerivationOutputMap(path));
|
||||
auto outputs = aio.blockOn(store->queryDerivationOutputMap(path));
|
||||
logger->stopWork();
|
||||
to << WorkerProto::write(*store, wconn, outputs);
|
||||
break;
|
||||
|
||||
@@ -40,7 +40,7 @@ try {
|
||||
res["drvPath"] = TRY_AWAIT(drvPath.toJSON(store));
|
||||
// Fallback for the input-addressed derivation case: We expect to always be
|
||||
// able to print the output paths, so let’s do it
|
||||
const auto outputMap = TRY_AWAIT(store.queryPartialDerivationOutputMap(drvPath.path));
|
||||
const auto outputMap = TRY_AWAIT(store.queryDerivationOutputMap(drvPath.path));
|
||||
for (const auto & [output, outputPathOpt] : outputMap) {
|
||||
if (!outputs.contains(output)) continue;
|
||||
res["outputs"][output] = store.printStorePath(outputPathOpt);
|
||||
|
||||
+1
-1
@@ -775,7 +775,7 @@ try {
|
||||
derivation, then visit the derivation outputs. */
|
||||
if (gcKeepDerivations && path->isDerivation()) {
|
||||
for (auto & [name, outPath] :
|
||||
TRY_AWAIT(queryPartialDerivationOutputMap(*path)))
|
||||
TRY_AWAIT(queryDerivationOutputMap(*path)))
|
||||
{
|
||||
if (TRY_AWAIT(isValidPath(outPath)) &&
|
||||
TRY_AWAIT(queryPathInfo(outPath))->deriver == *path)
|
||||
|
||||
@@ -1027,7 +1027,7 @@ try {
|
||||
|
||||
|
||||
kj::Promise<Result<std::map<std::string, StorePath>>>
|
||||
LocalStore::queryStaticPartialDerivationOutputMap(const StorePath & path)
|
||||
LocalStore::queryStaticDerivationOutputMap(const StorePath & path)
|
||||
try {
|
||||
co_return TRY_AWAIT(
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-capturing-lambda-coroutines)
|
||||
|
||||
@@ -202,7 +202,7 @@ public:
|
||||
kj::Promise<Result<StorePathSet>> queryValidDerivers(const StorePath & path) override;
|
||||
|
||||
kj::Promise<Result<std::map<std::string, StorePath>>>
|
||||
queryStaticPartialDerivationOutputMap(const StorePath & path) override;
|
||||
queryStaticDerivationOutputMap(const StorePath & path) override;
|
||||
|
||||
kj::Promise<Result<std::optional<StorePath>>>
|
||||
queryPathFromHashPart(const std::string & hashPart) override;
|
||||
|
||||
@@ -37,7 +37,7 @@ try {
|
||||
res.insert(i);
|
||||
|
||||
if (includeDerivers && path.isDerivation())
|
||||
for (auto& [_, outPath] : TRY_AWAIT(queryPartialDerivationOutputMap(path)))
|
||||
for (auto& [_, outPath] : TRY_AWAIT(queryDerivationOutputMap(path)))
|
||||
if (TRY_AWAIT(isValidPath(outPath)))
|
||||
res.insert(outPath);
|
||||
co_return res;
|
||||
@@ -56,7 +56,7 @@ try {
|
||||
res.insert(ref);
|
||||
|
||||
if (includeOutputs && path.isDerivation())
|
||||
for (auto& [_, outPath] : TRY_AWAIT(queryPartialDerivationOutputMap(path)))
|
||||
for (auto& [_, outPath] : TRY_AWAIT(queryDerivationOutputMap(path)))
|
||||
if (TRY_AWAIT(isValidPath(outPath)))
|
||||
res.insert(outPath);
|
||||
|
||||
@@ -241,7 +241,7 @@ struct QueryMissingContext
|
||||
|
||||
StorePathSet invalid;
|
||||
for (auto & [outputName, path] :
|
||||
aio.blockOn(store.queryPartialDerivationOutputMap(drvPath)))
|
||||
aio.blockOn(store.queryDerivationOutputMap(drvPath)))
|
||||
{
|
||||
if (bfd.outputs.contains(outputName) && !aio.blockOn(store.isValidPath(path)))
|
||||
invalid.insert(path);
|
||||
@@ -354,7 +354,7 @@ resolveDerivedPath(Store & store, const DerivedPath::Built & bfd, Store * evalSt
|
||||
try {
|
||||
auto drvPath = bfd.drvPath.path;
|
||||
|
||||
auto outputs_ = TRY_AWAIT(store.queryPartialDerivationOutputMap(drvPath, evalStore_));
|
||||
auto outputs_ = TRY_AWAIT(store.queryDerivationOutputMap(drvPath, evalStore_));
|
||||
|
||||
co_return std::visit(overloaded {
|
||||
[&](const OutputsSpec::All &) {
|
||||
|
||||
@@ -339,7 +339,7 @@ try {
|
||||
|
||||
|
||||
kj ::Promise<Result<std::map<std::string, StorePath>>>
|
||||
RemoteStore::queryPartialDerivationOutputMap(const StorePath & path, Store * evalStore_)
|
||||
RemoteStore::queryDerivationOutputMap(const StorePath & path, Store * evalStore_)
|
||||
try {
|
||||
if (GET_PROTOCOL_MINOR(TRY_AWAIT(getProtocol())) >= 22) {
|
||||
if (!evalStore_) {
|
||||
@@ -361,11 +361,11 @@ try {
|
||||
co_return result;
|
||||
} else {
|
||||
auto & evalStore = *evalStore_;
|
||||
auto outputs = TRY_AWAIT(evalStore.queryStaticPartialDerivationOutputMap(path));
|
||||
auto outputs = TRY_AWAIT(evalStore.queryStaticDerivationOutputMap(path));
|
||||
// union with the first branch overriding the statically-known ones
|
||||
// when non-`std::nullopt`.
|
||||
for (auto && [outputName, optPath] :
|
||||
TRY_AWAIT(queryPartialDerivationOutputMap(path, nullptr)))
|
||||
TRY_AWAIT(queryDerivationOutputMap(path, nullptr)))
|
||||
{
|
||||
outputs.insert_or_assign(std::move(outputName), std::move(optPath));
|
||||
}
|
||||
@@ -380,7 +380,7 @@ try {
|
||||
// from the derivation itself (and not the ones that are known because
|
||||
// the have been built), but as old stores don't handle floating-CA
|
||||
// derivations this shouldn't matter
|
||||
co_return TRY_AWAIT(evalStore.queryStaticPartialDerivationOutputMap(path));
|
||||
co_return TRY_AWAIT(evalStore.queryStaticDerivationOutputMap(path));
|
||||
}
|
||||
} catch (...) {
|
||||
co_return result::current_exception();
|
||||
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
kj::Promise<Result<StorePathSet>> queryDerivationOutputs(const StorePath & path) override;
|
||||
|
||||
kj::Promise<Result<std::map<std::string, StorePath>>>
|
||||
queryPartialDerivationOutputMap(const StorePath & path, Store * evalStore = nullptr) override;
|
||||
queryDerivationOutputMap(const StorePath & path, Store * evalStore = nullptr) override;
|
||||
kj::Promise<Result<std::optional<StorePath>>>
|
||||
queryPathFromHashPart(const std::string & hashPart) override;
|
||||
|
||||
|
||||
@@ -509,7 +509,7 @@ bool Store::PathInfoCacheValue::isKnownNow()
|
||||
}
|
||||
|
||||
kj::Promise<Result<std::map<std::string, StorePath>>>
|
||||
Store::queryStaticPartialDerivationOutputMap(const StorePath & path)
|
||||
Store::queryStaticDerivationOutputMap(const StorePath & path)
|
||||
try {
|
||||
std::map<std::string, StorePath> outputs;
|
||||
auto drv = TRY_AWAIT(readInvalidDerivation(path));
|
||||
@@ -522,19 +522,11 @@ try {
|
||||
}
|
||||
|
||||
kj::Promise<Result<std::map<std::string, StorePath>>>
|
||||
Store::queryPartialDerivationOutputMap(const StorePath & path, Store * evalStore_)
|
||||
Store::queryDerivationOutputMap(const StorePath & path, Store * evalStore_)
|
||||
try {
|
||||
auto & evalStore = evalStore_ ? *evalStore_ : *this;
|
||||
|
||||
co_return TRY_AWAIT(evalStore.queryStaticPartialDerivationOutputMap(path));
|
||||
} catch (...) {
|
||||
co_return result::current_exception();
|
||||
}
|
||||
|
||||
kj::Promise<Result<OutputPathMap>>
|
||||
Store::queryDerivationOutputMap(const StorePath & path, Store * evalStore)
|
||||
try {
|
||||
co_return TRY_AWAIT(queryPartialDerivationOutputMap(path, evalStore));
|
||||
co_return TRY_AWAIT(evalStore.queryStaticDerivationOutputMap(path));
|
||||
} catch (...) {
|
||||
co_return result::current_exception();
|
||||
}
|
||||
|
||||
@@ -448,10 +448,10 @@ public:
|
||||
|
||||
/**
|
||||
* Query the mapping outputName => outputPath for the given
|
||||
* derivation. Naming is a historical accident.
|
||||
* derivation.
|
||||
*/
|
||||
virtual kj::Promise<Result<std::map<std::string, StorePath>>>
|
||||
queryPartialDerivationOutputMap(const StorePath & path, Store * evalStore = nullptr);
|
||||
queryDerivationOutputMap(const StorePath & path, Store * evalStore = nullptr);
|
||||
|
||||
/**
|
||||
* Like `queryPartialDerivationOutputMap` but only considers
|
||||
@@ -459,17 +459,10 @@ public:
|
||||
* the derivation itself.
|
||||
*
|
||||
* Just a helper function for implementing
|
||||
* `queryPartialDerivationOutputMap`.
|
||||
* `queryDerivationOutputMap`.
|
||||
*/
|
||||
virtual kj::Promise<Result<std::map<std::string, StorePath>>>
|
||||
queryStaticPartialDerivationOutputMap(const StorePath & path);
|
||||
|
||||
/**
|
||||
* Query the mapping outputName=>outputPath for the given derivation.
|
||||
* Assume every output has a mapping and throw an exception otherwise.
|
||||
*/
|
||||
kj::Promise<Result<OutputPathMap>>
|
||||
queryDerivationOutputMap(const StorePath & path, Store * evalStore = nullptr);
|
||||
queryStaticDerivationOutputMap(const StorePath & path);
|
||||
|
||||
/**
|
||||
* Query the full store path given the hash part of a valid store
|
||||
|
||||
+1
-1
@@ -260,7 +260,7 @@ try {
|
||||
}},
|
||||
bmNormal, evalStore));
|
||||
|
||||
for (auto & [_0, outPath] : TRY_AWAIT(evalStore->queryPartialDerivationOutputMap(shellDrvPath)))
|
||||
for (auto & [_0, outPath] : TRY_AWAIT(evalStore->queryDerivationOutputMap(shellDrvPath)))
|
||||
{
|
||||
assert(TRY_AWAIT(store->isValidPath(outPath)));
|
||||
auto outPathS = store->toRealPath(outPath);
|
||||
|
||||
Reference in New Issue
Block a user