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

Function StartSyncFromCmd

pkg/devspace/services/sync/sync.go:17–61  ·  view source on GitHub ↗

StartSyncFromCmd starts a new sync from command

(ctx devspacecontext.Context, selector targetselector.TargetSelector, name string, syncConfig *latest.SyncConfig, noWatch bool)

Source from the content-addressed store, hash-verified

15
16// StartSyncFromCmd starts a new sync from command
17func StartSyncFromCmd(ctx devspacecontext.Context, selector targetselector.TargetSelector, name string, syncConfig *latest.SyncConfig, noWatch bool) error {
18 ctx, parent := ctx.WithNewTomb()
19 options := &Options{
20 Name: name,
21 SyncConfig: syncConfig,
22 Selector: selector,
23 RestartOnError: true,
24 SyncLog: ctx.Log(),
25
26 Verbose: ctx.Log().GetLevel() == logrus.DebugLevel,
27 }
28
29 // Start the tomb
30 <-parent.NotifyGo(func() error {
31 // this is needed as otherwise the context
32 // is cancelled alongside the tomb
33 parent.Go(func() error {
34 <-ctx.Context().Done()
35 return nil
36 })
37
38 return NewController().Start(ctx, options, parent)
39 })
40
41 // Handle no watch
42 if noWatch {
43 select {
44 case <-parent.Dead():
45 return parent.Err()
46 default:
47 parent.Kill(nil)
48 _ = parent.Wait()
49 return nil
50 }
51 }
52
53 // Handle interrupt
54 select {
55 case <-parent.Dead():
56 return parent.Err()
57 case <-ctx.Context().Done():
58 _ = parent.Wait()
59 return nil
60 }
61}
62
63// StartSync starts the syncing functionality
64func StartSync(ctx devspacecontext.Context, devPod *latest.DevPod, selector targetselector.TargetSelector, parent *tomb.Tomb) (retErr error) {

Callers 1

RunMethod · 0.92

Calls 13

NotifyGoMethod · 0.80
GoMethod · 0.80
DeadMethod · 0.80
KillMethod · 0.80
NewControllerFunction · 0.70
WithNewTombMethod · 0.65
LogMethod · 0.65
DoneMethod · 0.65
ContextMethod · 0.65
StartMethod · 0.65
WaitMethod · 0.65
GetLevelMethod · 0.45

Tested by

no test coverage detected