refactor: simplify joinResults.add*

After dropping extra metadata in the rest of this PR, our usage of
joinResults.add* only ever ends creating minimal nodes, from just an
id and topology. Hence joinResults.add* can be invoked with simply an
id and topology instead of a generic node creation function.
This commit is contained in:
Matthias Radestock
2017-12-29 14:40:18 +00:00
parent a7b6bb09a1
commit c8ea7ba49e
5 changed files with 22 additions and 36 deletions
+4 -3
View File
@@ -82,7 +82,7 @@ func (c connectionJoin) Render(rpt report.Report) Nodes {
// Nodes without a hostid may be pseudo nodes - if so, pass through to result
if _, ok := m.Latest.Lookup(report.HostNodeID); !ok {
if id, ok := externalNodeID(m, addr, local); ok {
ret.addChild(m, id, newPseudoNode)
ret.addChild(m, id, Pseudo)
continue
}
}
@@ -94,8 +94,9 @@ func (c connectionJoin) Render(rpt report.Report) Nodes {
id, found = ipNodes[report.MakeScopedEndpointNodeID(scope, addr, port)]
}
if found && id != "" { // not one we blanked out earlier
// We are guaranteed to find the id, so no need to pass a node constructor.
ret.addChild(m, id, nil)
// We are guaranteed to find the id, so really this should
// never end up creating a node.
ret.addChild(m, id, report.Container)
}
}
return ret.result(endpoints)