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

Method ReadMessageBegin

lib/go/thrift/binary_protocol.go:272–310  ·  view source on GitHub ↗

** * Reading methods */

(ctx context.Context)

Source from the content-addressed store, hash-verified

270 */
271
272func (p *TBinaryProtocol) ReadMessageBegin(ctx context.Context) (name string, typeId TMessageType, seqId int32, err error) {
273 size, e := p.ReadI32(ctx)
274 if e != nil {
275 return "", typeId, 0, NewTProtocolException(e)
276 }
277 if size < 0 {
278 typeId = TMessageType(size & 0x0ff)
279 version := int64(int64(size) & VERSION_MASK)
280 if version != VERSION_1 {
281 return name, typeId, seqId, NewTProtocolExceptionWithType(BAD_VERSION, fmt.Errorf("Bad version in ReadMessageBegin"))
282 }
283 name, e = p.ReadString(ctx)
284 if e != nil {
285 return name, typeId, seqId, NewTProtocolException(e)
286 }
287 seqId, e = p.ReadI32(ctx)
288 if e != nil {
289 return name, typeId, seqId, NewTProtocolException(e)
290 }
291 return name, typeId, seqId, nil
292 }
293 if p.cfg.GetTBinaryStrictRead() {
294 return name, typeId, seqId, NewTProtocolExceptionWithType(BAD_VERSION, fmt.Errorf("Missing version in ReadMessageBegin"))
295 }
296 name, e2 := p.readStringBody(size)
297 if e2 != nil {
298 return name, typeId, seqId, e2
299 }
300 b, e3 := p.ReadByte(ctx)
301 if e3 != nil {
302 return name, typeId, seqId, e3
303 }
304 typeId = TMessageType(b)
305 seqId, e4 := p.ReadI32(ctx)
306 if e4 != nil {
307 return name, typeId, seqId, e4
308 }
309 return name, typeId, seqId, nil
310}
311
312func (p *TBinaryProtocol) ReadMessageEnd(ctx context.Context) error {
313 return nil

Callers

nothing calls this directly

Calls 8

ReadI32Method · 0.95
ReadStringMethod · 0.95
readStringBodyMethod · 0.95
ReadByteMethod · 0.95
NewTProtocolExceptionFunction · 0.85
GetTBinaryStrictReadMethod · 0.80
TMessageTypeTypeAlias · 0.70

Tested by

no test coverage detected