libstore: asyncify Store::makeValidityRegistration
Change-Id: Ic1c31240d73db6783842664fbfa9607401a3b4a7
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
)
|
||||
))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user