MCPcopy Index your code
hub / github.com/devspace-sh/devspace / collectChanges

Method collectChanges

pkg/devspace/sync/downstream.go:98–135  ·  view source on GitHub ↗
(skipIgnore bool)

Source from the content-addressed store, hash-verified

96}
97
98func (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
137func (d *downstream) startPing(doneChan chan struct{}) {
138 go func() {

Callers 2

populateFileMapMethod · 0.95
mainLoopMethod · 0.95

Calls 6

shouldKeepMethod · 0.95
WithTimeoutMethod · 0.80
ChangesMethod · 0.65
RecvMethod · 0.65
MatchesMethod · 0.65
DebugfMethod · 0.45

Tested by

no test coverage detected