Documentation
¶
Index ¶
- Constants
- func BatchDebounceEvents(ctx context.Context, clock clockwork.Clock, input <-chan FileEvent) <-chan []FileEvent
- func DesiredWindowsBufferSize() int
- func DockerIgnoreTesterFromContents(repoRoot string, contents string) (*dockerPathMatcher, error)
- func IsWindowsShortReadError(err error) bool
- func MaybeIncreaseBufferSize(w *fsnotify.Watcher)
- func NewDockerPatternMatcher(repoRoot string, patterns []string) (*dockerPathMatcher, error)
- func SanitizeFileName(name string) string
- type CompositePathMatcher
- type EmptyMatcher
- type FileEvent
- type Notify
- type PathMatcher
- type TempDir
- type 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 QuietPeriod = 500 * time.Millisecond
const WindowsBufferSizeEnvVar = "COMPOSE_WATCH_WINDOWS_BUFFER_SIZE"
Variables ¶
This section is empty.
Functions ¶
func BatchDebounceEvents ¶ added in v2.33.0
func BatchDebounceEvents(ctx context.Context, clock clockwork.Clock, input <-chan FileEvent) <-chan []FileEvent
batchDebounceEvents groups identical file events within a sliding time window and writes the results to the returned channel.
The returned channel is closed when the debouncer is stopped via context cancellation or by closing the input channel.
func DesiredWindowsBufferSize ¶
func DesiredWindowsBufferSize() int
func IsWindowsShortReadError ¶
func MaybeIncreaseBufferSize ¶
func NewDockerPatternMatcher ¶
func SanitizeFileName ¶
Types ¶
type CompositePathMatcher ¶ added in v2.17.0
type CompositePathMatcher struct {
Matchers []PathMatcher
}
func (CompositePathMatcher) Matches ¶ added in v2.17.0
func (c CompositePathMatcher) Matches(f string) (bool, error)
func (CompositePathMatcher) MatchesEntireDir ¶ added in v2.17.0
func (c CompositePathMatcher) MatchesEntireDir(f string) (bool, error)
type EmptyMatcher ¶
type EmptyMatcher struct{}
func (EmptyMatcher) MatchesEntireDir ¶
func (EmptyMatcher) MatchesEntireDir(f string) (bool, error)
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 ¶
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 ¶ added in v2.17.0
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 LoadDockerIgnore ¶
func LoadDockerIgnore(build *types.BuildConfig) (PathMatcher, error)
func NewCompositeMatcher ¶ added in v2.17.0
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 NewDirAtRoot ¶
NewDir creates a new TempDir at the given root.
func NewDirAtSlashTmp ¶
NewDirAtSlashTmp creates a new TempDir at /tmp
func (*TempDir) NewDeterministicDir ¶
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) 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)