Documentation ¶
Index ¶
Constants ¶
View Source
const ( None = iota Rotated Modified )
Variables ¶
View Source
var POLL_DURATION time.Duration
Functions ¶
This section is empty.
Types ¶
type FileChanges ¶
type FileChanges struct {
Modified chan int // Channel to get notified of modifications
}
func NewFileChanges ¶
func NewFileChanges() *FileChanges
func (*FileChanges) Close ¶
func (fc *FileChanges) Close()
func (*FileChanges) NotifyModified ¶
func (fc *FileChanges) NotifyModified(ctx context.Context)
func (*FileChanges) NotifyRotated ¶
func (fc *FileChanges) NotifyRotated(ctx context.Context)
type FileWatcher ¶
type FileWatcher interface { // BlockUntilExists blocks until the file comes into existence. BlockUntilExists(context.Context) 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(context.Context, os.FileInfo) *FileChanges }
FileWatcher monitors file-level events.
type InotifyFileWatcher ¶
type InotifyFileWatcher struct { Filename string // contains filtered or unexported fields }
InotifyFileWatcher uses inotify to monitor file changes.
func NewInotifyFileWatcher ¶
func (*InotifyFileWatcher) BlockUntilExists ¶
func (fw *InotifyFileWatcher) BlockUntilExists(ctx context.Context) error
func (*InotifyFileWatcher) ChangeEvents ¶
func (fw *InotifyFileWatcher) ChangeEvents(ctx context.Context, 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(ctx context.Context)
func (*InotifyTracker) CloseWatcher ¶
func (*InotifyTracker) NewWatcher ¶
type PollingFileWatcher ¶
PollingFileWatcher polls the file for changes.
func NewPollingFileWatcher ¶
func NewPollingFileWatcher(filename string) *PollingFileWatcher
func (*PollingFileWatcher) BlockUntilExists ¶
func (fw *PollingFileWatcher) BlockUntilExists(ctx context.Context) error
func (*PollingFileWatcher) ChangeEvents ¶
func (fw *PollingFileWatcher) ChangeEvents(ctx context.Context, origFi os.FileInfo) *FileChanges
Click to show internal directories.
Click to hide internal directories.