mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-04 10:41:14 +00:00
By reducing the number of times we refer to every topology by name line by line, we make it easier to add new topologies, reduce the risk of bugs where a topology is not listed, and reduce the risk of the repeated lines getting out of sync with each other. We introduce two new methods to assist this: WalkPairedTopologies, a modified WalkTopologies that gives the called function the same topology from two reports. This is used, for example, to implement Copy and Merge. TopologyMap, which returns a map of all topologies by name. This is then used to implement all other methods. This leaves only 4 instances of listing topologies: In the consts at the top of the file, to give it a name In the struct itself In the constructor, where we need to set per-topology settings In TopologyMap