summaryrefslogtreecommitdiffstats
path: root/module/lib/thrift/transport
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-06-28 15:53:29 +0200
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-06-28 20:23:43 +0200
commitb8942672378fccc7d557dfc2e40a4d90aecf7a0d (patch)
tree1d4a4cd78988b0ac3c18fcad8e4f3791b11f3f27 /module/lib/thrift/transport
parent[Lib] Update bottle.py to version 0.12.7 (diff)
downloadpyload-b8942672378fccc7d557dfc2e40a4d90aecf7a0d.tar.xz
[Lib] Revert libraries to original status (remove all cosmetics optimizations)
Diffstat (limited to 'module/lib/thrift/transport')
-rw-r--r--module/lib/thrift/transport/TTransport.py4
-rw-r--r--module/lib/thrift/transport/TTwisted.py2
-rw-r--r--module/lib/thrift/transport/TZlibTransport.py24
3 files changed, 15 insertions, 15 deletions
diff --git a/module/lib/thrift/transport/TTransport.py b/module/lib/thrift/transport/TTransport.py
index 2b2e99eac..12e51a9bf 100644
--- a/module/lib/thrift/transport/TTransport.py
+++ b/module/lib/thrift/transport/TTransport.py
@@ -18,7 +18,7 @@
#
from cStringIO import StringIO
-from struct import pack, unpack
+from struct import pack,unpack
from thrift.Thrift import TException
class TTransportException(TException):
@@ -127,7 +127,7 @@ class TBufferedTransportFactory:
return buffered
-class TBufferedTransport(TTransportBase, CReadableTransport):
+class TBufferedTransport(TTransportBase,CReadableTransport):
"""Class that wraps another transport and buffers its I/O.
diff --git a/module/lib/thrift/transport/TTwisted.py b/module/lib/thrift/transport/TTwisted.py
index 141e299ca..b6dcb4e0b 100644
--- a/module/lib/thrift/transport/TTwisted.py
+++ b/module/lib/thrift/transport/TTwisted.py
@@ -79,7 +79,7 @@ class ThriftClientProtocol(basic.Int32StringReceiver):
self.started.callback(self.client)
def connectionLost(self, reason=connectionDone):
- for k, v in self.client._reqs.iteritems():
+ for k,v in self.client._reqs.iteritems():
tex = TTransport.TTransportException(
type=TTransport.TTransportException.END_OF_FILE,
message='Connection closed')
diff --git a/module/lib/thrift/transport/TZlibTransport.py b/module/lib/thrift/transport/TZlibTransport.py
index 89fa96f61..784d4e1e0 100644
--- a/module/lib/thrift/transport/TZlibTransport.py
+++ b/module/lib/thrift/transport/TZlibTransport.py
@@ -30,14 +30,14 @@ from TTransport import TTransportBase, CReadableTransport
class TZlibTransportFactory(object):
'''
Factory transport that builds zlib compressed transports.
-
+
This factory caches the last single client/transport that it was passed
and returns the same TZlibTransport object that was created.
-
+
This caching means the TServer class will get the _same_ transport
object for both input and output transports from this factory.
(For non-threaded scenarios only, since the cache only holds one object)
-
+
The purpose of this caching is to allocate only one TZlibTransport where
only one is really needed (since it must have separate read/write buffers),
and makes the statistics from getCompSavings() and getCompRatio()
@@ -52,11 +52,11 @@ class TZlibTransportFactory(object):
'''Wrap a transport , trans, with the TZlibTransport
compressed transport class, returning a new
transport to the caller.
-
+
@param compresslevel: The zlib compression level, ranging
from 0 (no compression) to 9 (best compression). Defaults to 9.
@type compresslevel: int
-
+
This method returns a TZlibTransport which wraps the
passed C{trans} TTransport derived instance.
'''
@@ -83,7 +83,7 @@ class TZlibTransport(TTransportBase, CReadableTransport):
'''
Create a new TZlibTransport, wrapping C{trans}, another
TTransport derived object.
-
+
@param trans: A thrift transport object, i.e. a TSocket() object.
@type trans: TTransport
@param compresslevel: The zlib compression level, ranging
@@ -125,19 +125,19 @@ class TZlibTransport(TTransportBase, CReadableTransport):
def getCompRatio(self):
'''
- Get the current measured compression ratios (in, out) from
+ Get the current measured compression ratios (in,out) from
this transport.
-
+
Returns a tuple of:
(inbound_compression_ratio, outbound_compression_ratio)
-
+
The compression ratios are computed as:
compressed / uncompressed
E.g., data that compresses by 10x will have a ratio of: 0.10
and data that compresses to half of ts original size will
have a ratio of 0.5
-
+
None is returned if no bytes have yet been processed in
a particular direction.
'''
@@ -152,10 +152,10 @@ class TZlibTransport(TTransportBase, CReadableTransport):
'''
Get the current count of saved bytes due to data
compression.
-
+
Returns a tuple of:
(inbound_saved_bytes, outbound_saved_bytes)
-
+
Note: if compression is actually expanding your
data (only likely with very tiny thrift objects), then
the values returned will be negative.