aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/remote-store.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/remote-store.cc')
-rw-r--r--src/libstore/remote-store.cc51
1 files changed, 22 insertions, 29 deletions
diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc
index 94c426c02..1d3fa93c1 100644
--- a/src/libstore/remote-store.cc
+++ b/src/libstore/remote-store.cc
@@ -612,39 +612,32 @@ void RemoteStore::registerDrvOutput(const Realisation & info)
conn.processStderr();
}
-void RemoteStore::queryRealisationUncached(const DrvOutput & id,
- Callback<std::shared_ptr<const Realisation>> callback) noexcept
+std::shared_ptr<const Realisation> RemoteStore::queryRealisationUncached(const DrvOutput & id)
{
- try {
- auto conn(getConnection());
-
- if (GET_PROTOCOL_MINOR(conn->daemonVersion) < 27) {
- warn("the daemon is too old to support content-addressed derivations, please upgrade it to 2.4");
- return callback(nullptr);
- }
+ auto conn(getConnection());
- conn->to << WorkerProto::Op::QueryRealisation;
- conn->to << id.to_string();
- conn.processStderr();
+ if (GET_PROTOCOL_MINOR(conn->daemonVersion) < 27) {
+ warn("the daemon is too old to support content-addressed derivations, please upgrade it to 2.4");
+ return nullptr;
+ }
- auto real = [&]() -> std::shared_ptr<const Realisation> {
- if (GET_PROTOCOL_MINOR(conn->daemonVersion) < 31) {
- auto outPaths = WorkerProto::Serialise<std::set<StorePath>>::read(
- *this, *conn);
- if (outPaths.empty())
- return nullptr;
- return std::make_shared<const Realisation>(Realisation { .id = id, .outPath = *outPaths.begin() });
- } else {
- auto realisations = WorkerProto::Serialise<std::set<Realisation>>::read(
- *this, *conn);
- if (realisations.empty())
- return nullptr;
- return std::make_shared<const Realisation>(*realisations.begin());
- }
- }();
+ conn->to << WorkerProto::Op::QueryRealisation;
+ conn->to << id.to_string();
+ conn.processStderr();
- callback(std::shared_ptr<const Realisation>(real));
- } catch (...) { return callback.rethrow(); }
+ if (GET_PROTOCOL_MINOR(conn->daemonVersion) < 31) {
+ auto outPaths = WorkerProto::Serialise<std::set<StorePath>>::read(
+ *this, *conn);
+ if (outPaths.empty())
+ return nullptr;
+ return std::make_shared<const Realisation>(Realisation { .id = id, .outPath = *outPaths.begin() });
+ } else {
+ auto realisations = WorkerProto::Serialise<std::set<Realisation>>::read(
+ *this, *conn);
+ if (realisations.empty())
+ return nullptr;
+ return std::make_shared<const Realisation>(*realisations.begin());
+ }
}
void RemoteStore::copyDrvsFromEvalStore(