add subscribe for node events

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
Evan Hazlett 2018-06-09 13:28:25 -04:00
parent aa0c2abf84
commit 5dace354b7
No known key found for this signature in database
GPG Key ID: A519480096146526
1 changed files with 12 additions and 0 deletions

View File

@ -50,3 +50,15 @@ func NewAgent(cfg *Config) (*Agent, error) {
grpcServer: grpcServer,
}, nil
}
// Subscribe subscribes to the node event channel
func (a *Agent) Subscribe(ch chan *NodeEvent) {
go func() {
for {
select {
case evt := <-a.nodeEventChan:
ch <- evt
}
}
}()
}