libstore: asyncify Store::getClosureSize

Change-Id: I625c92f94e2a77b64569d385d486434ae41df2da
This commit is contained in:
eldritch horrors
2025-02-23 17:18:48 +00:00
parent bd8272faec
commit bc0e0786f0
3 changed files with 9 additions and 6 deletions
+7 -4
View File
@@ -1002,7 +1002,7 @@ try {
std::pair<uint64_t, uint64_t> closureSizes;
if (showClosureSize) {
closureSizes = getClosureSize(info->path);
closureSizes = TRY_AWAIT(getClosureSize(info->path));
jsonPath["closureSize"] = closureSizes.first;
}
@@ -1048,8 +1048,9 @@ try {
}
std::pair<uint64_t, uint64_t> Store::getClosureSize(const StorePath & storePath)
{
kj::Promise<Result<std::pair<uint64_t, uint64_t>>>
Store::getClosureSize(const StorePath & storePath)
try {
uint64_t totalNarSize = 0, totalDownloadSize = 0;
StorePathSet closure;
computeFSClosure(storePath, closure, false, false);
@@ -1061,7 +1062,9 @@ std::pair<uint64_t, uint64_t> Store::getClosureSize(const StorePath & storePath)
if (narInfo)
totalDownloadSize += narInfo->fileSize;
}
return {totalNarSize, totalDownloadSize};
co_return {totalNarSize, totalDownloadSize};
} catch (...) {
co_return result::current_exception();
}
+1 -1
View File
@@ -702,7 +702,7 @@ public:
* the sum of the size of the NAR serialisation of each path in the
* closure.
*/
std::pair<uint64_t, uint64_t> getClosureSize(const StorePath & storePath);
kj::Promise<Result<std::pair<uint64_t, uint64_t>>> getClosureSize(const StorePath & storePath);
/**
* Optimise the disk space usage of the Nix store by hard-linking files
+1 -1
View File
@@ -112,7 +112,7 @@ struct CmdPathInfo : StorePathsCommand, MixJSON
printSize(info->narSize);
if (showClosureSize)
printSize(store->getClosureSize(info->path).first);
printSize(aio().blockOn(store->getClosureSize(info->path)).first);
if (showSigs) {
std::cout << '\t';