libstore: de-callback-ify Store::queryPathInfoUncached

Change-Id: I23a156aaff5328f67ca16ccd85c0ea1711b21e35
This commit is contained in:
eldritch horrors
2024-05-09 23:18:05 +02:00
parent c77bd88259
commit 2f4a1dd6e0
11 changed files with 106 additions and 168 deletions
+5 -10
View File
@@ -349,8 +349,7 @@ void BinaryCacheStore::narFromPath(const StorePath & storePath, Sink & sink)
stats.narReadBytes += narSize.length;
}
void BinaryCacheStore::queryPathInfoUncached(const StorePath & storePath,
Callback<std::shared_ptr<const ValidPathInfo>> callback) noexcept
std::shared_ptr<const ValidPathInfo> BinaryCacheStore::queryPathInfoUncached(const StorePath & storePath)
{
auto uri = getUri();
auto storePathS = printStorePath(storePath);
@@ -360,17 +359,13 @@ void BinaryCacheStore::queryPathInfoUncached(const StorePath & storePath,
auto narInfoFile = narInfoFileFor(storePath);
try {
auto data = getFile(narInfoFile);
auto data = getFile(narInfoFile);
if (!data) return callback({});
if (!data) return {};
stats.narInfoRead++;
stats.narInfoRead++;
callback(std::make_shared<NarInfo>(*this, *data, narInfoFile));
} catch (...) {
callback.rethrow();
}
return std::make_shared<NarInfo>(*this, *data, narInfoFile);
}
StorePath BinaryCacheStore::addToStore(