aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/binary-cache-store.cc
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-04-27 23:44:12 +0200
committereldritch horrors <pennae@lix.systems>2024-05-09 23:18:05 +0200
commit17965bf11c55daee81729151f9876e55fdeaf9c1 (patch)
treeb4b7a4ce182e52acf2f8a4cdd6158638dc990162 /src/libstore/binary-cache-store.cc
parent2f4a1dd6e03f3005e1f11dc98dda2d2d214b1f6f (diff)
libstore: un-callback-ify Store::queryRealisationUncached
Change-Id: I4a328f46eaac3bb8b19ddc091306de83348be9cf
Diffstat (limited to 'src/libstore/binary-cache-store.cc')
-rw-r--r--src/libstore/binary-cache-store.cc19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/libstore/binary-cache-store.cc b/src/libstore/binary-cache-store.cc
index 88b8db972..85ca36667 100644
--- a/src/libstore/binary-cache-store.cc
+++ b/src/libstore/binary-cache-store.cc
@@ -442,21 +442,16 @@ StorePath BinaryCacheStore::addTextToStore(
})->path;
}
-void BinaryCacheStore::queryRealisationUncached(const DrvOutput & id,
- Callback<std::shared_ptr<const Realisation>> callback) noexcept
+std::shared_ptr<const Realisation> BinaryCacheStore::queryRealisationUncached(const DrvOutput & id)
{
auto outputInfoFilePath = realisationsPrefix + "/" + id.to_string() + ".doi";
- try {
- auto data = getFile(outputInfoFilePath);
- if (!data) return callback({});
-
- auto realisation = Realisation::fromJSON(
- nlohmann::json::parse(*data), outputInfoFilePath);
- return callback(std::make_shared<const Realisation>(realisation));
- } catch (...) {
- callback.rethrow();
- }
+ auto data = getFile(outputInfoFilePath);
+ if (!data) return {};
+
+ auto realisation = Realisation::fromJSON(
+ nlohmann::json::parse(*data), outputInfoFilePath);
+ return std::make_shared<const Realisation>(realisation);
}
void BinaryCacheStore::registerDrvOutput(const Realisation& info) {