| 103 | } |
| 104 | |
| 105 | std::vector<string> DumpLinkHashMap(const SigNode::LinkHashMap& link_hash_map) { |
| 106 | // The entries in this map are ordered by hash value which might change |
| 107 | // at any point. Re-order them by the link tag. |
| 108 | std::map<SigNode::LinkTag, size_t> tags; |
| 109 | for (const auto& entry : link_hash_map) { |
| 110 | tags[entry.second.tag] = entry.first; |
| 111 | } |
| 112 | |
| 113 | std::vector<string> result; |
| 114 | for (const auto& id : tags) { |
| 115 | // For predictability, the nodes need to be sorted. |
| 116 | std::vector<string> nodes; |
| 117 | for (const auto& peer : link_hash_map.at(id.second).peers) { |
| 118 | nodes.emplace_back(peer->name()); |
| 119 | } |
| 120 | std::sort(nodes.begin(), nodes.end()); |
| 121 | result.emplace_back(string(id.first.local) + ":" + string(id.first.remote) + |
| 122 | ": " + absl::StrJoin(nodes, ", ")); |
| 123 | } |
| 124 | return result; |
| 125 | } |
| 126 | |
| 127 | std::vector<string> DumpHashedPeerVector( |
| 128 | const SigNode::HashedPeerVector& hashed_peers) { |