aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/legacy-ssh-store.cc
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-04-27 21:24:36 +0200
committereldritch horrors <pennae@lix.systems>2024-05-09 23:18:05 +0200
commit2f4a1dd6e03f3005e1f11dc98dda2d2d214b1f6f (patch)
treea9c0d70d2c4fa611d4c405ec81ac2b8f9c9bf3cf /src/libstore/legacy-ssh-store.cc
parentc77bd88259dac6e6b7bcb29425905467aa2ef66f (diff)
libstore: de-callback-ify Store::queryPathInfoUncached
Change-Id: I23a156aaff5328f67ca16ccd85c0ea1711b21e35
Diffstat (limited to 'src/libstore/legacy-ssh-store.cc')
-rw-r--r--src/libstore/legacy-ssh-store.cc41
1 files changed, 19 insertions, 22 deletions
diff --git a/src/libstore/legacy-ssh-store.cc b/src/libstore/legacy-ssh-store.cc
index 2d8667a85..5044876cb 100644
--- a/src/libstore/legacy-ssh-store.cc
+++ b/src/libstore/legacy-ssh-store.cc
@@ -143,36 +143,33 @@ struct LegacySSHStore : public virtual LegacySSHStoreConfig, public virtual Stor
return *uriSchemes().begin() + "://" + host;
}
- void queryPathInfoUncached(const StorePath & path,
- Callback<std::shared_ptr<const ValidPathInfo>> callback) noexcept override
+ std::shared_ptr<const ValidPathInfo> queryPathInfoUncached(const StorePath & path) override
{
- try {
- auto conn(connections->get());
+ auto conn(connections->get());
- /* No longer support missing NAR hash */
- assert(GET_PROTOCOL_MINOR(conn->remoteVersion) >= 4);
+ /* No longer support missing NAR hash */
+ assert(GET_PROTOCOL_MINOR(conn->remoteVersion) >= 4);
- debug("querying remote host '%s' for info on '%s'", host, printStorePath(path));
+ debug("querying remote host '%s' for info on '%s'", host, printStorePath(path));
- conn->to << ServeProto::Command::QueryPathInfos << PathSet{printStorePath(path)};
- conn->to.flush();
+ conn->to << ServeProto::Command::QueryPathInfos << PathSet{printStorePath(path)};
+ conn->to.flush();
- auto p = readString(conn->from);
- if (p.empty()) return callback(nullptr);
- auto path2 = parseStorePath(p);
- assert(path == path2);
- auto info = std::make_shared<ValidPathInfo>(
- path,
- ServeProto::Serialise<UnkeyedValidPathInfo>::read(*this, *conn));
+ auto p = readString(conn->from);
+ if (p.empty()) return nullptr;
+ auto path2 = parseStorePath(p);
+ assert(path == path2);
+ auto info = std::make_shared<ValidPathInfo>(
+ path,
+ ServeProto::Serialise<UnkeyedValidPathInfo>::read(*this, *conn));
- if (info->narHash == Hash::dummy)
- throw Error("NAR hash is now mandatory");
+ if (info->narHash == Hash::dummy)
+ throw Error("NAR hash is now mandatory");
- auto s = readString(conn->from);
- assert(s == "");
+ auto s = readString(conn->from);
+ assert(s == "");
- callback(std::move(info));
- } catch (...) { callback.rethrow(); }
+ return info;
}
void addToStore(const ValidPathInfo & info, Source & source,