Inherits from NSObject
Conforms to NSCoding
NSCopying
Declared in CDEvent.h

Overview

An Objective-C wrapper for a FSEvents event data.

Note: Inpired by SCEvent class of the SCEvents project by Stuart Connolly.

Note: The class is immutable.

Tasks

Getting Event Properties

  •   identifier

    The event identifier.

    property
  •   date

    An approximate date and time the event occured.

    property
  •   URL

    The URL of the item which changed.

    property

Getting Event Flags

  •   flags

    The flags of the event.

    property
  •   isGenericChange

    Wheter there was some change in the directory at the specific path supplied in this event.

    property
  •   mustRescanSubDirectories

    Wheter you must rescan the whole URL including its children.

    property
  •   isUserDropped

    Provides some information as to what might have caused the need to rescan the URL including its children.

    property
  •   isKernelDropped

    Provides some information as to what might have caused the need to rescan the URL including its children.

    property
  •   isEventIdentifiersWrapped

    Wheter the 64-bit event identifier counter has wrapped around.

    property
  •   isHistoryDone

    Denotes a sentinel event sent to mark the end of the “historical” events sent.

    property
  •   isRootChanged

    Denotes a special event sent when there is a change to one of the URLs you asked to watch.

    property
  •   didVolumeMount

    Denotes a special event sent when a volume is mounted underneath one of the URLs being watched.

    property
  •   didVolumeUnmount

    Denotes a special event sent when a volume is unmounted underneath one of the URLs being watched.

    property
  •   isCreated

    The entirety of the documentation on file level events in lion is 3 sentences long. Rename behavior is odd, making the combination of events and flags somewhat confusing for atomic writes. It also appears possible to get a singular event where a file has been created, modified, and removed.

    property

Creating CDEvent Objects

Properties

URL

The URL of the item which changed.

@property (unsafe_unretained, readonly) NSURL *URL

Return Value

The URL of the item which changed.

Availability

1.0.0

Discussion

The URL of the item which changed.

Declared In

CDEvent.h

date

An approximate date and time the event occured.

@property (unsafe_unretained, readonly) NSDate *date

Return Value

The approximate date and time the event occured.

Availability

1.0.0

Discussion

An approximate date and time the event occured.

Declared In

CDEvent.h

didVolumeMount

Denotes a special event sent when a volume is mounted underneath one of the URLs being watched.

@property (readonly) BOOL didVolumeMount

Return Value

YES if a volumen is mounted underneath one of the URLs being watched, otherwise NO.

Availability

1.1.0

Discussion

Denotes a special event sent when a volume is mounted underneath one of the URLs being watched.

Denotes a special event sent when a volume is mounted underneath one of the URLs being watched. The URL in the event is the URL to the newly-mounted volume. You will receive one of these notifications for every volume mount event inside the kernel (independent of DiskArbitration). Beware that a newly-mounted volume could contain an arbitrarily large directory hierarchy. Avoid pitfalls like triggering a recursive scan of a non-local filesystem, which you can detect by checking for the absence of the MNT_LOCAL flag in the f_flags returned by statfs(). Also be aware of the MNT_DONTBROWSE flag that is set for volumes which should not be displayed by user interface elements.

Declared In

CDEvent.h

didVolumeUnmount

Denotes a special event sent when a volume is unmounted underneath one of the URLs being watched.

@property (readonly) BOOL didVolumeUnmount

Return Value

YES if a volume is unmounted underneath one of the URLs being watched, otherwise NO.

Availability

1.1.0

Discussion

Denotes a special event sent when a volume is unmounted underneath one of the URLs being watched.

Denotes a special event sent when a volume is unmounted underneath one of the URLs being watched. The URL in the event is the URL to the directory from which the volume was unmounted. You will receive one of these notifications for every volume unmount event inside the kernel. This is not a substitute for the notifications provided by the DiskArbitration framework; you only get notified after the unmount has occurred. Beware that unmounting a volume could uncover an arbitrarily large directory hierarchy, although Mac OS X never does that.

Declared In

CDEvent.h

flags

The flags of the event.

@property (readonly) CDEventFlags flags

Return Value

The flags of the event.

Availability

1.0.0

Discussion

The flags of the event.

The flags of the event as returned by FSEvents.

Declared In

CDEvent.h

identifier

The event identifier.

@property (readonly) CDEventIdentifier identifier

Return Value

The event identifier.

Availability

1.0.0

Discussion

The event identifier.

The event identifier as returned by FSEvents.

Declared In

CDEvent.h

isCreated

The entirety of the documentation on file level events in lion is 3 sentences long. Rename behavior is odd, making the combination of events and flags somewhat confusing for atomic writes. It also appears possible to get a singular event where a file has been created, modified, and removed.

@property (readonly) BOOL isCreated

Discussion

The entirety of the documentation on file level events in lion is 3 sentences long. Rename behavior is odd, making the combination of events and flags somewhat confusing for atomic writes. It also appears possible to get a singular event where a file has been created, modified, and removed.

Declared In

