package watch
import "github.com/docker/compose/v2/pkg/watch"
Index ¶
- Constants
- func DesiredWindowsBufferSize() int
- func DockerIgnoreTesterFromContents(repoRoot string, contents string) (*dockerPathMatcher, error)
- func IsWindowsShortReadError(err error) bool
- func LoadDockerIgnore(repoRoot string) (*dockerPathMatcher, error)
- func MaybeIncreaseBufferSize(w *fsnotify.Watcher)
- func NewDockerPatternMatcher(repoRoot string, patterns []string) (*dockerPathMatcher, error)
- func SanitizeFileName(name string) string
- type CompositePathMatcher
- func (c CompositePathMatcher) Matches(f string) (bool, error)
- func (c CompositePathMatcher) MatchesEntireDir(f string) (bool, error)
- type EmptyMatcher
- func (EmptyMatcher) Matches(f string) (bool, error)
- func (EmptyMatcher) MatchesEntireDir(f string) (bool, error)
- type FileEvent
- type Notify
- type PathMatcher
- func EphemeralPathMatcher() PathMatcher
- func NewCompositeMatcher(matchers ...PathMatcher) PathMatcher
- type TempDir
- func NewDir(prefix string) (*TempDir, error)
- func NewDirAtRoot(root, prefix string) (*TempDir, error)
- func NewDirAtSlashTmp(prefix string) (*TempDir, error)
- func (d *TempDir) NewDeterministicDir(name string) (*TempDir, error)
- func (d *TempDir) NewDir(prefix string) (*TempDir, error)
- func (d *TempDir) Path() string
- func (d *TempDir) TearDown() error
- type TempDirFixture
- func NewTempDirFixture(t testing.TB) *TempDirFixture
- func (f *TempDirFixture) Chdir()
- func (f *TempDirFixture) CopyFile(originalPath, newPath string)
- func (f *TempDirFixture) JoinPath(path ...string) string
- func (f *TempDirFixture) JoinPaths(paths []string) []string
- func (f *TempDirFixture) MkdirAll(path string)
- func (f *TempDirFixture) NewFile(prefix string) (*os.File, error)
- func (f *TempDirFixture) Path() string
- func (f *TempDirFixture) ReadFile(path string) string
- func (f *TempDirFixture) Rm(pathInRepo string)
- func (f *TempDirFixture) T() testing.TB
- func (f *TempDirFixture) TempDir(prefix string) string
- func (f *TempDirFixture) TouchFiles(paths []string)
- func (f *TempDirFixture) WriteFile(path string, contents string) string
- func (f *TempDirFixture) WriteSymlink(linkContents, destPath string)
Constants ¶
const WindowsBufferSizeEnvVar = "COMPOSE_WATCH_WINDOWS_BUFFER_SIZE"
Functions ¶
func DesiredWindowsBufferSize ¶
func DesiredWindowsBufferSize() int
func DockerIgnoreTesterFromContents ¶
func IsWindowsShortReadError ¶
func LoadDockerIgnore ¶
func MaybeIncreaseBufferSize ¶
func NewDockerPatternMatcher ¶
func SanitizeFileName ¶
Types ¶
type CompositePathMatcher ¶
type CompositePathMatcher struct { Matchers []PathMatcher }
func (CompositePathMatcher) Matches ¶
func (c CompositePathMatcher) Matches(f string) (bool, error)
func (CompositePathMatcher) MatchesEntireDir ¶
func (c CompositePathMatcher) MatchesEntireDir(f string) (bool, error)
type EmptyMatcher ¶
type EmptyMatcher struct { }
func (EmptyMatcher) Matches ¶
func (EmptyMatcher) Matches(f string) (bool, error)
func (EmptyMatcher) MatchesEntireDir ¶
func (EmptyMatcher) MatchesEntireDir(f string) (bool, error)
type FileEvent ¶
type FileEvent struct {
// contains filtered or unexported fields
}
func NewFileEvent ¶
func (FileEvent) Path ¶
type Notify ¶
type Notify interface { // Start watching the paths set at init time Start() error // Stop watching and close all channels Close() error // A channel to read off incoming file changes Events() chan FileEvent // A channel to read off show-stopping errors Errors() chan error }
func NewWatcher ¶
func NewWatcher(paths []string, ignore PathMatcher) (Notify, error)
type PathMatcher ¶
type PathMatcher interface { Matches(file string) (bool, error) // If this matches the entire dir, we can often optimize filetree walks a bit. MatchesEntireDir(file string) (bool, error) }
When we specify directories to watch, we often want to ignore some subset of the files under those directories.
For example: - Watch /src/repo, but ignore /src/repo/.git - Watch /src/repo, but ignore everything in /src/repo/bazel-bin except /src/repo/bazel-bin/app-binary
The PathMatcher interface helps us manage these ignores.
func EphemeralPathMatcher ¶
func EphemeralPathMatcher() PathMatcher
EphemeralPathMatcher filters out spurious changes that we don't want to rebuild on, like IDE temp/lock files.
This isn't an ideal solution. In an ideal world, the user would put everything to ignore in their tiltignore/dockerignore files. This is a stop-gap so they don't have a terrible experience if those files aren't there or aren't in the right places.
NOTE: The underlying `patternmatcher` is NOT always Goroutine-safe, so this is not a singleton; we create an instance for each watcher currently.
func NewCompositeMatcher ¶
func NewCompositeMatcher(matchers ...PathMatcher) PathMatcher
type TempDir ¶
type TempDir struct {
// contains filtered or unexported fields
}
TempDir holds a temp directory and allows easy access to new temp directories.
func NewDir ¶
NewDir creates a new TempDir in the default location (typically $TMPDIR)
func NewDirAtRoot ¶
NewDir creates a new TempDir at the given root.
func NewDirAtSlashTmp ¶
NewDirAtSlashTmp creates a new TempDir at /tmp
func (*TempDir) NewDeterministicDir ¶
func (*TempDir) NewDir ¶
d.NewDir creates a new TempDir under d
func (*TempDir) Path ¶
func (*TempDir) TearDown ¶
type TempDirFixture ¶
type TempDirFixture struct {
// contains filtered or unexported fields
}
func NewTempDirFixture ¶
func NewTempDirFixture(t testing.TB) *TempDirFixture
func (*TempDirFixture) Chdir ¶
func (f *TempDirFixture) Chdir()
func (*TempDirFixture) CopyFile ¶
func (f *TempDirFixture) CopyFile(originalPath, newPath string)
Returns the full path to the file written.
func (*TempDirFixture) JoinPath ¶
func (f *TempDirFixture) JoinPath(path ...string) string
func (*TempDirFixture) JoinPaths ¶
func (f *TempDirFixture) JoinPaths(paths []string) []string
func (*TempDirFixture) MkdirAll ¶
func (f *TempDirFixture) MkdirAll(path string)
func (*TempDirFixture) NewFile ¶
func (f *TempDirFixture) NewFile(prefix string) (*os.File, error)
func (*TempDirFixture) Path ¶
func (f *TempDirFixture) Path() string
func (*TempDirFixture) ReadFile ¶
func (f *TempDirFixture) ReadFile(path string) string
Read the file.
func (*TempDirFixture) Rm ¶
func (f *TempDirFixture) Rm(pathInRepo string)
func (*TempDirFixture) T ¶
func (f *TempDirFixture) T() testing.TB
func (*TempDirFixture) TempDir ¶
func (f *TempDirFixture) TempDir(prefix string) string
func (*TempDirFixture) TouchFiles ¶
func (f *TempDirFixture) TouchFiles(paths []string)
func (*TempDirFixture) WriteFile ¶
func (f *TempDirFixture) WriteFile(path string, contents string) string
Returns the full path to the file written.
func (*TempDirFixture) WriteSymlink ¶
func (f *TempDirFixture) WriteSymlink(linkContents, destPath string)
Source Files ¶
dockerignore.go ephemeral.go notify.go paths.go temp.go temp_dir_fixture.go watcher_naive.go watcher_nonwin.go
- Version
- v2.29.6
- Published
- Sep 18, 2024
- Platform
- js/wasm
- Imports
- 16 packages
- Last checked
- 8 minutes ago –
Tools for package owners.