MCPcopy Create free account
hub / github.com/apache/brpc / SerializeNsheadMcpackRequest

Function SerializeNsheadMcpackRequest

src/brpc/policy/nshead_mcpack_protocol.cpp:138–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136}
137
138void SerializeNsheadMcpackRequest(butil::IOBuf* buf, Controller* cntl,
139 const google::protobuf::Message* pb_req) {
140 CompressType type = cntl->request_compress_type();
141 if (type != COMPRESS_TYPE_NONE) {
142 cntl->SetFailed(EREQUEST,
143 "nshead_mcpack protocol doesn't support compression");
144 return;
145 }
146 const std::string msg_name = butil::EnsureString(pb_req->GetDescriptor()->full_name());
147 mcpack2pb::MessageHandler handler = mcpack2pb::find_message_handler(msg_name);
148 if (!handler.serialize_to_iobuf(*pb_req, buf, ::mcpack2pb::FORMAT_MCPACK_V2)) {
149 cntl->SetFailed(EREQUEST, "Fail to serialize %s", msg_name.c_str());
150 return;
151 }
152}
153
154void PackNsheadMcpackRequest(butil::IOBuf* buf,
155 SocketMessage**,

Callers

nothing calls this directly

Calls 7

EnsureStringFunction · 0.85
find_message_handlerFunction · 0.85
request_compress_typeMethod · 0.80
serialize_to_iobufMethod · 0.80
SetFailedMethod · 0.45
GetDescriptorMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected