The stream's element is now the enum InotifyEvent, and the struct that describes a change to a watched item is FileSystemEvent. A queue overflow was an event with descriptor -1 and an empty path that every consumer had to know about; as a case, the compiler makes them handle it. The enum is also where failed watches of a growing tree will be reported, since no call site can catch them.
10 lines
419 B
Swift
10 lines
419 B
Swift
/// What an ``Inotify`` instance delivers: a change to a watched item, or a
|
|
/// condition that affects which changes it can deliver.
|
|
public enum InotifyEvent: Sendable, Hashable {
|
|
/// A change to a watched file or directory.
|
|
case fileSystem(FileSystemEvent)
|
|
/// The kernel's event queue was full, so it dropped events. Consumers
|
|
/// that must not miss changes should rescan the watched trees.
|
|
case queueOverflow
|
|
}
|