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

Method startUpstream

pkg/devspace/sync/sync.go:232–266  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

230}
231
232func (s *Sync) startUpstream() {
233 defer s.Stop(nil)
234 s.tree = notify.NewTree()
235
236 // Set up a watchpoint listening for events within a directory tree rooted at specified directory
237 watchPath := s.LocalPath + "/..."
238 if s.Options.NoRecursiveWatch {
239 watchPath = s.LocalPath
240 }
241 err := s.tree.Watch(watchPath, s.upstream.events, func(path string) bool {
242 if s.ignoreMatcher == nil || s.ignoreMatcher.RequireFullScan() {
243 return false
244 }
245
246 stat, err := os.Stat(path)
247 if err != nil {
248 return false
249 }
250
251 return s.ignoreMatcher.Matches(path[len(s.LocalPath):], stat.IsDir())
252 }, notify.All)
253 if err != nil {
254 s.Stop(err)
255 return
256 }
257 defer s.tree.Stop(s.upstream.events)
258 if s.readyChan != nil {
259 s.readyChan <- true
260 }
261
262 err = s.upstream.mainLoop()
263 if err != nil {
264 s.Stop(errors.Wrap(err, "upstream"))
265 }
266}
267
268func (s *Sync) startDownstream() {
269 defer s.Stop(nil)

Callers 3

mainLoopMethod · 0.95
TestInitialSyncFunction · 0.80
TestNormalSyncFunction · 0.80

Calls 7

StopMethod · 0.95
WatchMethod · 0.80
RequireFullScanMethod · 0.65
MatchesMethod · 0.65
StopMethod · 0.65
IsDirMethod · 0.45
mainLoopMethod · 0.45

Tested by 2

TestInitialSyncFunction · 0.64
TestNormalSyncFunction · 0.64