class documentation

class INotify(FileDescriptor): (source)

View In Hierarchy

The INotify file descriptor, it basically does everything related to INotify, from reading to notifying watch points.
Method __init__
Method connection​Lost Release the inotify file descriptor and do the necessary cleanup
Method do​Read Read some data from the observed file descriptors
Method fileno Get the underlying file descriptor from this inotify observer. Required by abstract.FileDescriptor subclasses.
Method ignore Remove the watch point monitoring the given path
Method watch Watch the 'mask' events in given path. Can raise INotifyError when there's a problem while adding a directory.
Instance Variable connected Undocumented
Method _add​Children This is a very private method, please don't even think about using it.
Method _add​Watch Private helper that abstracts the use of ctypes.
Method _do​Read Work on the data just read from the file descriptor.
Method _is​Watched Helper function that checks if the path is already monitored and returns its watchdescriptor if so or None otherwise.
Method _rm​Watch Private helper that abstracts the use of ctypes.
Instance Variable _buffer a bytes containing the data read from the inotify fd.
Instance Variable _fd Undocumented
Instance Variable _watchpaths a dict that maps from watched paths to the inotify watch ids
Instance Variable _watchpoints a dict that maps from inotify watch ids to watchpoints objects
Instance Variable _write​Disconnected Undocumented

Inherited from FileDescriptor:

Method do​Write Called when data can be written.
Method get​Host Similar to getPeer, but returns an address describing this side of the connection.
Method get​Peer Get the remote address of this connection.
Method lose​Connection Close the connection at the next available opportunity.
Method lose​Write​Connection Undocumented
Method pause​Producing Pause producing data.
Method read​Connection​Lost Indicates read connection was lost.
Method resume​Producing Resume producing data.
Method start​Reading Start waiting for read availability.
Method start​Writing Start waiting for write availability.
Method stop​Consuming Stop consuming data.
Method stop​Producing Stop producing data.
Method stop​Reading Stop waiting for read availability.
Method stop​Writing Stop waiting for write availability.
Method write Reliably write some data.
Method write​Connection​Lost Indicates write connection was lost.
Method write​Sequence Reliably write a sequence of data.
Method write​Some​Data Write as much as possible of the given data, immediately.
Constant SEND​_LIMIT Undocumented
Class Variable buffer​Size Undocumented
Class Variable disconnecting Undocumented
Instance Variable data​Buffer Undocumented
Instance Variable disconnected Undocumented
Instance Variable offset Undocumented
Instance Variable producer Undocumented
Instance Variable producer​Paused Undocumented
Instance Variable reactor Undocumented
Method _close​Write​Connection Undocumented
Method _is​Send​Buffer​Full Determine whether the user-space send buffer for this transport is full or not.
Method _maybe​Pause​Producer Possibly pause a producer, if there is one and the send buffer is full.
Method _post​Lose​Connection Called after a loseConnection(), when all data has been written.
Instance Variable _temp​Data​Buffer Undocumented
Instance Variable _temp​Data​Len Undocumented
Instance Variable _write​Disconnecting Undocumented

Inherited from _ConsumerMixin (via FileDescriptor):

Method register​Producer Register to receive data from a producer.
Method unregister​Producer Stop consuming data from a producer, without disconnecting.
Instance Variable streaming​Producer bool or int

Inherited from _LogOwner (via FileDescriptor):

Method log​Prefix Override this method to insert custom logging behavior. Its return value will be inserted in front of every line. It may be called more times than the number of output lines.
Method _get​Log​Prefix Determine the log prefix to use for messages related to applicationObject, which may or may not be an interfaces.ILoggingContext provider.
def __init__(self, reactor=None): (source)
Parameters
reactorAn IReactorFDSet provider which this descriptor will use to get readable and writeable event notifications. If no value is given, the global reactor will be used.
def connectionLost(self, reason): (source)
Release the inotify file descriptor and do the necessary cleanup
def doRead(self): (source)
Read some data from the observed file descriptors
def fileno(self): (source)
Get the underlying file descriptor from this inotify observer. Required by abstract.FileDescriptor subclasses.
def ignore(self, path): (source)
Remove the watch point monitoring the given path
Parameters
path:FilePathThe path that should be ignored
def watch(self, path, mask=IN_WATCH_MASK, autoAdd=False, callbacks=None, recursive=False): (source)
Watch the 'mask' events in given path. Can raise INotifyError when there's a problem while adding a directory.
Parameters
path:FilePathThe path needing monitoring
mask:intThe events that should be watched
auto​Add:boolif True automatically add newly created subdirectories
callbacks:list of callablesA list of callbacks that should be called when an event happens in the given path. The callback should accept 3 arguments: (ignored, filepath, mask)
recursive:boolAlso add all the subdirectories in this path
def _addChildren(self, iwp): (source)

This is a very private method, please don't even think about using it.

Note that this is a fricking hack... it's because we cannot be fast enough in adding a watch to a directory and so we basically end up getting here too late if some operations have already been going on in the subdir, we basically need to catchup. This eventually ends up meaning that we generate double events, your app must be resistant.

def _addWatch(self, path, mask, autoAdd, callbacks): (source)

Private helper that abstracts the use of ctypes.

Calls the internal inotify API and checks for any errors after the call. If there's an error INotify._addWatch can raise an INotifyError. If there's no error it proceeds creating a watchpoint and adding a watchpath for inverse lookup of the file descriptor from the path.

def _doRead(self, in_): (source)
Work on the data just read from the file descriptor.
def _isWatched(self, path): (source)
Helper function that checks if the path is already monitored and returns its watchdescriptor if so or None otherwise.
Parameters
path:FilePathThe path that should be checked
def _rmWatch(self, wd): (source)

Private helper that abstracts the use of ctypes.

Calls the internal inotify API to remove an fd from inotify then removes the corresponding watchpoint from the internal mapping together with the file descriptor from the watchpath.

_buffer = (source)
a bytes containing the data read from the inotify fd.

Undocumented

_watchpaths: dict = (source)
a dict that maps from watched paths to the inotify watch ids
_watchpoints: dict = (source)
a dict that maps from inotify watch ids to watchpoints objects