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

Method startSync

pkg/devspace/services/sync/controller.go:270–295  ·  view source on GitHub ↗
(ctx devspacecontext.Context, options *Options, onInitUploadDone chan struct{}, onInitDownloadDone chan struct{}, onDone chan struct{}, onError chan error)

Source from the content-addressed store, hash-verified

268}
269
270func (c *controller) startSync(ctx devspacecontext.Context, options *Options, onInitUploadDone chan struct{}, onInitDownloadDone chan struct{}, onDone chan struct{}, onError chan error) (*sync.Sync, *selector.SelectedPodContainer, error) {
271 syncConfig := options.SyncConfig
272
273 container, err := options.Selector.SelectSingleContainer(ctx.Context(), ctx.KubeClient(), ctx.Log())
274 if err != nil {
275 return nil, nil, errors.Wrap(err, "error selecting container")
276 }
277
278 ctx.Log().Debug("Starting sync...")
279 syncClient, err := c.initClient(ctx, container.Pod, options.Arch, container.Container.Name, syncConfig, options.Starter, options.Verbose, options.SyncLog)
280 if err != nil {
281 return nil, nil, errors.Wrap(err, "start sync")
282 }
283
284 err = syncClient.Start(onInitUploadDone, onInitDownloadDone, onDone, onError)
285 if err != nil {
286 return nil, nil, errors.Errorf("Sync error: %v", err)
287 }
288
289 localPath, remotePath, err := ParseSyncPath(syncConfig.Path)
290 if err == nil {
291 ctx.Log().Donef("Sync started on: %s", ansi.Color(fmt.Sprintf("%s <-> %s", localPath, remotePath), "white+b"))
292 }
293
294 return syncClient, container, nil
295}
296
297func ParseSyncPath(path string) (localPath string, remotePath string, err error) {
298 if path == "" {

Callers 1

startWithWaitMethod · 0.95

Calls 10

initClientMethod · 0.95
ParseSyncPathFunction · 0.85
SelectSingleContainerMethod · 0.65
ContextMethod · 0.65
KubeClientMethod · 0.65
LogMethod · 0.65
StartMethod · 0.65
DebugMethod · 0.45
ErrorfMethod · 0.45
DonefMethod · 0.45

Tested by

no test coverage detected