From ec374bc6e29a016dbf08fa31c166e37f87473d70 Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Wed, 11 Jun 2025 17:22:33 +0200 Subject: [PATCH] libstore: deserialize findRoots data as vector-of-tuples a size_t followed by as many pairs of things is exactly the format of a vector of two-element tuples. it would also be the format of a map, but Roots is a map of sets. rather than adding a serialization format fixed to this map type (or some wrapper) we can deserialize the response as a vector and convert it to the map-of-sets later as this is not run much. Change-Id: I3950c0f7cc59661576170ace10b25a6f8af1464b --- lix/libstore/remote-store.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lix/libstore/remote-store.cc b/lix/libstore/remote-store.cc index d9c37af61..dede49f79 100644 --- a/lix/libstore/remote-store.cc +++ b/lix/libstore/remote-store.cc @@ -583,11 +583,11 @@ try { auto conn(TRY_AWAIT(getConnection())); conn->to << WorkerProto::Op::FindRoots; conn.processStderr(); - size_t count = readNum(conn->from); + + auto roots = + WorkerProto::Serialise>>::read(*conn); Roots result; - while (count--) { - Path link = readString(conn->from); - auto target = parseStorePath(readString(conn->from)); + for (auto & [link, target] : roots) { result[std::move(target)].emplace(link); } co_return result;