Move timestamp up from 'Latest' string map to Report level

We never merge multiple string values in a single node from different
sources, so it's sufficient to take the value from the latest report.
This commit is contained in:
Bryan Boreham
2019-10-16 07:52:45 +00:00
parent e4660b081e
commit 07287c6ac0
15 changed files with 138 additions and 217 deletions

View File

@@ -81,7 +81,7 @@ func (c *connectionCounters) add(dns report.DNSRecords, outgoing bool, localNode
srcEndpoint, dstEndpoint = localEndpoint, remoteEndpoint
}
connectionID := srcEndpoint.ID
if copySrcEndpointID, _, ok := srcEndpoint.Latest.LookupEntry(endpoint.CopyOf); ok {
if copySrcEndpointID, ok := srcEndpoint.Latest.Lookup(endpoint.CopyOf); ok {
connectionID = copySrcEndpointID
}
if _, ok := c.counted[connectionID]; ok {
@@ -237,7 +237,7 @@ func endpointChildIDsAndCopyMapOf(n report.Node) (report.IDList, map[string]stri
n.Children.ForEach(func(child report.Node) {
if child.Topology == report.Endpoint {
ids = ids.Add(child.ID)
if copyID, _, ok := child.Latest.LookupEntry(endpoint.CopyOf); ok {
if copyID, ok := child.Latest.Lookup(endpoint.CopyOf); ok {
copies[child.ID] = copyID
}
}

View File

@@ -79,7 +79,7 @@ func hasMoreThanOneConnection(n report.Node, endpoints report.Nodes) bool {
firstRealEndpointID := ""
for _, endpointID := range n.Adjacency {
if ep, ok := endpoints[endpointID]; ok {
if copyID, _, ok := ep.Latest.LookupEntry(report.CopyOf); ok {
if copyID, ok := ep.Latest.Lookup(report.CopyOf); ok {
endpointID = copyID
}
}