Merge pull request #858 from weaveworks/immutable-nodeset

use immutability for the NodeSet
This commit is contained in:
Tom Wilkie
2016-01-27 13:56:14 -08:00
5 changed files with 194 additions and 93 deletions

View File

@@ -101,15 +101,13 @@ var (
func children(n render.RenderableNode) []NodeSummaryGroup {
summaries := map[string][]NodeSummary{}
for _, child := range n.Children {
if child.ID == n.ID {
continue
n.Children.ForEach(func(child report.Node) {
if child.ID != n.ID {
if summary, ok := MakeNodeSummary(child); ok {
summaries[child.Topology] = append(summaries[child.Topology], summary)
}
}
if summary, ok := MakeNodeSummary(child); ok {
summaries[child.Topology] = append(summaries[child.Topology], summary)
}
}
})
nodeSummaryGroups := []NodeSummaryGroup{}
for _, spec := range nodeSummaryGroupSpecs {

View File

@@ -1,12 +1,12 @@
package render_test
import (
"reflect"
"testing"
"github.com/weaveworks/scope/render"
"github.com/weaveworks/scope/report"
"github.com/weaveworks/scope/test"
"github.com/weaveworks/scope/test/reflect"
)
func TestFilterRender(t *testing.T) {

View File

@@ -141,7 +141,7 @@ func (rn RenderableNode) Copy() RenderableNode {
func (rn RenderableNode) Prune() RenderableNode {
cp := rn.Copy()
cp.Node = report.MakeNode().WithAdjacent(cp.Node.Adjacency...)
cp.Children = nil
cp.Children = report.EmptyNodeSet
return cp
}