aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/local-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/local-store.cc
parent2f4a1dd6e03f3005e1f11dc98dda2d2d214b1f6f (diff)
libstore: un-callback-ify Store::queryRealisationUncached
Change-Id: I4a328f46eaac3bb8b19ddc091306de83348be9cf
Diffstat (limited to 'src/libstore/local-store.cc')
-rw-r--r--src/libstore/local-store.cc27
1 files changed, 10 insertions, 17 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index ee401d7fc..a27e43989 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -1856,24 +1856,17 @@ std::optional<const Realisation> LocalStore::queryRealisation_(
return { res };
}
-void LocalStore::queryRealisationUncached(const DrvOutput & id,
- Callback<std::shared_ptr<const Realisation>> callback) noexcept
+std::shared_ptr<const Realisation> LocalStore::queryRealisationUncached(const DrvOutput & id)
{
- try {
- auto maybeRealisation
- = retrySQLite<std::optional<const Realisation>>([&]() {
- auto state(_state.lock());
- return queryRealisation_(*state, id);
- });
- if (maybeRealisation)
- callback(
- std::make_shared<const Realisation>(maybeRealisation.value()));
- else
- callback(nullptr);
-
- } catch (...) {
- callback.rethrow();
- }
+ auto maybeRealisation
+ = retrySQLite<std::optional<const Realisation>>([&]() {
+ auto state(_state.lock());
+ return queryRealisation_(*state, id);
+ });
+ if (maybeRealisation)
+ return std::make_shared<const Realisation>(maybeRealisation.value());
+ else
+ return nullptr;
}
ContentAddress LocalStore::hashCAPath(