libstore: asyncify Store::pathInfoToJSON
Change-Id: I2e04c6804444b3ca53486ce6acb0c159e7814938
This commit is contained in:
@@ -155,9 +155,9 @@ try {
|
||||
StorePathSet storePaths;
|
||||
for (auto & p : *i)
|
||||
storePaths.insert(store.toStorePath(p.get<std::string>()).first);
|
||||
json[i.key()] = store.pathInfoToJSON(
|
||||
json[i.key()] = TRY_AWAIT(store.pathInfoToJSON(
|
||||
TRY_AWAIT(store.exportReferences(storePaths, inputPaths)), false, true
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -962,11 +962,11 @@ try {
|
||||
co_return result::current_exception();
|
||||
}
|
||||
|
||||
json Store::pathInfoToJSON(const StorePathSet & storePaths,
|
||||
kj::Promise<Result<json>> Store::pathInfoToJSON(const StorePathSet & storePaths,
|
||||
bool includeImpureInfo, bool showClosureSize,
|
||||
Base hashBase,
|
||||
AllowInvalidFlag allowInvalid)
|
||||
{
|
||||
try {
|
||||
json::array_t jsonList = json::array();
|
||||
|
||||
for (auto & storePath : storePaths) {
|
||||
@@ -1032,7 +1032,9 @@ json Store::pathInfoToJSON(const StorePathSet & storePaths,
|
||||
jsonPath["valid"] = false;
|
||||
}
|
||||
}
|
||||
return jsonList;
|
||||
co_return jsonList;
|
||||
} catch (...) {
|
||||
co_return result::current_exception();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -686,7 +686,7 @@ public:
|
||||
* @param showClosureSize If true, the closure size of each path is
|
||||
* included.
|
||||
*/
|
||||
nlohmann::json pathInfoToJSON(const StorePathSet & storePaths,
|
||||
kj::Promise<Result<nlohmann::json>> pathInfoToJSON(const StorePathSet & storePaths,
|
||||
bool includeImpureInfo, bool showClosureSize,
|
||||
Base hashBase = Base::Base32,
|
||||
AllowInvalidFlag allowInvalid = DisallowInvalid);
|
||||
|
||||
@@ -91,10 +91,10 @@ struct CmdPathInfo : StorePathsCommand, MixJSON
|
||||
pathLen = std::max(pathLen, store->printStorePath(storePath).size());
|
||||
|
||||
if (json) {
|
||||
std::cout << store->pathInfoToJSON(
|
||||
std::cout << aio().blockOn(store->pathInfoToJSON(
|
||||
// FIXME: preserve order?
|
||||
StorePathSet(storePaths.begin(), storePaths.end()),
|
||||
true, showClosureSize, Base::SRI, AllowInvalid).dump();
|
||||
true, showClosureSize, Base::SRI, AllowInvalid)).dump();
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user