Pull a full list of peers from vNodes into our cache */
| 58 | |
| 59 | /** Pull a full list of peers from vNodes into our cache */ |
| 60 | void refreshPeers(interfaces::Node& node) |
| 61 | { |
| 62 | { |
| 63 | cachedNodeStats.clear(); |
| 64 | |
| 65 | interfaces::Node::NodesStats nodes_stats; |
| 66 | node.getNodesStats(nodes_stats); |
| 67 | cachedNodeStats.reserve(nodes_stats.size()); |
| 68 | for (auto& node_stats : nodes_stats) |
| 69 | { |
| 70 | CNodeCombinedStats stats; |
| 71 | stats.nodeStats = std::get<0>(node_stats); |
| 72 | stats.fNodeStateStatsAvailable = std::get<1>(node_stats); |
| 73 | stats.nodeStateStats = std::get<2>(node_stats); |
| 74 | cachedNodeStats.append(stats); |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | if (sortColumn >= 0) |
| 79 | // sort cacheNodeStats (use stable sort to prevent rows jumping around unnecessarily) |
| 80 | qStableSort(cachedNodeStats.begin(), cachedNodeStats.end(), NodeLessThan(sortColumn, sortOrder)); |
| 81 | |
| 82 | // build index map |
| 83 | mapNodeRows.clear(); |
| 84 | int row = 0; |
| 85 | for (const CNodeCombinedStats& stats : cachedNodeStats) |
| 86 | mapNodeRows.insert(std::pair<NodeId, int>(stats.nodeStats.nodeid, row++)); |
| 87 | } |
| 88 | |
| 89 | int size() const |
| 90 | { |
no test coverage detected