inotify

package
v0.2.0-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2017 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package inotify provides an interface to the Linux inotify(7) API for monitoring filesystem events.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	unix.InotifyEvent

	// Name within watched path if it's a directory
	Name string

	// Watched path associated with the event
	Path string
}

Event represents an inotify event

type Instance

type Instance struct {
	// contains filtered or unexported fields
}

Instance represents an initialized inotify instance

func NewInstance

func NewInstance() (*Instance, error)

NewInstance creates a new inotify instance

func (*Instance) AddRecursiveWatch

func (is *Instance) AddRecursiveWatch(path string, mask uint32) error

AddRecursiveWatch adds the given path to the inotify instance's watch list as well as any directories recursively identified within it. Newly created subdirectories within the subtree rooted at path are added to the watch list as well.

func (*Instance) AddTrigger

func (is *Instance) AddTrigger(pattern string, mask uint32) error

AddTrigger adds the given regular expression as a "watch trigger". When an event's full path matches it, a new watch is added for that event's full path with the given mask specifying the inotify events to be monitored.

func (*Instance) AddWatch

func (is *Instance) AddWatch(path string, mask uint32) error

AddWatch adds the given path to the inotify instance's watch list for events specified in the given mask. If the path is already being watched, the existing watch is modified.

func (*Instance) Close

func (is *Instance) Close()

Close the inotify instance and allow the kernel to free its associated resources. All associated watches are automatically freed.

func (*Instance) Events

func (is *Instance) Events() *stream.Stream

Events returns a Event stream.Stream of the inotify instance's events

func (*Instance) RemoveWatch

func (is *Instance) RemoveWatch(path string) error

RemoveWatch removes the given path from the inotify instance's watch list.

Jump to

Keyboard shortcuts

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