Mark Slee | 89e2bb8 | 2007-03-01 00:20:36 +0000 | [diff] [blame] | 1 | # |
David Reiss | ea2cba8 | 2009-03-30 21:35:00 +0000 | [diff] [blame] | 2 | # Licensed to the Apache Software Foundation (ASF) under one |
| 3 | # or more contributor license agreements. See the NOTICE file |
| 4 | # distributed with this work for additional information |
| 5 | # regarding copyright ownership. The ASF licenses this file |
| 6 | # to you under the Apache License, Version 2.0 (the |
| 7 | # "License"); you may not use this file except in compliance |
| 8 | # with the License. You may obtain a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, |
| 13 | # software distributed under the License is distributed on an |
| 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | # KIND, either express or implied. See the License for the |
| 16 | # specific language governing permissions and limitations |
| 17 | # under the License. |
| 18 | # |
Mark Slee | 89e2bb8 | 2007-03-01 00:20:36 +0000 | [diff] [blame] | 19 | |
James E. King III | e44f6a9 | 2019-02-07 17:11:21 -0500 | [diff] [blame] | 20 | from .TProtocol import TType, TProtocolBase, TProtocolException, TProtocolFactory |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 21 | from struct import pack, unpack |
| 22 | |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 23 | |
Bryan Duxbury | 6972041 | 2012-01-03 17:32:30 +0000 | [diff] [blame] | 24 | class TBinaryProtocol(TProtocolBase): |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 25 | """Binary implementation of the Thrift protocol driver.""" |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 26 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 27 | # NastyHaxx. Python 2.4+ on 32-bit machines forces hex constants to be |
| 28 | # positive, converting this into a long. If we hardcode the int value |
| 29 | # instead it'll stay in 32 bit-land. |
Mark Slee | 9b36ef3 | 2007-10-02 04:44:48 +0000 | [diff] [blame] | 30 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 31 | # VERSION_MASK = 0xffff0000 |
| 32 | VERSION_MASK = -65536 |
Mark Slee | 9b36ef3 | 2007-10-02 04:44:48 +0000 | [diff] [blame] | 33 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 34 | # VERSION_1 = 0x80010000 |
| 35 | VERSION_1 = -2147418112 |
Mark Slee | 9b36ef3 | 2007-10-02 04:44:48 +0000 | [diff] [blame] | 36 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 37 | TYPE_MASK = 0x000000ff |
Mark Slee | 808454e | 2007-06-20 21:51:57 +0000 | [diff] [blame] | 38 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 39 | def __init__(self, trans, strictRead=False, strictWrite=True, **kwargs): |
| 40 | TProtocolBase.__init__(self, trans) |
| 41 | self.strictRead = strictRead |
| 42 | self.strictWrite = strictWrite |
| 43 | self.string_length_limit = kwargs.get('string_length_limit', None) |
| 44 | self.container_length_limit = kwargs.get('container_length_limit', None) |
Nobuaki Sukegawa | 7b545b5 | 2016-01-11 13:46:04 +0900 | [diff] [blame] | 45 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 46 | def _check_string_length(self, length): |
| 47 | self._check_length(self.string_length_limit, length) |
Nobuaki Sukegawa | 7b545b5 | 2016-01-11 13:46:04 +0900 | [diff] [blame] | 48 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 49 | def _check_container_length(self, length): |
| 50 | self._check_length(self.container_length_limit, length) |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 51 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 52 | def writeMessageBegin(self, name, type, seqid): |
| 53 | if self.strictWrite: |
| 54 | self.writeI32(TBinaryProtocol.VERSION_1 | type) |
| 55 | self.writeString(name) |
| 56 | self.writeI32(seqid) |
| 57 | else: |
| 58 | self.writeString(name) |
| 59 | self.writeByte(type) |
| 60 | self.writeI32(seqid) |
Mark Slee | 4ac459f | 2006-10-25 21:39:01 +0000 | [diff] [blame] | 61 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 62 | def writeMessageEnd(self): |
| 63 | pass |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 64 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 65 | def writeStructBegin(self, name): |
| 66 | pass |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 67 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 68 | def writeStructEnd(self): |
| 69 | pass |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 70 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 71 | def writeFieldBegin(self, name, type, id): |
| 72 | self.writeByte(type) |
| 73 | self.writeI16(id) |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 74 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 75 | def writeFieldEnd(self): |
| 76 | pass |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 77 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 78 | def writeFieldStop(self): |
| 79 | self.writeByte(TType.STOP) |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 80 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 81 | def writeMapBegin(self, ktype, vtype, size): |
| 82 | self.writeByte(ktype) |
| 83 | self.writeByte(vtype) |
| 84 | self.writeI32(size) |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 85 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 86 | def writeMapEnd(self): |
| 87 | pass |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 88 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 89 | def writeListBegin(self, etype, size): |
| 90 | self.writeByte(etype) |
| 91 | self.writeI32(size) |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 92 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 93 | def writeListEnd(self): |
| 94 | pass |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 95 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 96 | def writeSetBegin(self, etype, size): |
| 97 | self.writeByte(etype) |
| 98 | self.writeI32(size) |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 99 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 100 | def writeSetEnd(self): |
| 101 | pass |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 102 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 103 | def writeBool(self, bool): |
| 104 | if bool: |
| 105 | self.writeByte(1) |
| 106 | else: |
| 107 | self.writeByte(0) |
David Reiss | 382fc30 | 2007-08-25 18:01:30 +0000 | [diff] [blame] | 108 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 109 | def writeByte(self, byte): |
| 110 | buff = pack("!b", byte) |
| 111 | self.trans.write(buff) |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 112 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 113 | def writeI16(self, i16): |
| 114 | buff = pack("!h", i16) |
| 115 | self.trans.write(buff) |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 116 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 117 | def writeI32(self, i32): |
| 118 | buff = pack("!i", i32) |
| 119 | self.trans.write(buff) |
David Reiss | 382fc30 | 2007-08-25 18:01:30 +0000 | [diff] [blame] | 120 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 121 | def writeI64(self, i64): |
| 122 | buff = pack("!q", i64) |
| 123 | self.trans.write(buff) |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 124 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 125 | def writeDouble(self, dub): |
| 126 | buff = pack("!d", dub) |
| 127 | self.trans.write(buff) |
Mark Slee | c98d050 | 2006-09-06 02:42:25 +0000 | [diff] [blame] | 128 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 129 | def writeBinary(self, str): |
| 130 | self.writeI32(len(str)) |
| 131 | self.trans.write(str) |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 132 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 133 | def readMessageBegin(self): |
| 134 | sz = self.readI32() |
| 135 | if sz < 0: |
| 136 | version = sz & TBinaryProtocol.VERSION_MASK |
| 137 | if version != TBinaryProtocol.VERSION_1: |
| 138 | raise TProtocolException( |
| 139 | type=TProtocolException.BAD_VERSION, |
| 140 | message='Bad version in readMessageBegin: %d' % (sz)) |
| 141 | type = sz & TBinaryProtocol.TYPE_MASK |
| 142 | name = self.readString() |
| 143 | seqid = self.readI32() |
| 144 | else: |
| 145 | if self.strictRead: |
| 146 | raise TProtocolException(type=TProtocolException.BAD_VERSION, |
| 147 | message='No protocol version header') |
| 148 | name = self.trans.readAll(sz) |
| 149 | type = self.readByte() |
| 150 | seqid = self.readI32() |
| 151 | return (name, type, seqid) |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 152 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 153 | def readMessageEnd(self): |
| 154 | pass |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 155 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 156 | def readStructBegin(self): |
| 157 | pass |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 158 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 159 | def readStructEnd(self): |
| 160 | pass |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 161 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 162 | def readFieldBegin(self): |
| 163 | type = self.readByte() |
| 164 | if type == TType.STOP: |
| 165 | return (None, type, 0) |
| 166 | id = self.readI16() |
| 167 | return (None, type, id) |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 168 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 169 | def readFieldEnd(self): |
| 170 | pass |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 171 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 172 | def readMapBegin(self): |
| 173 | ktype = self.readByte() |
| 174 | vtype = self.readByte() |
| 175 | size = self.readI32() |
| 176 | self._check_container_length(size) |
| 177 | return (ktype, vtype, size) |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 178 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 179 | def readMapEnd(self): |
| 180 | pass |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 181 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 182 | def readListBegin(self): |
| 183 | etype = self.readByte() |
| 184 | size = self.readI32() |
| 185 | self._check_container_length(size) |
| 186 | return (etype, size) |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 187 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 188 | def readListEnd(self): |
| 189 | pass |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 190 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 191 | def readSetBegin(self): |
| 192 | etype = self.readByte() |
| 193 | size = self.readI32() |
| 194 | self._check_container_length(size) |
| 195 | return (etype, size) |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 196 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 197 | def readSetEnd(self): |
| 198 | pass |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 199 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 200 | def readBool(self): |
| 201 | byte = self.readByte() |
| 202 | if byte == 0: |
| 203 | return False |
| 204 | return True |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 205 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 206 | def readByte(self): |
| 207 | buff = self.trans.readAll(1) |
| 208 | val, = unpack('!b', buff) |
| 209 | return val |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 210 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 211 | def readI16(self): |
| 212 | buff = self.trans.readAll(2) |
| 213 | val, = unpack('!h', buff) |
| 214 | return val |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 215 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 216 | def readI32(self): |
| 217 | buff = self.trans.readAll(4) |
| 218 | val, = unpack('!i', buff) |
| 219 | return val |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 220 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 221 | def readI64(self): |
| 222 | buff = self.trans.readAll(8) |
| 223 | val, = unpack('!q', buff) |
| 224 | return val |
Mark Slee | cde2b61 | 2006-09-03 21:13:07 +0000 | [diff] [blame] | 225 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 226 | def readDouble(self): |
| 227 | buff = self.trans.readAll(8) |
| 228 | val, = unpack('!d', buff) |
| 229 | return val |
Mark Slee | c98d050 | 2006-09-06 02:42:25 +0000 | [diff] [blame] | 230 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 231 | def readBinary(self): |
| 232 | size = self.readI32() |
| 233 | self._check_string_length(size) |
| 234 | s = self.trans.readAll(size) |
| 235 | return s |
Mark Slee | 4ac459f | 2006-10-25 21:39:01 +0000 | [diff] [blame] | 236 | |
David Reiss | 382fc30 | 2007-08-25 18:01:30 +0000 | [diff] [blame] | 237 | |
James E. King III | e44f6a9 | 2019-02-07 17:11:21 -0500 | [diff] [blame] | 238 | class TBinaryProtocolFactory(TProtocolFactory): |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 239 | def __init__(self, strictRead=False, strictWrite=True, **kwargs): |
| 240 | self.strictRead = strictRead |
| 241 | self.strictWrite = strictWrite |
| 242 | self.string_length_limit = kwargs.get('string_length_limit', None) |
| 243 | self.container_length_limit = kwargs.get('container_length_limit', None) |
Mark Slee | 808454e | 2007-06-20 21:51:57 +0000 | [diff] [blame] | 244 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 245 | def getProtocol(self, trans): |
| 246 | prot = TBinaryProtocol(trans, self.strictRead, self.strictWrite, |
| 247 | string_length_limit=self.string_length_limit, |
| 248 | container_length_limit=self.container_length_limit) |
| 249 | return prot |
David Reiss | 382fc30 | 2007-08-25 18:01:30 +0000 | [diff] [blame] | 250 | |
| 251 | |
| 252 | class TBinaryProtocolAccelerated(TBinaryProtocol): |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 253 | """C-Accelerated version of TBinaryProtocol. |
David Reiss | 382fc30 | 2007-08-25 18:01:30 +0000 | [diff] [blame] | 254 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 255 | This class does not override any of TBinaryProtocol's methods, |
| 256 | but the generated code recognizes it directly and will call into |
| 257 | our C module to do the encoding, bypassing this object entirely. |
| 258 | We inherit from TBinaryProtocol so that the normal TBinaryProtocol |
| 259 | encoding can happen if the fastbinary module doesn't work for some |
| 260 | reason. (TODO(dreiss): Make this happen sanely in more cases.) |
Nobuaki Sukegawa | 6525f6a | 2016-02-11 13:58:39 +0900 | [diff] [blame] | 261 | To disable this behavior, pass fallback=False constructor argument. |
David Reiss | 382fc30 | 2007-08-25 18:01:30 +0000 | [diff] [blame] | 262 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 263 | In order to take advantage of the C module, just use |
| 264 | TBinaryProtocolAccelerated instead of TBinaryProtocol. |
David Reiss | 382fc30 | 2007-08-25 18:01:30 +0000 | [diff] [blame] | 265 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 266 | NOTE: This code was contributed by an external developer. |
| 267 | The internal Thrift team has reviewed and tested it, |
| 268 | but we cannot guarantee that it is production-ready. |
| 269 | Please feel free to report bugs and/or success stories |
| 270 | to the public mailing list. |
| 271 | """ |
| 272 | pass |
David Reiss | 382fc30 | 2007-08-25 18:01:30 +0000 | [diff] [blame] | 273 | |
Nobuaki Sukegawa | 6525f6a | 2016-02-11 13:58:39 +0900 | [diff] [blame] | 274 | def __init__(self, *args, **kwargs): |
| 275 | fallback = kwargs.pop('fallback', True) |
| 276 | super(TBinaryProtocolAccelerated, self).__init__(*args, **kwargs) |
| 277 | try: |
| 278 | from thrift.protocol import fastbinary |
| 279 | except ImportError: |
| 280 | if not fallback: |
| 281 | raise |
| 282 | else: |
| 283 | self._fast_decode = fastbinary.decode_binary |
| 284 | self._fast_encode = fastbinary.encode_binary |
| 285 | |
David Reiss | 382fc30 | 2007-08-25 18:01:30 +0000 | [diff] [blame] | 286 | |
James E. King III | e44f6a9 | 2019-02-07 17:11:21 -0500 | [diff] [blame] | 287 | class TBinaryProtocolAcceleratedFactory(TProtocolFactory): |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 288 | def __init__(self, |
| 289 | string_length_limit=None, |
Nobuaki Sukegawa | 6525f6a | 2016-02-11 13:58:39 +0900 | [diff] [blame] | 290 | container_length_limit=None, |
| 291 | fallback=True): |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 292 | self.string_length_limit = string_length_limit |
| 293 | self.container_length_limit = container_length_limit |
Nobuaki Sukegawa | 6525f6a | 2016-02-11 13:58:39 +0900 | [diff] [blame] | 294 | self._fallback = fallback |
Nobuaki Sukegawa | 7b545b5 | 2016-01-11 13:46:04 +0900 | [diff] [blame] | 295 | |
Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 296 | def getProtocol(self, trans): |
| 297 | return TBinaryProtocolAccelerated( |
| 298 | trans, |
| 299 | string_length_limit=self.string_length_limit, |
Nobuaki Sukegawa | 6525f6a | 2016-02-11 13:58:39 +0900 | [diff] [blame] | 300 | container_length_limit=self.container_length_limit, |
| 301 | fallback=self._fallback) |