Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var POLL_DURATION time.Duration
Functions ¶
Types ¶
type FileChanges ¶
type FileChanges struct { Modified chan bool // Channel to get notified of modifications Truncated chan bool // Channel to get notified of truncations Deleted chan bool // Channel to get notified of deletions/renames }
func NewFileChanges ¶
func NewFileChanges() *FileChanges
func (*FileChanges) Close ¶
func (fc *FileChanges) Close()
func (*FileChanges) NotifyDeleted ¶
func (fc *FileChanges) NotifyDeleted()
func (*FileChanges) NotifyModified ¶
func (fc *FileChanges) NotifyModified()
func (*FileChanges) NotifyTruncated ¶
func (fc *FileChanges) NotifyTruncated()
type FileWatcher ¶
type FileWatcher interface { // BlockUntilExists blocks until the file comes into existence. BlockUntilExists(*tomb.Tomb) error // ChangeEvents reports on changes to a file, be it modification, // deletion, renames or truncations. Returned FileChanges group of // channels will be closed, thus become unusable, after a deletion // or truncation event. ChangeEvents(*tomb.Tomb, os.FileInfo) *FileChanges }
FileWatcher monitors file-level events.
type InotifyFileWatcher ¶
InotifyFileWatcher uses inotify to monitor file changes.
func NewInotifyFileWatcher ¶
func NewInotifyFileWatcher(filename string) *InotifyFileWatcher
func (*InotifyFileWatcher) BlockUntilExists ¶
func (fw *InotifyFileWatcher) BlockUntilExists(t *tomb.Tomb) error
func (*InotifyFileWatcher) ChangeEvents ¶
func (fw *InotifyFileWatcher) ChangeEvents(t *tomb.Tomb, fi os.FileInfo) *FileChanges
type InotifyTracker ¶
type InotifyTracker struct {
// contains filtered or unexported fields
}
func NewInotifyTracker ¶
func NewInotifyTracker() *InotifyTracker
func (*InotifyTracker) CloseAll ¶
func (t *InotifyTracker) CloseAll()
func (*InotifyTracker) CloseWatcher ¶
func (t *InotifyTracker) CloseWatcher(w *fsnotify.Watcher) (err error)
func (*InotifyTracker) NewWatcher ¶
func (t *InotifyTracker) NewWatcher() (*fsnotify.Watcher, error)
type PollingFileWatcher ¶
PollingFileWatcher polls the file for changes.
func NewPollingFileWatcher ¶
func NewPollingFileWatcher(filename string) *PollingFileWatcher
func (*PollingFileWatcher) BlockUntilExists ¶
func (fw *PollingFileWatcher) BlockUntilExists(t *tomb.Tomb) error
func (*PollingFileWatcher) ChangeEvents ¶
func (fw *PollingFileWatcher) ChangeEvents(t *tomb.Tomb, origFi os.FileInfo) *FileChanges
Click to show internal directories.
Click to hide internal directories.