MCPcopy
hub / github.com/docker/compose / getSyncImplementation

Method getSyncImplementation

pkg/compose/watch.go:119–131  ·  view source on GitHub ↗

getSyncImplementation returns an appropriate sync implementation for the project. Currently, an implementation that batches files and transfers them using the Moby `Untar` API.

(project *types.Project)

Source from the content-addressed store, hash-verified

117// Currently, an implementation that batches files and transfers them using
118// the Moby `Untar` API.
119func (s *composeService) getSyncImplementation(project *types.Project) (sync.Syncer, error) {
120 var useTar bool
121 if useTarEnv, ok := os.LookupEnv("COMPOSE_EXPERIMENTAL_WATCH_TAR"); ok {
122 useTar, _ = strconv.ParseBool(useTarEnv)
123 } else {
124 useTar = true
125 }
126 if !useTar {
127 return nil, errors.New("no available sync implementation")
128 }
129
130 return sync.NewTar(project.Name, tarDockerClient{s: s}), nil
131}
132
133func (s *composeService) Watch(ctx context.Context, project *types.Project, options api.WatchOptions) error {
134 wait, err := s.watch(ctx, project, options)

Callers 1

watchMethod · 0.95

Calls 1

NewTarFunction · 0.92

Tested by

no test coverage detected