SetupEventsChan wires internal sync event to external status channels
(statusChan chan model.Status, batchDone chan interface{}, events chan interface{})
| 217 | |
| 218 | // SetupEventsChan wires internal sync event to external status channels |
| 219 | func (s *Sync) SetupEventsChan(statusChan chan model.Status, batchDone chan interface{}, events chan interface{}) { |
| 220 | s.statuses = statusChan |
| 221 | s.runDone = batchDone |
| 222 | if events != nil { |
| 223 | // Forward internal events to sync event |
| 224 | s.watchConn = make(chan *model.EndpointStatus) |
| 225 | go func() { |
| 226 | defer func() { |
| 227 | recover() |
| 228 | }() |
| 229 | for e := range s.watchConn { |
| 230 | events <- e |
| 231 | } |
| 232 | }() |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | func (s *Sync) SetupCmd(cmd *model.Command) { |
| 237 | s.cmd = cmd |
no test coverage detected