fsmonitor

package
v0.0.0-...-1054c60 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: AGPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DriverNameFANotify is the name of the FANotify driver.
	//
	// FANotify should be preferred over INotify because it is more performant and does not need to recursively watch
	// subdirectories. However, it is not possible to use fanotify if the specified path is not a mountpoint because we
	// need to use the unix.FAN_MARK_FILESYSTEM flag for this functionality.
	DriverNameFANotify = "fanotify"

	// DriverNameINotify is the name of the inotify driver.
	DriverNameINotify = "inotify"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event int

Event is a numeric code identifying the event.

const (
	// EventAdd represents the add event.
	EventAdd Event = iota

	// EventRemove represents the remove event.
	EventRemove

	// EventWrite represents the write event (a file that was opened for writing was closed).
	EventWrite

	// EventRename represents the rename event. This event will fire when a file is renamed to the watched file name,
	// e.g. If watching `/some-dir`, and a file is renamed from `/some-dir/file.txt.tmp` to `/some-dir/file.txt`, the
	// event fires for `/some-dir/file.txt`, and not for `/some-dir/file.txt.tmp`.
	EventRename
)

func (Event) String

func (e Event) String() string

String implements fmt.Stringer for Event.

type FSMonitor

type FSMonitor interface {
	DriverName() string
	PrefixPath() string
	Watch(path string, identifier string, f func(path string, event Event) bool) error
	Unwatch(path string, identifier string) error
}

FSMonitor represents a filesystem monitor.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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