summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/transports.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@dropbox.com>2013-10-18 22:17:11 (GMT)
committerGuido van Rossum <guido@dropbox.com>2013-10-18 22:17:11 (GMT)
commit355491dc47ea4a2574ee8f9ea60a0d25fe3fba43 (patch)
tree2b9661e6f8c6d24704fae0c82467674802749d6d /Lib/asyncio/transports.py
parent051a33148813d045c33745ccd0e9e20e96b1bb6f (diff)
downloadcpython-355491dc47ea4a2574ee8f9ea60a0d25fe3fba43.zip
cpython-355491dc47ea4a2574ee8f9ea60a0d25fe3fba43.tar.gz
cpython-355491dc47ea4a2574ee8f9ea60a0d25fe3fba43.tar.bz2
Write flow control for asyncio (includes asyncio.streams overhaul).
Diffstat (limited to 'Lib/asyncio/transports.py')
-rw-r--r--Lib/asyncio/transports.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/Lib/asyncio/transports.py b/Lib/asyncio/transports.py
index f1a7180..8c6b189 100644
--- a/Lib/asyncio/transports.py
+++ b/Lib/asyncio/transports.py
@@ -49,6 +49,31 @@ class ReadTransport(BaseTransport):
class WriteTransport(BaseTransport):
"""ABC for write-only transports."""
+ def set_write_buffer_limits(self, high=None, low=None):
+ """Set the high- and low-water limits for write flow control.
+
+ These two values control when to call the protocol's
+ pause_writing() and resume_writing() methods. If specified,
+ the low-water limit must be less than or equal to the
+ high-water limit. Neither value can be negative.
+
+ The defaults are implementation-specific. If only the
+ high-water limit is given, the low-water limit defaults to a
+ implementation-specific value less than or equal to the
+ high-water limit. Setting high to zero forces low to zero as
+ well, and causes pause_writing() to be called whenever the
+ buffer becomes non-empty. Setting low to zero causes
+ resume_writing() to be called only once the buffer is empty.
+ Use of zero for either limit is generally sub-optimal as it
+ reduces opportunities for doing I/O and computation
+ concurrently.
+ """
+ raise NotImplementedError
+
+ def get_write_buffer_size(self):
+ """Return the current size of the write buffer."""
+ raise NotImplementedError
+
def write(self, data):
"""Write some data bytes to the transport.