Package pyxmpp2 :: Package mainloop :: Module interfaces :: Class IOHandler
[hide private]

Class IOHandler


Wrapper for a socket or a file descriptor to be used in event loop or for I/O threads.
Nested Classes [hide private]
  __metaclass__
Metaclass for defining Abstract Base Classes (ABCs).
Instance Methods [hide private]
 
fileno(self)
Return file descriptor to poll or select.
 
is_readable(self)
Returns: True when the I/O channel can be read
 
wait_for_readability(self)
Stop current thread until the channel is readable.
 
is_writable(self)
Returns: True when the I/O channel can be written to
IOHandlerPrepareResult
prepare(self)
Prepare the I/O handler for the event loop or an event loop iteration.
 
wait_for_writability(self)
Stop current thread until the channel is writable.
 
handle_write(self)
Handle the 'channel writable' state.
 
handle_read(self)
Handle the 'channel readable' state.
 
handle_hup(self)
Handle the 'channel hungup' state.
 
handle_err(self)
Handle an error reported.
 
handle_nval(self)
Handle an 'invalid file descriptor' event.
 
close(self)
Close the channell immediately, so it won't expect more events.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  __abstractmethods__ = frozenset(['close', 'fileno', 'handle_er...
  _abc_cache = <_weakrefset.WeakSet object at 0x86bcdcc>
  _abc_negative_cache = <_weakrefset.WeakSet object at 0x86bce0c>
  _abc_negative_cache_version = 10
  _abc_registry = <_weakrefset.WeakSet object at 0x86bcd6c>
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

fileno(self)

 
Return file descriptor to poll or select.
Decorators:
  • @abstractmethod

is_readable(self)

 
Returns:
True when the I/O channel can be read
Decorators:
  • @abstractmethod

wait_for_readability(self)

 
Stop current thread until the channel is readable.
Returns:
False if it won't be readable (e.g. is closed)
Decorators:
  • @abstractmethod

is_writable(self)

 
Returns:
True when the I/O channel can be written to
Decorators:
  • @abstractmethod

prepare(self)

 
Prepare the I/O handler for the event loop or an event loop iteration.
Returns: IOHandlerPrepareResult
HandlerReady() if there is no need to call prepare again or PrepareAgain() otherwise.
Decorators:
  • @abstractmethod

wait_for_writability(self)

 
Stop current thread until the channel is writable.
Returns:
False if it won't be readable (e.g. is closed)
Decorators:
  • @abstractmethod

handle_write(self)

 
Handle the 'channel writable' state. E.g. send buffered data via a socket.
Decorators:
  • @abstractmethod

handle_read(self)

 
Handle the 'channel readable' state. E.g. read from a socket.
Decorators:
  • @abstractmethod

handle_hup(self)

 
Handle the 'channel hungup' state. The handler should not be writtable after this.
Decorators:
  • @abstractmethod

handle_err(self)

 
Handle an error reported.
Decorators:
  • @abstractmethod

handle_nval(self)

 
Handle an 'invalid file descriptor' event.
Decorators:
  • @abstractmethod

close(self)

 
Close the channell immediately, so it won't expect more events.
Decorators:
  • @abstractmethod

Class Variable Details [hide private]

__abstractmethods__

Value:
frozenset(['close',
           'fileno',
           'handle_err',
           'handle_hup',
           'handle_nval',
           'handle_read',
           'handle_write',
           'is_readable',
...