shared.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. Copyright 2023 Docker Compose CLI authors
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package sync
  14. import (
  15. "context"
  16. "github.com/compose-spec/compose-go/types"
  17. )
  18. // PathMapping contains the Compose service and modified host system path.
  19. type PathMapping struct {
  20. // HostPath that was created/modified/deleted outside the container.
  21. //
  22. // This is the path as seen from the user's perspective, e.g.
  23. // - C:\Users\moby\Documents\hello-world\main.go (file on Windows)
  24. // - /Users/moby/Documents/hello-world (directory on macOS)
  25. HostPath string
  26. // ContainerPath for the target file inside the container (only populated
  27. // for sync events, not rebuild).
  28. //
  29. // This is the path as used in Docker CLI commands, e.g.
  30. // - /workdir/main.go
  31. // - /workdir/subdir
  32. ContainerPath string
  33. }
  34. type Syncer interface {
  35. Sync(ctx context.Context, service types.ServiceConfig, paths []PathMapping) error
  36. }