watch

package
v0.0.0-...-d3c80d3 Latest Latest
Warning

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

Go to latest
Published: May 29, 2013 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var POLL_DURATION time.Duration

Functions

This section is empty.

Types

type FileWatcher

type FileWatcher interface {
	// BlockUntilExists blocks until the missing file comes into
	// existence. If the file already exists, returns immediately.
	BlockUntilExists(tomb.Tomb) error

	// ChangeEvents returns a channel of events corresponding to the
	// times the file is ready to be read. The channel will be closed
	// if the file gets deleted, renamed or truncated.
	ChangeEvents(tomb.Tomb, os.FileInfo) chan bool
}

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) chan bool

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) chan bool

Jump to

Keyboard shortcuts

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