velodrome/transform/transform.go
func Dispatch(plugin plugins.Plugin, DB *InfluxDB, issues chan sql.Issue, eventsCommentsChannel chan interface{}) {
	for {
		var points []plugins.Point
		select {
		case issue, ok := <-issues:
			if !ok {
				return
			}
			points = plugin.ReceiveIssue(issue)
		case event, ok := <-eventsCommentsChannel:
			if !ok {
				return
			}
			switch event := event.(type) {
			case sql.IssueEvent:
				points = plugin.ReceiveIssueEvent(event)
			case sql.Comment:
				points = plugin.ReceiveComment(event)
			default:
				glog.Fatal("Received invalid object: ", event)
			}
		}

		for _, point := range points {
			if err := DB.Push(point.Tags, point.Values, point.Date); err != nil {
				glog.Fatal("Failed to push point: ", err)
			}
		}
	}
}
func Dispatch(plugin plugins.Plugin, DB *InfluxDB, issues chan sql.Issue, eventsCommentsChannel chan interface{}) {
	for {
		var points []plugins.Point
		select {
		case issue, ok := <-issues:
			if !ok {
				return
			}
			points = plugin.ReceiveIssue(issue)
		case event, ok := <-eventsCommentsChannel:
			if !ok {
				return
			}
			switch event := event.(type) {
			case sql.IssueEvent:
				points = plugin.ReceiveIssueEvent(event)
			case sql.Comment:
				points = plugin.ReceiveComment(event)
			default:
				glog.Fatal("Received invalid object: ", event)
			}
		}

		for _, point := range points {
			if err := DB.Push(point.Tags, point.Values, point.Date); err != nil {
				glog.Fatal("Failed to push point: ", err)
			}
		}
	}
}
func Dispatch ( plugin plugins . Plugin , DB * InfluxDB , issues chan sql . Issue , eventsCommentsChannel chan interface { } ) { for { var points [ ] plugins . Point select { case issue , ok := <- issues : if ! ok { return } points = plugin . ReceiveIssue ( issue ) case event , ok := <- eventsCommentsChannel : if ! ok { return } switch event := event . ( type ) { case sql . IssueEvent : points = plugin . ReceiveIssueEvent ( event ) case sql . Comment : points = plugin . ReceiveComment ( event ) default : glog . Fatal ( " " , event ) } } for _ , point := range points { if err := DB . Push ( point . Tags , point . Values , point . Date ) ; err != nil { glog . Fatal ( " " , err ) } } } }
// Dispatch receives channels to each type of events, and dispatch them to each plugins.
Dispatch receives channels to each type of events and dispatch them to each plugins .