From 17965bf11c55daee81729151f9876e55fdeaf9c1 Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Sat, 27 Apr 2024 23:44:12 +0200 Subject: libstore: un-callback-ify Store::queryRealisationUncached Change-Id: I4a328f46eaac3bb8b19ddc091306de83348be9cf --- src/libstore/binary-cache-store.cc | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src/libstore/binary-cache-store.cc') 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> callback) noexcept +std::shared_ptr 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(realisation)); - } catch (...) { - callback.rethrow(); - } + auto data = getFile(outputInfoFilePath); + if (!data) return {}; + + auto realisation = Realisation::fromJSON( + nlohmann::json::parse(*data), outputInfoFilePath); + return std::make_shared(realisation); } void BinaryCacheStore::registerDrvOutput(const Realisation& info) { -- cgit v1.2.3