Change notification support for FS.
This module defines a standard interface for FS subclasses that support change notification callbacks. It also offers some WrapFS subclasses that can simulate such an ability on top of an ordinary FS object.
An FS object that wants to be “watchable” must provide the following methods:
Request that the given callback be executed in response to changes to the given path. A specific set of change events can be specified. This method returns a Watcher object.
Remove the given watcher object, or any watchers associated with the given callback.
If you would prefer to read changes from a filesystem in a blocking fashion rather than using callbacks, you can use the function ‘iter_changes’ to obtain an iterator over the change events.
Event fired when a file’s contents are accessed.
Event fired when the filesystem is closed.
Event fired when a new file or directory is created.
Event fired when some miscellaneous error occurs.
Base class for change notification events.
Event fired when a file or directory is modified.
Event fired when a file or directory is the target of a move.
Event fired when a file or directory is the source of a move.
Event fired when some events could not be processed.
FS wrapper simulating watcher callbacks by periodic polling.
This FS wrapper augments the functionality of WatchableFS by periodically polling the underlying FS for changes. It is thus capable of detecting changes made to the underlying FS via other interfaces, albeit with a (configurable) delay to account for the polling interval.
Event fired when a file or directory is removed.
FS wrapper simulating watcher callbacks.
This FS wrapper intercepts method calls that modify the underlying FS and generates appropriate notification events. It thus allows watchers to monitor changes made through the underlying FS object, but not changes that might be made through other interfaces to the same filesystem.
Mixin class providing watcher management functions.
Add a watcher callback to the FS.
Delete a watcher callback from the FS.
Notify watchers of the given event data.
File wrapper for use with WatchableFS.
This file wrapper provides access to a file opened from a WatchableFS instance, and fires MODIFIED events when the file is modified.
Object encapsulating filesystem watch info.
Ensure that the given fs supports watching, simulating it if necessary.
Given an FS object, this function returns an equivalent FS that has support for watcher callbacks. This may be the original object if it supports them natively, or a wrapper class if they must be simulated.
Blocking iterator over the change events produced by an FS.
This class can be used to transform the callback-based watcher mechanism into a blocking stream of events. It operates by having the callbacks push events onto a queue as they come in, then reading them off one at a time.