forked from influxdata/kapacitor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
union.go
33 lines (31 loc) · 909 Bytes
/
union.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package pipeline
// Takes the union of all of its parents.
// The union is just a simple pass through.
// Each data points received from each parent is passed onto children nodes
// without modification.
//
// Example:
// var logins = stream.from().measurement('logins')
// var logouts = stream.from().measurement('logouts')
// var frontpage = stream.from().measurement('frontpage')
// // Union all user actions into a single stream
// logins.union(logouts, frontpage)
// .rename('user_actions')
// ...
//
type UnionNode struct {
chainnode
// The new name of the stream.
// If empty the name of the left node
// (i.e. `leftNode.union(otherNode1, otherNode2)`) is used.
Rename string
}
func newUnionNode(e EdgeType, nodes []Node) *UnionNode {
u := &UnionNode{
chainnode: newBasicChainNode("union", e, e),
}
for _, n := range nodes {
n.linkChild(u)
}
return u
}