build-remote: Use std::map<StorePath, UnkeyedValidPathInfo>

It is less denormalized
This commit is contained in:
John Ericson 2023-12-07 14:10:28 -05:00
parent aaa0e128c1
commit 3f932a6731

View file

@ -154,7 +154,7 @@ static void copyClosureTo(
// FIXME: use Store::topoSortPaths(). // FIXME: use Store::topoSortPaths().
static StorePaths reverseTopoSortPaths(const std::map<StorePath, ValidPathInfo> & paths) static StorePaths reverseTopoSortPaths(const std::map<StorePath, UnkeyedValidPathInfo> & paths)
{ {
StorePaths sorted; StorePaths sorted;
StorePathSet visited; StorePathSet visited;
@ -322,7 +322,7 @@ static BuildResult performBuild(
return result; return result;
} }
static std::map<StorePath, ValidPathInfo> queryPathInfos( static std::map<StorePath, UnkeyedValidPathInfo> queryPathInfos(
Machine::Connection & conn, Machine::Connection & conn,
Store & localStore, Store & localStore,
StorePathSet & outputs, StorePathSet & outputs,
@ -331,7 +331,7 @@ static std::map<StorePath, ValidPathInfo> queryPathInfos(
{ {
/* Get info about each output path. */ /* Get info about each output path. */
std::map<StorePath, ValidPathInfo> infos; std::map<StorePath, UnkeyedValidPathInfo> infos;
conn.to << ServeProto::Command::QueryPathInfos; conn.to << ServeProto::Command::QueryPathInfos;
ServeProto::write(localStore, conn, outputs); ServeProto::write(localStore, conn, outputs);
conn.to.flush(); conn.to.flush();
@ -395,14 +395,16 @@ static void copyPathsFromRemote(
NarMemberDatas & narMembers, NarMemberDatas & narMembers,
Store & localStore, Store & localStore,
Store & destStore, Store & destStore,
const std::map<StorePath, ValidPathInfo> & infos const std::map<StorePath, UnkeyedValidPathInfo> & infos
) )
{ {
auto pathsSorted = reverseTopoSortPaths(infos); auto pathsSorted = reverseTopoSortPaths(infos);
for (auto & path : pathsSorted) { for (auto & path : pathsSorted) {
auto & info = infos.find(path)->second; auto & info = infos.find(path)->second;
copyPathFromRemote(conn, narMembers, localStore, destStore, info); copyPathFromRemote(
conn, narMembers, localStore, destStore,
ValidPathInfo { path, info });
} }
} }