Changes retrieves all changes from the watch path
(empty *remote.Empty, stream remote.Downstream_ChangesServer)
| 304 | |
| 305 | // Changes retrieves all changes from the watch path |
| 306 | func (d *Downstream) Changes(empty *remote.Empty, stream remote.Downstream_ChangesServer) error { |
| 307 | newState := make(map[string]*remote.Change) |
| 308 | throttle := time.Duration(d.options.Throttle) * time.Millisecond |
| 309 | |
| 310 | // Walk through the dir |
| 311 | if !d.options.Polling { |
| 312 | newState = d.getWatchState() |
| 313 | } else { |
| 314 | walkDir(d.options.RemotePath, d.options.RemotePath, d.ignoreMatcher, newState, d.options.NoRecursiveWatch, throttle) |
| 315 | } |
| 316 | |
| 317 | if newState != nil { |
| 318 | _, err := streamChanges(d.options.RemotePath, d.watchedFiles, newState, stream, throttle) |
| 319 | if err != nil { |
| 320 | return errors.Wrap(err, "stream changes") |
| 321 | } |
| 322 | |
| 323 | d.watchedFiles = newState |
| 324 | } |
| 325 | return nil |
| 326 | } |
| 327 | |
| 328 | func (d *Downstream) watch(stopChan chan struct{}) { |
| 329 | for { |
nothing calls this directly
no test coverage detected