mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-19 13:29:35 +00:00
Don't stream Node.Chidren, because it is never used in the probe
Remove code dedicated to streaming NodeSet
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user