aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/Twisted/py2/twisted/internet/iocpreactor/interfaces.py
blob: 9e4d3ca4166c2eff0337dc169b6cc030947d15b1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.


"""
Interfaces for iocpreactor
"""


from zope.interface import Interface



class IReadHandle(Interface):
    def readFromHandle(bufflist, evt):
        """
        Read into the given buffers from this handle.

        @param buff: the buffers to read into
        @type buff: list of objects implementing the read/write buffer protocol

        @param evt: an IOCP Event object

        @return: tuple (return code, number of bytes read)
        """



class IWriteHandle(Interface):
    def writeToHandle(buff, evt):
        """
        Write the given buffer to this handle.

        @param buff: the buffer to write
        @type buff: any object implementing the buffer protocol

        @param evt: an IOCP Event object

        @return: tuple (return code, number of bytes written)
        """



class IReadWriteHandle(IReadHandle, IWriteHandle):
    pass