Documentation ¶
Index ¶
Constants ¶
View Source
const ( // FileCreateEvents events for file create, unix.NOTE_WRIT is the event of file create/write, // there is not a event only to notify file create. FileCreateEvents = unix.IN_CREATE // FileWriteEvents events for file write. FileWriteEvents = unix.IN_MODIFY // FileRenameEvents events for file rename. FileRenameEvents = unix.IN_MOVE | unix.IN_MOVED_TO | unix.IN_MOVED_FROM | unix.IN_MOVE_SELF // FileRemoveEvents events for file remove. FileRemoveEvents = unix.IN_DELETE | unix.IN_DELETE_SELF // FileCreateRemoveEvents events for file create and remove. FileCreateRemoveEvents = FileCreateEvents | FileRemoveEvents | FileRenameEvents // FileWriteRemoveEvents events for file write and remove. FileWriteRemoveEvents = FileWriteEvents | FileRemoveEvents | FileRenameEvents )
Variables ¶
View Source
var ErrTooManyDirFile = errors.New("too many files under directory")
Functions ¶
Types ¶
type Event ¶
type Event uint32
Event describes a set of file event.
These are file events that can trigger a notification.
type FileStat ¶
type FileStat struct {
// contains filtered or unexported fields
}
FileStat file stat.
type FileWatcher ¶
type FileWatcher struct { // Runner to control watching goroutines. Runner *gorun.Runner // a channel to notify active files. Events chan *WatchEvent // a channel to notify errors. Errors chan error // contains filtered or unexported fields }
FileWatcher a file watcher, watch change event in directory/sub-directories. Note: the change event may be duplicated.
func New ¶
func New(watchMethod WatchMethod, inactiveDeadline, silenceDeadline time.Duration) (*FileWatcher, error)
New create a new file watcher.
func (*FileWatcher) SetDirFileCountLimit ¶ added in v1.2.2
func (fw *FileWatcher) SetDirFileCountLimit(count int)
SetDirFileCountLimit allow user to config directory file count limit.
func (*FileWatcher) Stop ¶
func (fw *FileWatcher) Stop() error
func (*FileWatcher) WatchDir ¶
func (fw *FileWatcher) WatchDir(dir string, includeSub bool, fileMatcher FileMatcher) error
type WatchMethod ¶
type WatchMethod string
const ( // WatchMethodFS using os file system api to watch file events. WatchMethodFS WatchMethod = "fs" // WatchMethodTimer interval schedule check stat of files and trigger file change events. WatchMethodTimer WatchMethod = "timer" )
Source Files ¶
Click to show internal directories.
Click to hide internal directories.