Documentation ¶
Overview ¶
Package gfsnotify provides a platform-independent interface for file system notifications.
文件监控.
Index ¶
Constants ¶
View Source
const (
REPEAT_EVENT_FILTER_INTERVAL = 1 // (毫秒)重复事件过滤间隔
)
Variables ¶
This section is empty.
Functions ¶
func RemoveCallback ¶ added in v1.1.994
根据指定的回调函数ID,移出指定的inotify回调函数
Types ¶
type Callback ¶ added in v1.1.994
type Callback struct { Id int // 唯一ID Func func(event *Event) // 回调方法 Path string // 监听的文件/目录 // contains filtered or unexported fields }
注册的监听回调方法
type Event ¶
type Event struct { Path string // 文件绝对路径 Op Op // 触发监听的文件操作 Watcher *Watcher // 事件对应的监听对象 // contains filtered or unexported fields }
监听事件对象
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
监听管理对象
func (*Watcher) Add ¶
func (w *Watcher) Add(path string, callbackFunc func(event *Event), recursive ...bool) (callback *Callback, err error)
添加监控,path参数支持文件或者目录路径,recursive为非必需参数,默认为非递归监控(当path为目录时)。 如果添加目录,这里只会返回目录的callback,按照callback删除时会递归删除。
func (*Watcher) RemoveCallback ¶ added in v1.1.994
根据指定的回调函数ID,移出指定的inotify回调函数
Click to show internal directories.
Click to hide internal directories.