shared.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. )
  17. // PathMapping contains the Compose service and modified host system path.
  18. type PathMapping struct {
  19. // HostPath that was created/modified/deleted outside the container.
  20. //
  21. // This is the path as seen from the user's perspective, e.g.
  22. // - C:\Users\moby\Documents\hello-world\main.go (file on Windows)
  23. // - /Users/moby/Documents/hello-world (directory on macOS)
  24. HostPath string
  25. // ContainerPath for the target file inside the container (only populated
  26. // for sync events, not rebuild).
  27. //
  28. // This is the path as used in Docker CLI commands, e.g.
  29. // - /workdir/main.go
  30. // - /workdir/subdir
  31. ContainerPath string
  32. }
  33. type Syncer interface {
  34. Sync(ctx context.Context, service string, paths []*PathMapping) error
  35. }