interfaces.py 945 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 bufflist: the buffers to read into
  12. @type bufflist: 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