libstore: asyncify Store::makeValidityRegistration

Change-Id: Ic1c31240d73db6783842664fbfa9607401a3b4a7
This commit is contained in:
eldritch horrors
2025-02-24 15:09:02 +00:00
parent 3cdf9fed2f
commit 381eca9947
4 changed files with 14 additions and 9 deletions
+6 -3
View File
@@ -534,11 +534,14 @@ static void opDumpDB(AsyncIoRoot & aio, Strings opFlags, Strings opArgs)
{
if (!opFlags.empty()) throw UsageError("unknown flag");
if (!opArgs.empty()) {
for (auto & i : opArgs)
cout << store->makeValidityRegistration({store->followLinksToStorePath(i)}, true, true);
for (auto & i : opArgs) {
cout << aio.blockOn(
store->makeValidityRegistration({store->followLinksToStorePath(i)}, true, true)
);
}
} else {
for (auto & i : store->queryAllValidPaths())
cout << store->makeValidityRegistration({i}, true, true);
cout << aio.blockOn(store->makeValidityRegistration({i}, true, true));
}
}
+2 -2
View File
@@ -574,9 +574,9 @@ try {
/* Write closure info to <fileName>. */
writeFile(
tmpDir + "/" + fileName,
worker.store.makeValidityRegistration(
TRY_AWAIT(worker.store.makeValidityRegistration(
TRY_AWAIT(worker.store.exportReferences({storePath}, inputPaths)), false, false
)
))
);
}
}
+5 -3
View File
@@ -909,9 +909,9 @@ try {
/* Return a string accepted by decodeValidPathInfo() that
registers the specified paths as valid. Note: it's the
responsibility of the caller to provide a closure. */
std::string Store::makeValidityRegistration(const StorePathSet & paths,
kj::Promise<Result<std::string>> Store::makeValidityRegistration(const StorePathSet & paths,
bool showDerivers, bool showHash)
{
try {
std::string s = "";
for (auto & i : paths) {
@@ -933,7 +933,9 @@ std::string Store::makeValidityRegistration(const StorePathSet & paths,
s += printStorePath(j) + "\n";
}
return s;
co_return s;
} catch (...) {
co_return result::current_exception();
}
+1 -1
View File
@@ -682,7 +682,7 @@ public:
* can be loaded into the database using `nix-store --load-db` or
* `nix-store --register-validity`.
*/
std::string makeValidityRegistration(const StorePathSet & paths,
kj::Promise<Result<std::string>> makeValidityRegistration(const StorePathSet & paths,
bool showDerivers, bool showHash);
/**