filenotify

package
v0.0.0-...-c1e6758 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

README

This package is based on filenotify which is licensed under the Apache License 2.0. Credits to Brian Goff cpuguy83@gmail.com and the Moby authors and maintainers.

filePoller has been modified so it can watch both files and directories, using https://github.com/radovskyb/watcher.

Documentation

Overview

Package filenotify provides a mechanism for watching file(s) for changes. Generally leans on fsnotify, but provides a poll-based notifier which fsnotify does not support. These are wrapped up in a common interface so that either can be used interchangeably in your code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	PollInterval time.Duration
}

type FileWatcher

type FileWatcher interface {
	Events() <-chan fsnotify.Event
	Errors() <-chan error
	Add(name string) error
	Remove(name string) error
	Close() error
}

FileWatcher is an interface for implementing file notification watchers.

func New

func New(cfg Config) (FileWatcher, error)

New tries to use an fs-event watcher, and falls back to the poller if there is an error

func NewEventWatcher

func NewEventWatcher() (FileWatcher, error)

NewEventWatcher returns an fs-event based file watcher

func NewPollingWatcher

func NewPollingWatcher(cfg Config) (FileWatcher, error)

NewPollingWatcher returns a poll-based file watcher

Jump to

Keyboard shortcuts

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