From 3447dbfb2c0f3bf7e31577bf2d5908b14ba59601 Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Thu, 16 May 2024 17:58:27 +0200 Subject: libstore: rewrite narFromPath as generator Change-Id: Ifa783c2c65c06ddd1d0212016d5bfd07666ea91c --- src/libstore/legacy-ssh-store.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/libstore/legacy-ssh-store.cc') diff --git a/src/libstore/legacy-ssh-store.cc b/src/libstore/legacy-ssh-store.cc index b4f3854d5..57d333f12 100644 --- a/src/libstore/legacy-ssh-store.cc +++ b/src/libstore/legacy-ssh-store.cc @@ -227,13 +227,15 @@ struct LegacySSHStore : public virtual LegacySSHStoreConfig, public virtual Stor throw Error("failed to add path '%s' to remote host '%s'", printStorePath(info.path), host); } - void narFromPath(const StorePath & path, Sink & sink) override + WireFormatGenerator narFromPath(const StorePath & path) override { auto conn(connections->get()); conn->to << ServeProto::Command::DumpStorePath << printStorePath(path); conn->to.flush(); - sink << copyNAR(conn->from); + return [] (auto conn) -> WireFormatGenerator { + co_yield copyNAR(conn->from); + }(std::move(conn)); } std::optional queryPathFromHashPart(const std::string & hashPart) override -- cgit v1.2.3