Skip to content

Commit

Permalink
Fixing AlertNodeData (AnonFields) and not-ignored types and functions
Browse files Browse the repository at this point in the history
  • Loading branch information
karel-rehor committed Nov 15, 2017
1 parent 211cce4 commit 532deb9
Show file tree
Hide file tree
Showing 29 changed files with 113 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pipeline/alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ func newAlertNode(wants EdgeType) *AlertNode {
}

// MarshalJSON converts AlertNode to JSON
// tick:ignore
func (n *AlertNode) MarshalJSON() ([]byte, error) {
type Alias AlertNodeData
var raw = &struct {
Expand All @@ -396,6 +397,7 @@ func (n *AlertNode) MarshalJSON() ([]byte, error) {
}

// UnmarshalJSON converts JSON to an AlertNode
// tick:ignore
func (n *AlertNode) UnmarshalJSON(data []byte) error {
type Alias AlertNode
var raw = &struct {
Expand Down
2 changes: 2 additions & 0 deletions pipeline/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func newBatchNode() *BatchNode {
}

// MarshalJSON converts BatchNode to JSON
// tick:ignore
func (n *BatchNode) MarshalJSON() ([]byte, error) {
type Alias BatchNode
var raw = &struct {
Expand All @@ -61,6 +62,7 @@ func (n *BatchNode) MarshalJSON() ([]byte, error) {
}

// UnmarshalJSON converts JSON to an BatchNode
// tick:ignore
func (n *BatchNode) UnmarshalJSON(data []byte) error {
type Alias BatchNode
var raw = &struct {
Expand Down
2 changes: 2 additions & 0 deletions pipeline/combine.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ func newCombineNode(e EdgeType, lambdas []*ast.LambdaNode) *CombineNode {
}

// MarshalJSON converts CombineNode to JSON
// tick:ignore
func (n *CombineNode) MarshalJSON() ([]byte, error) {
type Alias CombineNode
var raw = &struct {
Expand All @@ -112,6 +113,7 @@ func (n *CombineNode) MarshalJSON() ([]byte, error) {
}

// UnmarshalJSON converts JSON to an CombineNode
// tick:ignore
func (n *CombineNode) UnmarshalJSON(data []byte) error {
type Alias CombineNode
var raw = &struct {
Expand Down
2 changes: 2 additions & 0 deletions pipeline/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func newDefaultNode(e EdgeType) *DefaultNode {
}

// MarshalJSON converts DefaultNode to JSON
// tick:ignore
func (n *DefaultNode) MarshalJSON() ([]byte, error) {
type Alias DefaultNode
var raw = &struct {
Expand All @@ -59,6 +60,7 @@ func (n *DefaultNode) MarshalJSON() ([]byte, error) {
}

// UnmarshalJSON converts JSON to an DefaultNode
// tick:ignore
func (n *DefaultNode) UnmarshalJSON(data []byte) error {
type Alias DefaultNode
var raw = &struct {
Expand Down
2 changes: 2 additions & 0 deletions pipeline/derivative.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func newDerivativeNode(wants EdgeType, field string) *DerivativeNode {
}

// MarshalJSON converts DerivativeNode to JSON
// tick:ignore
func (n *DerivativeNode) MarshalJSON() ([]byte, error) {
type Alias DerivativeNode
var raw = &struct {
Expand All @@ -79,6 +80,7 @@ func (n *DerivativeNode) MarshalJSON() ([]byte, error) {
}

// UnmarshalJSON converts JSON to an DerivativeNode
// tick:ignore
func (n *DerivativeNode) UnmarshalJSON(data []byte) error {
type Alias DerivativeNode
var raw = &struct {
Expand Down
2 changes: 2 additions & 0 deletions pipeline/eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func newEvalNode(e EdgeType, exprs []*ast.LambdaNode) *EvalNode {
}

// MarshalJSON converts EvalNode to JSON
// tick:ignore
func (n *EvalNode) MarshalJSON() ([]byte, error) {
type Alias EvalNode
var raw = &struct {
Expand All @@ -76,6 +77,7 @@ func (n *EvalNode) MarshalJSON() ([]byte, error) {
}

// UnmarshalJSON converts JSON to an EvalNode
// tick:ignore
func (n *EvalNode) UnmarshalJSON(data []byte) error {
type Alias EvalNode
var raw = &struct {
Expand Down
2 changes: 2 additions & 0 deletions pipeline/flatten.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func newFlattenNode(e EdgeType) *FlattenNode {
}

// MarshalJSON converts FlattenNode to JSON
// tick:ignore
func (n *FlattenNode) MarshalJSON() ([]byte, error) {
type Alias FlattenNode
var raw = &struct {
Expand All @@ -92,6 +93,7 @@ func (n *FlattenNode) MarshalJSON() ([]byte, error) {
}

// UnmarshalJSON converts JSON to an FlattenNode
// tick:ignore
func (n *FlattenNode) UnmarshalJSON(data []byte) error {
type Alias FlattenNode
var raw = &struct {
Expand Down
2 changes: 2 additions & 0 deletions pipeline/group_by.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func newGroupByNode(wants EdgeType, dims []interface{}) *GroupByNode {
}

// MarshalJSON converts GroupByNode to JSON
// tick:ignore
func (n *GroupByNode) MarshalJSON() ([]byte, error) {
type Alias GroupByNode
var raw = &struct {
Expand All @@ -61,6 +62,7 @@ func (n *GroupByNode) MarshalJSON() ([]byte, error) {
}

// UnmarshalJSON converts JSON to an GroupByNode
// tick:ignore
func (n *GroupByNode) UnmarshalJSON(data []byte) error {
type Alias GroupByNode
var raw = &struct {
Expand Down
2 changes: 2 additions & 0 deletions pipeline/http_out.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func newHTTPOutNode(wants EdgeType, endpoint string) *HTTPOutNode {
}

// MarshalJSON converts HTTPOutNode to JSON
// tick:ignore
func (n *HTTPOutNode) MarshalJSON() ([]byte, error) {
type Alias HTTPOutNode
var raw = &struct {
Expand All @@ -53,6 +54,7 @@ func (n *HTTPOutNode) MarshalJSON() ([]byte, error) {
}

// UnmarshalJSON converts JSON to an HTTPOutNode
// tick:ignore
func (n *HTTPOutNode) UnmarshalJSON(data []byte) error {
type Alias HTTPOutNode
var raw = &struct {
Expand Down
2 changes: 2 additions & 0 deletions pipeline/http_post.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func newHTTPPostNode(wants EdgeType, urls ...string) *HTTPPostNode {
}

// MarshalJSON converts HTTPPostNode to JSON
// tick:ignore
func (n *HTTPPostNode) MarshalJSON() ([]byte, error) {
type Alias HTTPPostNode
var raw = &struct {
Expand All @@ -83,6 +84,7 @@ func (n *HTTPPostNode) MarshalJSON() ([]byte, error) {
}

// UnmarshalJSON converts JSON to an HTTPPostNode
// tick:ignore
func (n *HTTPPostNode) UnmarshalJSON(data []byte) error {
type Alias HTTPPostNode
var raw = &struct {
Expand Down
2 changes: 2 additions & 0 deletions pipeline/influxdb_out.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ func newInfluxDBOutNode(wants EdgeType) *InfluxDBOutNode {
}

// MarshalJSON converts InfluxDBOutNode to JSON
// tick:ignore
func (n *InfluxDBOutNode) MarshalJSON() ([]byte, error) {
type Alias InfluxDBOutNode
var raw = &struct {
Expand All @@ -94,6 +95,7 @@ func (n *InfluxDBOutNode) MarshalJSON() ([]byte, error) {
}

// UnmarshalJSON converts JSON to an InfluxDBOutNode
// tick:ignore
func (n *InfluxDBOutNode) UnmarshalJSON(data []byte) error {
type Alias InfluxDBOutNode
var raw = &struct {
Expand Down
2 changes: 2 additions & 0 deletions pipeline/influxql.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func newInfluxQLNode(method, field string, wants, provides EdgeType, reducer Red
}

// MarshalJSON converts InfluxQLNode to JSON
// tick:ignore
func (n *InfluxQLNode) MarshalJSON() ([]byte, error) {
type Alias InfluxQLNode
var raw = &struct {
Expand All @@ -87,6 +88,7 @@ func (n *InfluxQLNode) MarshalJSON() ([]byte, error) {
}

// UnmarshalJSON converts JSON to an InfluxQLNode
// tick:ignore
func (n *InfluxQLNode) UnmarshalJSON(data []byte) error {
type Alias InfluxQLNode
var raw = &struct {
Expand Down
2 changes: 2 additions & 0 deletions pipeline/join.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ func newJoinNode(e EdgeType, parents []Node) *JoinNode {
}

// MarshalJSON converts JoinNode to JSON
// tick:ignore
func (n *JoinNode) MarshalJSON() ([]byte, error) {
type Alias JoinNode
var raw = &struct {
Expand All @@ -156,6 +157,7 @@ func (n *JoinNode) MarshalJSON() ([]byte, error) {
}

// UnmarshalJSON converts JSON to an JoinNode
// tick:ignore
func (n *JoinNode) UnmarshalJSON(data []byte) error {
type Alias JoinNode
var raw = &struct {
Expand Down
5 changes: 5 additions & 0 deletions pipeline/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,21 @@ const (
)

// TypeOf is a helper struct to add type information for each pipeline node
// tick:ignore
type TypeOf struct {
Type string `json:"typeOf"`
ID ID `json:"id,string"`
}

// Edge is a connection between a parent ID and a ChildID
// tick:ignore
type Edge struct {
Parent ID `json:"parent,string"`
Child ID `json:"child,string"`
}

// JSONPipeline is the JSON serialization format for Pipeline
// tick:ignore
type JSONPipeline struct {
Nodes []json.RawMessage `json:"nodes"`
Edges []Edge `json:"edges"`
Expand All @@ -39,6 +42,7 @@ type JSONPipeline struct {
type Graph map[ID][]ID

// PipelineSorter performs topological sort on the Edges of JSONPipeline.
// tick:ignore
type PipelineSorter struct {
Edges []Edge
ChildrenOf Graph
Expand Down Expand Up @@ -222,6 +226,7 @@ func init() {
}

// IRNode is the intermediate representation of a node between JSON unmarshaling and a pipeline Node
// tick:ignore
type IRNode struct {
Raw json.RawMessage
TypeOf TypeOf
Expand Down
2 changes: 2 additions & 0 deletions pipeline/k8s_autoscale.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ func newK8sAutoscaleNode(e EdgeType) *K8sAutoscaleNode {
}

// MarshalJSON converts K8sAutoscaleNode to JSON
// tick:ignore
func (n *K8sAutoscaleNode) MarshalJSON() ([]byte, error) {
type Alias K8sAutoscaleNode
var raw = &struct {
Expand All @@ -176,6 +177,7 @@ func (n *K8sAutoscaleNode) MarshalJSON() ([]byte, error) {
}

// UnmarshalJSON converts JSON to an K8sAutoscaleNode
// tick:ignore
func (n *K8sAutoscaleNode) UnmarshalJSON(data []byte) error {
type Alias K8sAutoscaleNode
var raw = &struct {
Expand Down
2 changes: 2 additions & 0 deletions pipeline/kapacitor_loopback.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func newKapacitorLoopbackNode(wants EdgeType) *KapacitorLoopbackNode {
}

// MarshalJSON converts KapacitorLoopbackNode to JSON
// tick:ignore
func (n *KapacitorLoopbackNode) MarshalJSON() ([]byte, error) {
type Alias KapacitorLoopbackNode
var raw = &struct {
Expand All @@ -67,6 +68,7 @@ func (n *KapacitorLoopbackNode) MarshalJSON() ([]byte, error) {
}

// UnmarshalJSON converts JSON to an KapacitorLoopbackNode
// tick:ignore
func (n *KapacitorLoopbackNode) UnmarshalJSON(data []byte) error {
type Alias KapacitorLoopbackNode
var raw = &struct {
Expand Down
2 changes: 2 additions & 0 deletions pipeline/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func newLogNode(wants EdgeType) *LogNode {
}

// MarshalJSON converts LogNode to JSON
// tick:ignore
func (n *LogNode) MarshalJSON() ([]byte, error) {
type Alias LogNode
var raw = &struct {
Expand All @@ -50,6 +51,7 @@ func (n *LogNode) MarshalJSON() ([]byte, error) {
}

// UnmarshalJSON converts JSON to an LogNode
// tick:ignore
func (n *LogNode) UnmarshalJSON(data []byte) error {
type Alias LogNode
var raw = &struct {
Expand Down
2 changes: 2 additions & 0 deletions pipeline/sample.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func newSampleNode(wants EdgeType, rate interface{}) *SampleNode {
}

// MarshalJSON converts SampleNode to JSON
// tick:ignore
func (n *SampleNode) MarshalJSON() ([]byte, error) {
type Alias SampleNode
var raw = &struct {
Expand All @@ -74,6 +75,7 @@ func (n *SampleNode) MarshalJSON() ([]byte, error) {
}

// UnmarshalJSON converts JSON to an SampleNode
// tick:ignore
func (n *SampleNode) UnmarshalJSON(data []byte) error {
type Alias SampleNode
var raw = &struct {
Expand Down
2 changes: 2 additions & 0 deletions pipeline/shift.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func newShiftNode(wants EdgeType, shift time.Duration) *ShiftNode {
}

// MarshalJSON converts ShiftNode to JSON
// tick:ignore
func (n *ShiftNode) MarshalJSON() ([]byte, error) {
type Alias ShiftNode
var raw = &struct {
Expand All @@ -56,6 +57,7 @@ func (n *ShiftNode) MarshalJSON() ([]byte, error) {
}

// UnmarshalJSON converts JSON to an ShiftNode
// tick:ignore
func (n *ShiftNode) UnmarshalJSON(data []byte) error {
type Alias ShiftNode
var raw = &struct {
Expand Down
2 changes: 2 additions & 0 deletions pipeline/sideload.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func (n *SideloadNode) Tag(t string, v string) *SideloadNode {
}

// MarshalJSON converts SideloadNode to JSON
// tick:ignore
func (n *SideloadNode) MarshalJSON() ([]byte, error) {
type Alias SideloadNode
var raw = &struct {
Expand All @@ -89,6 +90,7 @@ func (n *SideloadNode) MarshalJSON() ([]byte, error) {
}

// UnmarshalJSON converts JSON to an SideloadNode
// tick:ignore
func (n *SideloadNode) UnmarshalJSON(data []byte) error {
type Alias SideloadNode
var raw = &struct {
Expand Down
2 changes: 2 additions & 0 deletions pipeline/state_tracking.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func newStateDurationNode(wants EdgeType, predicate *ast.LambdaNode) *StateDurat
}

// MarshalJSON converts StateDurationNode to JSON
// tick:ignore
func (n *StateDurationNode) MarshalJSON() ([]byte, error) {
type Alias StateDurationNode
var raw = &struct {
Expand All @@ -80,6 +81,7 @@ func (n *StateDurationNode) MarshalJSON() ([]byte, error) {
}

// UnmarshalJSON converts JSON to an StateDurationNode
// tick:ignore
func (n *StateDurationNode) UnmarshalJSON(data []byte) error {
type Alias StateDurationNode
var raw = &struct {
Expand Down
2 changes: 2 additions & 0 deletions pipeline/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func newStatsNode(n Node, interval time.Duration) *StatsNode {
}

// MarshalJSON converts StatsNode to JSON
// tick:ignore
func (n *StatsNode) MarshalJSON() ([]byte, error) {
type Alias StatsNode
var raw = &struct {
Expand All @@ -78,6 +79,7 @@ func (n *StatsNode) MarshalJSON() ([]byte, error) {
}

// UnmarshalJSON converts JSON to an StatsNode
// tick:ignore
func (n *StatsNode) UnmarshalJSON(data []byte) error {
type Alias StatsNode
var raw = &struct {
Expand Down
Loading

0 comments on commit 532deb9

Please sign in to comment.