21 lines
526 B
Go
21 lines
526 B
Go
package main
|
|
|
|
import "converge/pkg/models"
|
|
|
|
type StateNotifier struct {
|
|
webNotificationChannel chan *models.State
|
|
prometheusNotificationChannel chan *models.State
|
|
}
|
|
|
|
func NewStateNotifier() *StateNotifier {
|
|
return &StateNotifier{
|
|
webNotificationChannel: make(chan *models.State, 10),
|
|
prometheusNotificationChannel: make(chan *models.State, 10),
|
|
}
|
|
}
|
|
|
|
func (notifier StateNotifier) Publish(state *models.State) {
|
|
notifier.webNotificationChannel <- state
|
|
notifier.prometheusNotificationChannel <- state
|
|
}
|