CDEvent.h

isEventIdentifiersWrapped

Wheter the 64-bit event identifier counter has wrapped around.

@property (readonly) BOOL isEventIdentifiersWrapped

Return Value

YES if the 64-bit event identifier counter has wrapped around, otherwise NO.

Availability

1.1.0

Discussion

Wheter the 64-bit event identifier counter has wrapped around.

Wheter the 64-bit event identifier counter has wrapped around. As a result, previously-issued event identifiers are no longer valid arguments for the sinceEventIdentifier parameter of the CDEvents init methods.

Declared In

CDEvent.h

isGenericChange

Wheter there was some change in the directory at the specific path supplied in this event.

@property (readonly) BOOL isGenericChange

Return Value

YES if there was some change in the directory, otherwise NO.

Availability

1.1.0

Discussion

Wheter there was some change in the directory at the specific path supplied in this event.

Declared In

CDEvent.h

isHistoryDone

Denotes a sentinel event sent to mark the end of the “historical” events sent.

@property (readonly) BOOL isHistoryDone

Return Value

YES if if the event is sent to mark the end of the “historical” events sent, otherwise NO.

Availability

1.1.0

Discussion

Denotes a sentinel event sent to mark the end of the “historical” events sent.

Denotes a sentinel event sent to mark the end of the “historical” events sent as a result of specifying a sinceEventIdentifier argument other than kCDEventsSinceEventNow with the CDEvents init methods.

Declared In

CDEvent.h

isKernelDropped

Provides some information as to what might have caused the need to rescan the URL including its children.

@property (readonly) BOOL isKernelDropped

Return Value

YES if mustRescanSubDirectories returns YES and the cause were in kernelspace, otherwise NO.

Availability

1.1.0

Discussion

Provides some information as to what might have caused the need to rescan the URL including its children.

Declared In

CDEvent.h

isRootChanged

Denotes a special event sent when there is a change to one of the URLs you asked to watch.

@property (readonly) BOOL isRootChanged

Return Value

YES if there is a change to one of the URLs you asked to watch, otherwise NO.

Availability

1.1.0

Discussion

Denotes a special event sent when there is a change to one of the URLs you asked to watch.

Denotes a special event sent when there is a change to one of the URLs you asked to watch. When this method returns YES, the event identifier is zero and the URL corresponds to one of the URLs you asked to watch (specifically, the one that changed). The URL may no longer exist because it or one of its parents was deleted or renamed. Events with this flag set will only be sent if you passed the flag kFSEventStreamCreateFlagWatchRoot to the CDEvents.

Declared In

CDEvent.h

isUserDropped

Provides some information as to what might have caused the need to rescan the URL including its children.

@property (readonly) BOOL isUserDropped

Return Value

YES if mustRescanSubDirectories returns YES and the cause were in userland, otherwise NO.

Availability

1.1.0

Discussion

Provides some information as to what might have caused the need to rescan the URL including its children.

Declared In

CDEvent.h

mustRescanSubDirectories

Wheter you must rescan the whole URL including its children.

@property (readonly) BOOL mustRescanSubDirectories

Return Value

YES if you must rescan the whole directory including its children, otherwise NO.

Availability

1.1.0

Discussion

Wheter you must rescan the whole URL including its children.

Wheter your application must rescan not just the URL given in the event, but all its children, recursively. This can happen if there was a problem whereby events were coalesced hierarchically. For example, an event in /Users/jsmith/Music and an event in /Users/jsmith/Pictures might be coalesced into an event with this flag set and URL = /Users/jsmith. If this flag is set you may be able to get an idea of whether the bottleneck happened in the kernel (less likely) or in your client (more likely) by checking if isUserDropped or isKernelDropped returns YES.

Declared In

CDEvent.h

Class Methods

eventWithIdentifier:date:URL:flags:

Returns an CDEvent created with the given identifier, date, URL and flags.

+ (CDEvent *)eventWithIdentifier:(NSUInteger)identifier date:(NSDate *)date URL:(NSURL *)URL flags:(CDEventFlags)flags

Parameters

identifier

The identifier of the the event.

date

The date when the event occured.

URL

The URL of the item the event concerns.

flags

The flags of the event.

Return Value

An CDEvent created with the given identifier, date, URL and flags.

Availability

1.0.0

Discussion

Returns an CDEvent created with the given identifier, date, URL and flags.

Declared In

CDEvent.h

Instance Methods

initWithIdentifier:date:URL:flags:

Returns an CDEvent object initialized with the given identifier, date, URL and flags.

- (id)initWithIdentifier:(NSUInteger)identifier date:(NSDate *)date URL:(NSURL *)URL flags:(CDEventFlags)flags

Parameters

identifier

The identifier of the the event.

date

The date when the event occured.

URL

The URL of the item the event concerns.

flags

The flags of the event.

Return Value

An CDEvent object initialized with the given identifier, date, URL and flags.

Availability

1.0.0

Discussion

Returns an CDEvent object initialized with the given identifier, date, URL and flags.

Declared In

CDEvent.h