Documentation ¶
Overview ¶
Package fsevents provides file system notifications on macOS.
Index ¶
- func DeviceForPath(path string) (int32, error)
- func EventIDForDeviceBeforeTime(dev int32, before time.Time) uint64
- func GetDeviceUUID(deviceID int32) string
- func GetStreamRefDescription(f FSEventStreamRef) string
- func GetStreamRefDeviceID(f FSEventStreamRef) int32
- func GetStreamRefEventID(f FSEventStreamRef) uint64
- func GetStreamRefPaths(f FSEventStreamRef) []string
- func LatestEventID() uint64
- type CFRunLoopRef
- type CreateFlags
- type Event
- type EventFlags
- type EventStream
- type FSEventStreamRef
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeviceForPath ¶
DeviceForPath returns the device ID for the specified volume.
func EventIDForDeviceBeforeTime ¶
EventIDForDeviceBeforeTime returns an event ID before a given time.
func GetDeviceUUID ¶
GetDeviceUUID retrieves the UUID required to identify an EventID in the FSEvents database
func GetStreamRefDescription ¶
func GetStreamRefDescription(f FSEventStreamRef) string
GetStreamRefDescription retrieves debugging description information about the StreamRef
func GetStreamRefDeviceID ¶
func GetStreamRefDeviceID(f FSEventStreamRef) int32
GetStreamRefDeviceID retrieves the device ID the stream is watching
func GetStreamRefEventID ¶
func GetStreamRefEventID(f FSEventStreamRef) uint64
GetStreamRefEventID retrieves the last EventID from the ref
func GetStreamRefPaths ¶
func GetStreamRefPaths(f FSEventStreamRef) []string
GetStreamRefPaths returns a copy of the paths being watched by this stream
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 (macOS 10.6+). IgnoreSelf // FileEvents sends events about individual files, generating significantly // more events (macOS 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 // syscall represents this with an int32 Device int32 // contains filtered or unexported fields }
EventStream is the primary interface to FSEvents You can provide your own event channel if you wish (or one will be created on Start).
es := &EventStream{Paths: []string{"/tmp"}, Flags: 0} es.Start() es.Stop() ...
func (*EventStream) Flush ¶
func (es *EventStream) Flush(sync bool)
Flush events that have occurred but haven't been delivered.
type FSEventStreamRef ¶
type FSEventStreamRef C.FSEventStreamRef
FSEventStreamRef wraps C.FSEventStreamRef