watch

package
v0.2.3-buildfails Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2015 License: MIT, MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var POLL_DURATION time.Duration

Functions

func Cleanup

func Cleanup()

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

type InotifyFileWatcher struct {
	Filename string
	Size     int64
}

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

type PollingFileWatcher struct {
	Filename string
	Size     int64
}

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

Jump to

Keyboard shortcuts

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