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

Method ReadMessageBegin

lib/go/thrift/json_protocol.go:221–247  ·  view source on GitHub ↗

Reading methods.

(ctx context.Context)

Source from the content-addressed store, hash-verified

219
220// Reading methods.
221func (p *TJSONProtocol) ReadMessageBegin(ctx context.Context) (name string, typeId TMessageType, seqId int32, err error) {
222 p.resetContextStack() // THRIFT-3735
223 if isNull, err := p.ParseListBegin(); isNull || err != nil {
224 return name, typeId, seqId, err
225 }
226 version, err := p.ReadI32(ctx)
227 if err != nil {
228 return name, typeId, seqId, err
229 }
230 if version != THRIFT_JSON_PROTOCOL_VERSION {
231 e := fmt.Errorf("Unknown Protocol version %d, expected version %d", version, THRIFT_JSON_PROTOCOL_VERSION)
232 return name, typeId, seqId, NewTProtocolExceptionWithType(INVALID_DATA, e)
233
234 }
235 if name, err = p.ReadString(ctx); err != nil {
236 return name, typeId, seqId, err
237 }
238 bTypeId, err := p.ReadByte(ctx)
239 typeId = TMessageType(bTypeId)
240 if err != nil {
241 return name, typeId, seqId, err
242 }
243 if seqId, err = p.ReadI32(ctx); err != nil {
244 return name, typeId, seqId, err
245 }
246 return name, typeId, seqId, nil
247}
248
249func (p *TJSONProtocol) ReadMessageEnd(ctx context.Context) error {
250 err := p.ParseListEnd()

Callers

nothing calls this directly

Calls 7

ReadI32Method · 0.95
ReadStringMethod · 0.95
ReadByteMethod · 0.95
resetContextStackMethod · 0.80
ParseListBeginMethod · 0.80
TMessageTypeTypeAlias · 0.70

Tested by

no test coverage detected