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
This commit is contained in:
eldritch horrors
2025-06-11 22:29:30 +02:00
parent ab8f4ae7e3
commit ec374bc6e2
+4 -4
View File
@@ -583,11 +583,11 @@ try {
auto conn(TRY_AWAIT(getConnection()));
conn->to << WorkerProto::Op::FindRoots;
conn.processStderr();
size_t count = readNum<size_t>(conn->from);
auto roots =
WorkerProto::Serialise<std::vector<std::tuple<std::string, StorePath>>>::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;