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

Method WriteMessageBegin

lib/go/thrift/compact_protocol.go:157–173  ·  view source on GitHub ↗

Public Writing methods. Write a message header to the wire. Compact Protocol messages contain the protocol version so we can migrate forwards in the future if need be.

(ctx context.Context, name string, typeId TMessageType, seqid int32)

Source from the content-addressed store, hash-verified

155// Write a message header to the wire. Compact Protocol messages contain the
156// protocol version so we can migrate forwards in the future if need be.
157func (p *TCompactProtocol) WriteMessageBegin(ctx context.Context, name string, typeId TMessageType, seqid int32) error {
158 err := p.writeByteDirect(COMPACT_PROTOCOL_ID)
159 if err != nil {
160 return NewTProtocolException(err)
161 }
162 err = p.writeByteDirect((COMPACT_VERSION & COMPACT_VERSION_MASK) | ((byte(typeId) << COMPACT_TYPE_SHIFT_AMOUNT) & COMPACT_TYPE_MASK))
163 if err != nil {
164 return NewTProtocolException(err)
165 }
166 _, err = p.writeVarint32(seqid)
167 if err != nil {
168 return NewTProtocolException(err)
169 }
170 e := p.WriteString(ctx, name)
171 return e
172
173}
174
175func (p *TCompactProtocol) WriteMessageEnd(ctx context.Context) error { return nil }
176

Callers

nothing calls this directly

Calls 4

writeByteDirectMethod · 0.95
writeVarint32Method · 0.95
WriteStringMethod · 0.95
NewTProtocolExceptionFunction · 0.85

Tested by

no test coverage detected