(skipIgnore bool)
| 96 | } |
| 97 | |
| 98 | func (d *downstream) collectChanges(skipIgnore bool) ([]*remote.Change, error) { |
| 99 | d.sync.log.Debugf("Downstream - Start collecting changes") |
| 100 | defer d.sync.log.Debugf("Downstream - Done collecting changes") |
| 101 | |
| 102 | changes := make([]*remote.Change, 0, 128) |
| 103 | ctx, cancel := context.WithTimeout(d.sync.ctx, time.Minute*30) |
| 104 | defer cancel() |
| 105 | |
| 106 | // Create a change client and collect all changes |
| 107 | changesClient, err := d.client.Changes(ctx, &remote.Empty{}) |
| 108 | if err != nil { |
| 109 | return nil, errors.Wrap(err, "start retrieving changes") |
| 110 | } |
| 111 | |
| 112 | for { |
| 113 | changeChunk, err := changesClient.Recv() |
| 114 | if changeChunk != nil { |
| 115 | for _, change := range changeChunk.Changes { |
| 116 | if !skipIgnore && d.ignoreMatcher != nil && d.ignoreMatcher.Matches(change.Path, change.IsDir) { |
| 117 | continue |
| 118 | } |
| 119 | if !d.shouldKeep(change) { |
| 120 | continue |
| 121 | } |
| 122 | |
| 123 | changes = append(changes, change) |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | if err == io.EOF { |
| 128 | break |
| 129 | } else if err != nil { |
| 130 | return nil, errors.Wrap(err, "recv change") |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | return changes, nil |
| 135 | } |
| 136 | |
| 137 | func (d *downstream) startPing(doneChan chan struct{}) { |
| 138 | go func() { |
no test coverage detected