filesystem

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileContentHandler

type FileContentHandler func(content []byte) error

type FileWatcher

type FileWatcher struct {
	// contains filtered or unexported fields
}

FileWatcher watches a single file and trigger the given handler function

func NewFileWatcher

func NewFileWatcher(purpose string, path string, handler FileContentHandler) *FileWatcher

NewFileWatcher creates a FileWatcher

func (*FileWatcher) Watch

func (f *FileWatcher) Watch(ctx context.Context) error

Watch sets up the fsnotify watcher and add the file that we are interested in. The file watcher and worker run in goroutines. The goroutines are stopped when the ctx is cancelled.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL