Don't stream Node.Chidren, because it is never used in the probe

Remove code dedicated to streaming NodeSet
This commit is contained in:
Bryan Boreham
2018-07-20 19:56:04 +00:00
parent 69e61cb362
commit 6dda67b11d
2 changed files with 1 additions and 42 deletions

View File

@@ -20,7 +20,7 @@ type Node struct {
Latest StringLatestMap `json:"latest,omitempty"`
Metrics Metrics `json:"metrics,omitempty" deepequal:"nil==empty"`
Parents Sets `json:"parents,omitempty"`
Children NodeSet `json:"children,omitempty"`
Children NodeSet `json:"-"`
}
// MakeNode creates a new Node with no initial metadata.

View File

@@ -5,7 +5,6 @@ import (
"fmt"
"github.com/davecgh/go-spew/spew"
"github.com/ugorji/go/codec"
"github.com/weaveworks/ps"
"github.com/weaveworks/scope/test/reflect"
@@ -146,43 +145,3 @@ func (n NodeSet) String() string {
func (n NodeSet) DeepEqual(o NodeSet) bool {
return mapEqual(n.psMap, o.psMap, reflect.DeepEqual)
}
func (n NodeSet) toIntermediate() []Node {
intermediate := make([]Node, 0, n.Size())
n.ForEach(func(node Node) {
intermediate = append(intermediate, node)
})
return intermediate
}
func (n NodeSet) fromIntermediate(nodes []Node) NodeSet {
return MakeNodeSet(nodes...)
}
// CodecEncodeSelf implements codec.Selfer
func (n *NodeSet) CodecEncodeSelf(encoder *codec.Encoder) {
if n.psMap != nil {
encoder.Encode(n.toIntermediate())
} else {
encoder.Encode(nil)
}
}
// CodecDecodeSelf implements codec.Selfer
func (n *NodeSet) CodecDecodeSelf(decoder *codec.Decoder) {
in := []Node{}
if err := decoder.Decode(&in); err != nil {
return
}
*n = NodeSet{}.fromIntermediate(in)
}
// MarshalJSON shouldn't be used, use CodecEncodeSelf instead
func (NodeSet) MarshalJSON() ([]byte, error) {
panic("MarshalJSON shouldn't be used, use CodecEncodeSelf instead")
}
// UnmarshalJSON shouldn't be used, use CodecDecodeSelf instead
func (*NodeSet) UnmarshalJSON(b []byte) error {
panic("UnmarshalJSON shouldn't be used, use CodecDecodeSelf instead")
}