interfaces.py 942 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # Copyright (c) Twisted Matrix Laboratories.
  2. # See LICENSE for details.
  3. """
  4. Interfaces for iocpreactor
  5. """
  6. from zope.interface import Interface
  7. class IReadHandle(Interface):
  8. def readFromHandle(bufflist, evt):
  9. """
  10. Read into the given buffers from this handle.
  11. @param buff: the buffers to read into
  12. @type buff: list of objects implementing the read/write buffer protocol
  13. @param evt: an IOCP Event object
  14. @return: tuple (return code, number of bytes read)
  15. """
  16. class IWriteHandle(Interface):
  17. def writeToHandle(buff, evt):
  18. """
  19. Write the given buffer to this handle.
  20. @param buff: the buffer to write
  21. @type buff: any object implementing the buffer protocol
  22. @param evt: an IOCP Event object
  23. @return: tuple (return code, number of bytes written)
  24. """
  25. class IReadWriteHandle(IReadHandle, IWriteHandle):
  26. pass