MCPcopy Create free account
hub / github.com/apache/thrift / writeMessageBegin

Method writeMessageBegin

lib/py/src/protocol/TCompactProtocol.py:158–171  ·  view source on GitHub ↗
(self, name, type, seqid)

Source from the content-addressed store, hash-verified

156 writeVarint(self.trans, n)
157
158 def writeMessageBegin(self, name, type, seqid):
159 assert self.state == CLEAR
160 self.__writeUByte(self.PROTOCOL_ID)
161 self.__writeUByte(self.VERSION | (type << self.TYPE_SHIFT_AMOUNT))
162 # The sequence id is a signed 32-bit integer but the compact protocol
163 # writes this out as a "var int" which is always positive, and attempting
164 # to write a negative number results in an infinite loop, so we may
165 # need to do some conversion here...
166 tseqid = seqid
167 if tseqid < 0:
168 tseqid = 2147483648 + (2147483648 + tseqid)
169 self.__writeVarint(tseqid)
170 self.__writeBinary(bytes(name, 'utf-8'))
171 self.state = VALUE_WRITE
172
173 def writeMessageEnd(self):
174 assert self.state == VALUE_WRITE

Callers 1

testMessageFunction · 0.95

Calls 3

__writeUByteMethod · 0.95
__writeVarintMethod · 0.95
__writeBinaryMethod · 0.95

Tested by

no test coverage detected