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

Function SerializeRequestDefault

src/brpc/protocol.cpp:133–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133void SerializeRequestDefault(butil::IOBuf* buf, Controller* cntl,
134 const google::protobuf::Message* request) {
135 // Check sanity of request.
136 if (!request) {
137 return cntl->SetFailed(EREQUEST, "`request' is NULL");
138 }
139 if (!request->IsInitialized()) {
140 return cntl->SetFailed(
141 EREQUEST, "Missing required fields in request: %s",
142 request->InitializationErrorString().c_str());
143 }
144 if (!SerializeAsCompressedData(*request, buf, cntl->request_compress_type())) {
145 return cntl->SetFailed(
146 EREQUEST, "Fail to compress request, compress_type=%d",
147 (int)cntl->request_compress_type());
148 }
149}
150
151// ======================================================
152

Callers 8

TEST_FFunction · 0.85
TEST_FFunction · 0.85
TestSofaCompressMethod · 0.85
TEST_FFunction · 0.85
TestHuluCompressMethod · 0.85
TEST_FFunction · 0.85
SerializeNovaRequestFunction · 0.85

Calls 6

request_compress_typeMethod · 0.80
SetFailedMethod · 0.45
IsInitializedMethod · 0.45
c_strMethod · 0.45

Tested by 6

TEST_FFunction · 0.68
TEST_FFunction · 0.68
TestSofaCompressMethod · 0.68
TEST_FFunction · 0.68
TestHuluCompressMethod · 0.68
TEST_FFunction · 0.68