fsevents

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2015 License: MPL-2.0, BSD-3-Clause Imports: 6 Imported by: 0

README

FSEvents bindings for Go (OS X)

GoDoc

FSEvents allows an application to monitor a whole file system or portion of it. FSEvents is only available on OS X.

Warning: This API should be considered unstable.

Contributing

Request features and report bugs using the GitHub Issue Tracker.

fsevents carries the same LICENSE as Go. Contributors retain their copyright, so you need to fill out a short form before we can accept your contribution: Google Individual Contributor License Agreement.

Documentation

Rendered for darwin/amd64

Overview

Package fsevents provides file system notifications on OS X.

Index

Constants

View Source
const EventIDSinceNow = uint64(C.kFSEventStreamEventIdSinceNow + (1 << 64))

EventIdSinceNow is a sentinel to begin watching events "since now".

Variables

This section is empty.

Functions

func DeviceForPath

func DeviceForPath(path string) (int32, error)

DeviceForPath returns the device ID for the specified volume.

func EventIDForDeviceBeforeTime

func EventIDForDeviceBeforeTime(dev int32, before time.Time) uint64

EventIDForDeviceBeforeTime returns an event ID before a given time.

func LatestEventID

func LatestEventID() uint64

LatestEventID returns the most recently generated event ID, system-wide.

Types

type CreateFlags

type CreateFlags uint32

CreateFlags for creating a New stream.

const (

	// NoDefer sends events on the leading edge (for interactive applications).
	// By default events are delivered after latency seconds (for background tasks).
	NoDefer CreateFlags

	// WatchRoot for a change to occur to a directory along the path being watched.
	WatchRoot

	// IgnoreSelf doesn't send events triggered by the current process (OS X 10.6+).
	IgnoreSelf

	// FileEvents sends events about individual files, generating significantly
	// more events (OS X 10.7+) than directory level notifications.
	FileEvents
)

kFSEventStreamCreateFlag...

type Event

type Event struct {
	Path  string
	Flags EventFlags
	ID    uint64
}

Event represents a single file system notification.

type EventFlags

type EventFlags uint32

EventFlags passed to the FSEventStreamCallback function.

const (
	// MustScanSubDirs indicates that events were coalesced hierarchically.
	MustScanSubDirs EventFlags = 1 << iota
	// UserDropped or KernelDropped is set alongside MustScanSubDirs
	// to help diagnose the problem.
	UserDropped
	KernelDropped

	// EventIDsWrapped indicates the 64-bit event ID counter wrapped around.
	EventIDsWrapped

	// HistoryDone is a sentinel event when retrieving events sinceWhen.
	HistoryDone

	// RootChanged indicates a change to a directory along the path being watched.
	RootChanged

	// Mount for a volume mounted underneath the path being monitored.
	Mount
	// Unmount event occurs after a volume is unmounted.
	Unmount

	ItemCreated
	ItemRemoved
	ItemInodeMetaMod
	ItemRenamed
	ItemModified
	ItemFinderInfoMod
	ItemChangeOwner
	ItemXattrMod
	ItemIsFile
	ItemIsDir
	ItemIsSymlink
)

kFSEventStreamEventFlag...

type EventStream

type EventStream struct {
	Events  chan []Event
	Paths   []string
	Flags   CreateFlags
	EventID uint64
	Resume  bool
	Latency time.Duration
	Device  int32
	// contains filtered or unexported fields
}

EventStream is the primary interface to FSEvents.

func (*EventStream) Flush

func (es *EventStream) Flush(sync bool)

Flush events that have occurred but haven't been delivered.

func (*EventStream) Restart

func (es *EventStream) Restart()

Restart listening.

func (*EventStream) Start

func (es *EventStream) Start()

Start listening to an event stream.

func (*EventStream) Stop

func (es *EventStream) Stop()

Stop listening to the event stream.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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