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)
| 117 | // Currently, an implementation that batches files and transfers them using |
| 118 | // the Moby `Untar` API. |
| 119 | func (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 | |
| 133 | func (s *composeService) Watch(ctx context.Context, project *types.Project, options api.WatchOptions) error { |
| 134 | wait, err := s.watch(ctx, project, options) |