/Users/deen/code/yugabyte-db/build/debugcov-clang-dynamic-arm64-ninja/src/yb/rpc/rpc_header.messages.cc
Line | Count | Source (jump to first uncovered line) |
1 | | // THIS FILE IS AUTOGENERATED FROM yb/rpc/rpc_header.proto |
2 | | |
3 | | #include "yb/rpc/rpc_header.messages.h" |
4 | | |
5 | | #include "yb/gutil/strings/numbers.h" |
6 | | |
7 | | namespace yb { |
8 | | namespace rpc { |
9 | | |
10 | | LWRemoteMethodPB::LWRemoteMethodPB(::yb::Arena* arena) |
11 | 0 | : arena_(*arena) { |
12 | 0 | } |
13 | | |
14 | | LWRemoteMethodPB::LWRemoteMethodPB(::yb::Arena* arena, const LWRemoteMethodPB& rhs) |
15 | | : arena_(*arena), |
16 | | has_fields_(rhs.has_fields_), |
17 | | service_name_(arena->DupSlice(rhs.service_name_)), |
18 | 0 | method_name_(arena->DupSlice(rhs.method_name_)) { |
19 | 0 | } |
20 | | |
21 | 0 | void LWRemoteMethodPB::AppendToDebugString(std::string* out) const { |
22 | 0 | bool first = true;if (has_service_name()) { |
23 | 0 | ::yb::rpc::AppendFieldTitle("service_name", ": \"", &first, out); |
24 | 0 | *out += service_name().ToBuffer(); |
25 | 0 | *out += '"'; |
26 | 0 | } |
27 | 0 | if (has_method_name()) { |
28 | 0 | ::yb::rpc::AppendFieldTitle("method_name", ": \"", &first, out); |
29 | 0 | *out += method_name().ToBuffer(); |
30 | 0 | *out += '"'; |
31 | 0 | } |
32 | 0 | } |
33 | | |
34 | 0 | void LWRemoteMethodPB::Clear() { |
35 | 0 | clear_service_name(); |
36 | 0 | clear_method_name(); |
37 | 0 | } |
38 | | |
39 | 0 | void LWRemoteMethodPB::CopyFrom(const LWRemoteMethodPB& rhs) { |
40 | 0 | if (rhs.has_service_name()) { |
41 | 0 | service_name_ = arena_.DupSlice(rhs.service_name_); |
42 | 0 | } else { |
43 | 0 | clear_service_name(); |
44 | 0 | } |
45 | 0 | if (rhs.has_method_name()) { |
46 | 0 | method_name_ = arena_.DupSlice(rhs.method_name_); |
47 | 0 | } else { |
48 | 0 | clear_method_name(); |
49 | 0 | } |
50 | 0 | has_fields_ = rhs.has_fields_; |
51 | 0 | } |
52 | | |
53 | 0 | void LWRemoteMethodPB::CopyFrom(const RemoteMethodPB& rhs) { |
54 | 0 | if (rhs.has_service_name()) { |
55 | 0 | service_name_ = arena_.DupSlice(rhs.service_name()); |
56 | 0 | has_fields_.Set(RemoteMethodPBFields::kServiceName); |
57 | 0 | } else { |
58 | 0 | clear_service_name(); |
59 | 0 | } |
60 | 0 | if (rhs.has_method_name()) { |
61 | 0 | method_name_ = arena_.DupSlice(rhs.method_name()); |
62 | 0 | has_fields_.Set(RemoteMethodPBFields::kMethodName); |
63 | 0 | } else { |
64 | 0 | clear_method_name(); |
65 | 0 | } |
66 | 0 | } |
67 | | |
68 | 0 | Status LWRemoteMethodPB::ParseFromCodedStream(google::protobuf::io::CodedInputStream* input) { |
69 | 0 | for (;;) { |
70 | 0 | auto p = input->ReadTagWithCutoffNoLastTag(31); |
71 | 0 | if (!p.second && !p.first) { |
72 | 0 | return Status::OK(); |
73 | 0 | } |
74 | 0 | switch(::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(p.first)) { |
75 | 0 | case 1: { // service_name |
76 | 0 | if (!::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_STRING, ::yb::Slice>::Read(input, mutable_service_name())) { |
77 | 0 | return ::yb::rpc::ParseFailed("service_name"); |
78 | 0 | } |
79 | 0 | break; |
80 | 0 | } |
81 | 0 | case 2: { // method_name |
82 | 0 | if (!::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_STRING, ::yb::Slice>::Read(input, mutable_method_name())) { |
83 | 0 | return ::yb::rpc::ParseFailed("method_name"); |
84 | 0 | } |
85 | 0 | break; |
86 | 0 | } |
87 | 0 | } |
88 | 0 | } |
89 | 0 | } |
90 | | |
91 | 0 | uint8_t* LWRemoteMethodPB::SerializeToArray(uint8_t* out) const { |
92 | 0 | if (has_service_name()) { |
93 | 0 | out = ::yb::rpc::SingleWrite<::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_STRING, ::yb::Slice>, 10>(service_name_, out); |
94 | 0 | } |
95 | 0 | if (has_method_name()) { |
96 | 0 | out = ::yb::rpc::SingleWrite<::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_STRING, ::yb::Slice>, 18>(method_name_, out); |
97 | 0 | } |
98 | 0 | return out; |
99 | 0 | } |
100 | | |
101 | 0 | size_t LWRemoteMethodPB::SerializedSize() const { |
102 | 0 | size_t result = 0; |
103 | 0 | if (has_service_name()) { |
104 | 0 | result += ::yb::rpc::SingleSize<::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_STRING, ::yb::Slice>, 1>(service_name_); |
105 | 0 | } |
106 | 0 | if (has_method_name()) { |
107 | 0 | result += ::yb::rpc::SingleSize<::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_STRING, ::yb::Slice>, 1>(method_name_); |
108 | 0 | } |
109 | 0 | cached_size_ = result; |
110 | 0 | return result; |
111 | 0 | } |
112 | | |
113 | 0 | void LWRemoteMethodPB::ToGoogleProtobuf(RemoteMethodPB* out) const { |
114 | 0 | if (has_service_name()) { |
115 | 0 | out->set_service_name(service_name_.cdata(), service_name_.size()); |
116 | 0 | } else { |
117 | 0 | out->clear_service_name(); |
118 | 0 | } |
119 | 0 | if (has_method_name()) { |
120 | 0 | out->set_method_name(method_name_.cdata(), method_name_.size()); |
121 | 0 | } else { |
122 | 0 | out->clear_method_name(); |
123 | 0 | } |
124 | 0 | } |
125 | | |
126 | | LWRequestHeader::LWRequestHeader(::yb::Arena* arena) |
127 | | : arena_(*arena), |
128 | 0 | remote_method_(arena) { |
129 | 0 | } |
130 | | |
131 | | LWRequestHeader::LWRequestHeader(::yb::Arena* arena, const LWRequestHeader& rhs) |
132 | | : arena_(*arena), |
133 | | has_fields_(rhs.has_fields_), |
134 | | call_id_(rhs.call_id_), |
135 | | remote_method_(arena, rhs.remote_method_), |
136 | 0 | timeout_millis_(rhs.timeout_millis_) { |
137 | 0 | } |
138 | | |
139 | 0 | void LWRequestHeader::AppendToDebugString(std::string* out) const { |
140 | 0 | bool first = true;if (has_call_id()) { |
141 | 0 | ::yb::rpc::AppendFieldTitle("call_id", ": ", &first, out); |
142 | 0 | *out += std::to_string(call_id()); |
143 | 0 | } |
144 | 0 | if (has_remote_method()) { |
145 | 0 | ::yb::rpc::AppendFieldTitle("remote_method", " { ", &first, out); |
146 | 0 | remote_method().AppendToDebugString(out); |
147 | 0 | *out += " }"; |
148 | 0 | } |
149 | 0 | if (has_timeout_millis()) { |
150 | 0 | ::yb::rpc::AppendFieldTitle("timeout_millis", ": ", &first, out); |
151 | 0 | *out += std::to_string(timeout_millis()); |
152 | 0 | } |
153 | 0 | } |
154 | | |
155 | 0 | void LWRequestHeader::Clear() { |
156 | 0 | clear_call_id(); |
157 | 0 | clear_remote_method(); |
158 | 0 | clear_timeout_millis(); |
159 | 0 | } |
160 | | |
161 | 0 | void LWRequestHeader::CopyFrom(const LWRequestHeader& rhs) { |
162 | 0 | if (rhs.has_call_id()) { |
163 | 0 | call_id_ = rhs.call_id_; |
164 | 0 | } else { |
165 | 0 | clear_call_id(); |
166 | 0 | } |
167 | 0 | if (rhs.has_remote_method()) { |
168 | 0 | remote_method_.CopyFrom(rhs.remote_method_); |
169 | 0 | } else { |
170 | 0 | clear_remote_method(); |
171 | 0 | } |
172 | 0 | if (rhs.has_timeout_millis()) { |
173 | 0 | timeout_millis_ = rhs.timeout_millis_; |
174 | 0 | } else { |
175 | 0 | clear_timeout_millis(); |
176 | 0 | } |
177 | 0 | has_fields_ = rhs.has_fields_; |
178 | 0 | } |
179 | | |
180 | 0 | void LWRequestHeader::CopyFrom(const RequestHeader& rhs) { |
181 | 0 | if (rhs.has_call_id()) { |
182 | 0 | call_id_ = rhs.call_id(); |
183 | 0 | has_fields_.Set(RequestHeaderFields::kCallId); |
184 | 0 | } else { |
185 | 0 | clear_call_id(); |
186 | 0 | } |
187 | 0 | if (rhs.has_remote_method()) { |
188 | 0 | remote_method_.CopyFrom(rhs.remote_method()); |
189 | 0 | has_fields_.Set(RequestHeaderFields::kRemoteMethod); |
190 | 0 | } else { |
191 | 0 | clear_remote_method(); |
192 | 0 | } |
193 | 0 | if (rhs.has_timeout_millis()) { |
194 | 0 | timeout_millis_ = rhs.timeout_millis(); |
195 | 0 | has_fields_.Set(RequestHeaderFields::kTimeoutMillis); |
196 | 0 | } else { |
197 | 0 | clear_timeout_millis(); |
198 | 0 | } |
199 | 0 | } |
200 | | |
201 | 0 | Status LWRequestHeader::ParseFromCodedStream(google::protobuf::io::CodedInputStream* input) { |
202 | 0 | for (;;) { |
203 | 0 | auto p = input->ReadTagWithCutoffNoLastTag(31); |
204 | 0 | if (!p.second && !p.first) { |
205 | 0 | return Status::OK(); |
206 | 0 | } |
207 | 0 | switch(::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(p.first)) { |
208 | 0 | case 1: { // call_id |
209 | 0 | if (!::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_INT32, int32_t>::Read(input, mutable_call_id())) { |
210 | 0 | return ::yb::rpc::ParseFailed("call_id"); |
211 | 0 | } |
212 | 0 | break; |
213 | 0 | } |
214 | 0 | case 2: { // remote_method |
215 | 0 | if (!::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE, ::yb::rpc::LWRemoteMethodPB>::Read(input, mutable_remote_method())) { |
216 | 0 | return ::yb::rpc::ParseFailed("remote_method"); |
217 | 0 | } |
218 | 0 | break; |
219 | 0 | } |
220 | 0 | case 3: { // timeout_millis |
221 | 0 | if (!::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_UINT32, uint32_t>::Read(input, mutable_timeout_millis())) { |
222 | 0 | return ::yb::rpc::ParseFailed("timeout_millis"); |
223 | 0 | } |
224 | 0 | break; |
225 | 0 | } |
226 | 0 | } |
227 | 0 | } |
228 | 0 | } |
229 | | |
230 | 0 | uint8_t* LWRequestHeader::SerializeToArray(uint8_t* out) const { |
231 | 0 | if (has_call_id()) { |
232 | 0 | out = ::yb::rpc::SingleWrite<::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_INT32, int32_t>, 8>(call_id_, out); |
233 | 0 | } |
234 | 0 | if (has_remote_method()) { |
235 | 0 | out = ::yb::rpc::SingleWrite<::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE, ::yb::rpc::LWRemoteMethodPB>, 18>(remote_method_, out); |
236 | 0 | } |
237 | 0 | if (has_timeout_millis()) { |
238 | 0 | out = ::yb::rpc::SingleWrite<::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_UINT32, uint32_t>, 24>(timeout_millis_, out); |
239 | 0 | } |
240 | 0 | return out; |
241 | 0 | } |
242 | | |
243 | 0 | size_t LWRequestHeader::SerializedSize() const { |
244 | 0 | size_t result = 0; |
245 | 0 | if (has_call_id()) { |
246 | 0 | result += ::yb::rpc::SingleSize<::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_INT32, int32_t>, 1>(call_id_); |
247 | 0 | } |
248 | 0 | if (has_remote_method()) { |
249 | 0 | result += ::yb::rpc::SingleSize<::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE, ::yb::rpc::LWRemoteMethodPB>, 1>(remote_method_); |
250 | 0 | } |
251 | 0 | if (has_timeout_millis()) { |
252 | 0 | result += ::yb::rpc::SingleSize<::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_UINT32, uint32_t>, 1>(timeout_millis_); |
253 | 0 | } |
254 | 0 | cached_size_ = result; |
255 | 0 | return result; |
256 | 0 | } |
257 | | |
258 | 0 | void LWRequestHeader::ToGoogleProtobuf(RequestHeader* out) const { |
259 | 0 | if (has_call_id()) { |
260 | 0 | out->set_call_id(call_id_); |
261 | 0 | } else { |
262 | 0 | out->clear_call_id(); |
263 | 0 | } |
264 | 0 | if (has_remote_method()) { |
265 | 0 | remote_method().ToGoogleProtobuf(out->mutable_remote_method()); |
266 | 0 | } |
267 | 0 | if (has_timeout_millis()) { |
268 | 0 | out->set_timeout_millis(timeout_millis_); |
269 | 0 | } else { |
270 | 0 | out->clear_timeout_millis(); |
271 | 0 | } |
272 | 0 | } |
273 | | |
274 | | LWResponseHeader::LWResponseHeader(::yb::Arena* arena) |
275 | 0 | : sidecar_offsets_(arena) { |
276 | 0 | } |
277 | | |
278 | | LWResponseHeader::LWResponseHeader(::yb::Arena* arena, const LWResponseHeader& rhs) |
279 | | : has_fields_(rhs.has_fields_), |
280 | | call_id_(rhs.call_id_), |
281 | | is_error_(rhs.is_error_), |
282 | 0 | sidecar_offsets_(rhs.sidecar_offsets_.begin(), rhs.sidecar_offsets_.end(), arena) { |
283 | 0 | } |
284 | | |
285 | 0 | void LWResponseHeader::AppendToDebugString(std::string* out) const { |
286 | 0 | bool first = true;if (has_call_id()) { |
287 | 0 | ::yb::rpc::AppendFieldTitle("call_id", ": ", &first, out); |
288 | 0 | *out += std::to_string(call_id()); |
289 | 0 | } |
290 | 0 | if (has_is_error()) { |
291 | 0 | ::yb::rpc::AppendFieldTitle("is_error", ": ", &first, out); |
292 | 0 | *out += std::to_string(is_error()); |
293 | 0 | } |
294 | 0 | for (const auto& entry : sidecar_offsets_) { |
295 | 0 | ::yb::rpc::AppendFieldTitle("sidecar_offsets", ": ", &first, out); |
296 | 0 | *out += std::to_string(entry); |
297 | 0 | } |
298 | 0 | } |
299 | | |
300 | 0 | void LWResponseHeader::Clear() { |
301 | 0 | clear_call_id(); |
302 | 0 | clear_is_error(); |
303 | 0 | sidecar_offsets_.clear(); |
304 | 0 | } |
305 | | |
306 | 0 | void LWResponseHeader::CopyFrom(const LWResponseHeader& rhs) { |
307 | 0 | if (rhs.has_call_id()) { |
308 | 0 | call_id_ = rhs.call_id_; |
309 | 0 | } else { |
310 | 0 | clear_call_id(); |
311 | 0 | } |
312 | 0 | if (rhs.has_is_error()) { |
313 | 0 | is_error_ = rhs.is_error_; |
314 | 0 | } else { |
315 | 0 | clear_is_error(); |
316 | 0 | } |
317 | 0 | sidecar_offsets_ = rhs.sidecar_offsets_; |
318 | 0 | has_fields_ = rhs.has_fields_; |
319 | 0 | } |
320 | | |
321 | 0 | void LWResponseHeader::CopyFrom(const ResponseHeader& rhs) { |
322 | 0 | if (rhs.has_call_id()) { |
323 | 0 | call_id_ = rhs.call_id(); |
324 | 0 | has_fields_.Set(ResponseHeaderFields::kCallId); |
325 | 0 | } else { |
326 | 0 | clear_call_id(); |
327 | 0 | } |
328 | 0 | if (rhs.has_is_error()) { |
329 | 0 | is_error_ = rhs.is_error(); |
330 | 0 | has_fields_.Set(ResponseHeaderFields::kIsError); |
331 | 0 | } else { |
332 | 0 | clear_is_error(); |
333 | 0 | } |
334 | 0 | sidecar_offsets_.assign(rhs.sidecar_offsets().begin(), rhs.sidecar_offsets().end()); |
335 | 0 | } |
336 | | |
337 | 0 | Status LWResponseHeader::ParseFromCodedStream(google::protobuf::io::CodedInputStream* input) { |
338 | 0 | for (;;) { |
339 | 0 | auto p = input->ReadTagWithCutoffNoLastTag(31); |
340 | 0 | if (!p.second && !p.first) { |
341 | 0 | return Status::OK(); |
342 | 0 | } |
343 | 0 | switch(::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(p.first)) { |
344 | 0 | case 1: { // call_id |
345 | 0 | if (!::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_INT32, int32_t>::Read(input, mutable_call_id())) { |
346 | 0 | return ::yb::rpc::ParseFailed("call_id"); |
347 | 0 | } |
348 | 0 | break; |
349 | 0 | } |
350 | 0 | case 2: { // is_error |
351 | 0 | if (!::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_BOOL, bool>::Read(input, mutable_is_error())) { |
352 | 0 | return ::yb::rpc::ParseFailed("is_error"); |
353 | 0 | } |
354 | 0 | break; |
355 | 0 | } |
356 | 0 | case 3: { // sidecar_offsets |
357 | 0 | if (p.first == 26) { |
358 | 0 | int length; |
359 | 0 | if (!input->ReadVarintSizeAsInt(&length)) { |
360 | 0 | return ::yb::rpc::ParseFailed("sidecar_offsets"); |
361 | 0 | } |
362 | 0 | auto old_limit = input->PushLimit(length); |
363 | 0 | while (input->BytesUntilLimit() > 0) { |
364 | 0 | sidecar_offsets_.emplace_back(); |
365 | 0 | if (!::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_UINT32, uint32_t>::Read(input, &sidecar_offsets_.back())) { |
366 | 0 | return ::yb::rpc::ParseFailed("sidecar_offsets"); |
367 | 0 | } |
368 | 0 | } |
369 | | |
370 | 0 | input->PopLimit(old_limit); |
371 | 0 | } else { |
372 | 0 | sidecar_offsets_.emplace_back(); |
373 | 0 | if (!::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_UINT32, uint32_t>::Read(input, &sidecar_offsets_.back())) { |
374 | 0 | return ::yb::rpc::ParseFailed("sidecar_offsets"); |
375 | 0 | } |
376 | 0 | } |
377 | 0 | break; |
378 | 0 | } |
379 | 0 | } |
380 | 0 | } |
381 | 0 | } |
382 | | |
383 | 0 | uint8_t* LWResponseHeader::SerializeToArray(uint8_t* out) const { |
384 | 0 | if (has_call_id()) { |
385 | 0 | out = ::yb::rpc::SingleWrite<::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_INT32, int32_t>, 8>(call_id_, out); |
386 | 0 | } |
387 | 0 | if (has_is_error()) { |
388 | 0 | out = ::yb::rpc::SingleWrite<::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_BOOL, bool>, 16>(is_error_, out); |
389 | 0 | } |
390 | 0 | out = ::yb::rpc::RepeatedWrite<::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_UINT32, uint32_t>, 24>(sidecar_offsets_, out); |
391 | 0 | return out; |
392 | 0 | } |
393 | | |
394 | 0 | size_t LWResponseHeader::SerializedSize() const { |
395 | 0 | size_t result = 0; |
396 | 0 | if (has_call_id()) { |
397 | 0 | result += ::yb::rpc::SingleSize<::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_INT32, int32_t>, 1>(call_id_); |
398 | 0 | } |
399 | 0 | if (has_is_error()) { |
400 | 0 | result += 2; |
401 | 0 | } |
402 | 0 | { |
403 | 0 | result += ::yb::rpc::RepeatedSize<::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_UINT32, uint32_t>, 1>(sidecar_offsets_); |
404 | 0 | } |
405 | 0 | cached_size_ = result; |
406 | 0 | return result; |
407 | 0 | } |
408 | | |
409 | 0 | void LWResponseHeader::ToGoogleProtobuf(ResponseHeader* out) const { |
410 | 0 | if (has_call_id()) { |
411 | 0 | out->set_call_id(call_id_); |
412 | 0 | } else { |
413 | 0 | out->clear_call_id(); |
414 | 0 | } |
415 | 0 | if (has_is_error()) { |
416 | 0 | out->set_is_error(is_error_); |
417 | 0 | } else { |
418 | 0 | out->clear_is_error(); |
419 | 0 | } |
420 | 0 | { |
421 | 0 | auto& repeated = *out->mutable_sidecar_offsets(); |
422 | 0 | repeated.Clear(); |
423 | 0 | repeated.Reserve(narrow_cast<int>(sidecar_offsets_.size())); |
424 | 0 | for (const auto& entry : sidecar_offsets_) { |
425 | 0 | repeated.Add(entry); |
426 | 0 | } |
427 | 0 | } |
428 | 0 | } |
429 | | |
430 | 0 | LWEmptyMessagePB::LWEmptyMessagePB(::yb::Arena* arena) { |
431 | 0 | } |
432 | | |
433 | 0 | LWEmptyMessagePB::LWEmptyMessagePB(::yb::Arena* arena, const LWEmptyMessagePB& rhs) { |
434 | 0 | } |
435 | | |
436 | 0 | void LWEmptyMessagePB::AppendToDebugString(std::string* out) const { |
437 | 0 | } |
438 | | |
439 | 0 | void LWEmptyMessagePB::Clear() { |
440 | 0 | } |
441 | | |
442 | 0 | void LWEmptyMessagePB::CopyFrom(const LWEmptyMessagePB& rhs) { |
443 | 0 | } |
444 | | |
445 | 0 | void LWEmptyMessagePB::CopyFrom(const EmptyMessagePB& rhs) { |
446 | 0 | } |
447 | | |
448 | 0 | Status LWEmptyMessagePB::ParseFromCodedStream(google::protobuf::io::CodedInputStream* input) { |
449 | 0 | for (;;) { |
450 | 0 | auto p = input->ReadTagWithCutoffNoLastTag(1); |
451 | 0 | if (!p.second && !p.first) { |
452 | 0 | return Status::OK(); |
453 | 0 | } |
454 | 0 | switch(::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(p.first)) { |
455 | 0 | } |
456 | 0 | } |
457 | 0 | } |
458 | | |
459 | 0 | uint8_t* LWEmptyMessagePB::SerializeToArray(uint8_t* out) const { |
460 | 0 | return out; |
461 | 0 | } |
462 | | |
463 | 0 | size_t LWEmptyMessagePB::SerializedSize() const { |
464 | 0 | size_t result = 0; |
465 | 0 | cached_size_ = result; |
466 | 0 | return result; |
467 | 0 | } |
468 | | |
469 | 0 | void LWEmptyMessagePB::ToGoogleProtobuf(EmptyMessagePB* out) const { |
470 | 0 | } |
471 | | |
472 | | LWErrorStatusPB::LWErrorStatusPB(::yb::Arena* arena) |
473 | 0 | : arena_(*arena) { |
474 | 0 | } |
475 | | |
476 | | LWErrorStatusPB::LWErrorStatusPB(::yb::Arena* arena, const LWErrorStatusPB& rhs) |
477 | | : arena_(*arena), |
478 | | has_fields_(rhs.has_fields_), |
479 | | message_(arena->DupSlice(rhs.message_)), |
480 | 0 | code_(rhs.code_) { |
481 | 0 | } |
482 | | |
483 | 0 | void LWErrorStatusPB::AppendToDebugString(std::string* out) const { |
484 | 0 | bool first = true;if (has_message()) { |
485 | 0 | ::yb::rpc::AppendFieldTitle("message", ": \"", &first, out); |
486 | 0 | *out += message().ToBuffer(); |
487 | 0 | *out += '"'; |
488 | 0 | } |
489 | 0 | if (has_code()) { |
490 | 0 | ::yb::rpc::AppendFieldTitle("code", ": ", &first, out); |
491 | 0 | *out += ::yb::rpc::ErrorStatusPB::RpcErrorCodePB_Name(code()); |
492 | 0 | } |
493 | 0 | } |
494 | | |
495 | 0 | void LWErrorStatusPB::Clear() { |
496 | 0 | clear_message(); |
497 | 0 | clear_code(); |
498 | 0 | } |
499 | | |
500 | 0 | void LWErrorStatusPB::CopyFrom(const LWErrorStatusPB& rhs) { |
501 | 0 | if (rhs.has_message()) { |
502 | 0 | message_ = arena_.DupSlice(rhs.message_); |
503 | 0 | } else { |
504 | 0 | clear_message(); |
505 | 0 | } |
506 | 0 | if (rhs.has_code()) { |
507 | 0 | code_ = rhs.code_; |
508 | 0 | } else { |
509 | 0 | clear_code(); |
510 | 0 | } |
511 | 0 | has_fields_ = rhs.has_fields_; |
512 | 0 | } |
513 | | |
514 | 0 | void LWErrorStatusPB::CopyFrom(const ErrorStatusPB& rhs) { |
515 | 0 | if (rhs.has_message()) { |
516 | 0 | message_ = arena_.DupSlice(rhs.message()); |
517 | 0 | has_fields_.Set(ErrorStatusPBFields::kMessage); |
518 | 0 | } else { |
519 | 0 | clear_message(); |
520 | 0 | } |
521 | 0 | if (rhs.has_code()) { |
522 | 0 | code_ = rhs.code(); |
523 | 0 | has_fields_.Set(ErrorStatusPBFields::kCode); |
524 | 0 | } else { |
525 | 0 | clear_code(); |
526 | 0 | } |
527 | 0 | } |
528 | | |
529 | 0 | Status LWErrorStatusPB::ParseFromCodedStream(google::protobuf::io::CodedInputStream* input) { |
530 | 0 | for (;;) { |
531 | 0 | auto p = input->ReadTagWithCutoffNoLastTag(31); |
532 | 0 | if (!p.second && !p.first) { |
533 | 0 | return Status::OK(); |
534 | 0 | } |
535 | 0 | switch(::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(p.first)) { |
536 | 0 | case 1: { // message |
537 | 0 | if (!::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_STRING, ::yb::Slice>::Read(input, mutable_message())) { |
538 | 0 | return ::yb::rpc::ParseFailed("message"); |
539 | 0 | } |
540 | 0 | break; |
541 | 0 | } |
542 | 0 | case 2: { // code |
543 | 0 | if (!::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_ENUM, ::yb::rpc::LWErrorStatusPB::RpcErrorCodePB>::Read(input, mutable_code())) { |
544 | 0 | return ::yb::rpc::ParseFailed("code"); |
545 | 0 | } |
546 | 0 | break; |
547 | 0 | } |
548 | 0 | } |
549 | 0 | } |
550 | 0 | } |
551 | | |
552 | 0 | uint8_t* LWErrorStatusPB::SerializeToArray(uint8_t* out) const { |
553 | 0 | if (has_message()) { |
554 | 0 | out = ::yb::rpc::SingleWrite<::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_STRING, ::yb::Slice>, 10>(message_, out); |
555 | 0 | } |
556 | 0 | if (has_code()) { |
557 | 0 | out = ::yb::rpc::SingleWrite<::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_ENUM, ::yb::rpc::LWErrorStatusPB::RpcErrorCodePB>, 16>(code_, out); |
558 | 0 | } |
559 | 0 | return out; |
560 | 0 | } |
561 | | |
562 | 0 | size_t LWErrorStatusPB::SerializedSize() const { |
563 | 0 | size_t result = 0; |
564 | 0 | if (has_message()) { |
565 | 0 | result += ::yb::rpc::SingleSize<::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_STRING, ::yb::Slice>, 1>(message_); |
566 | 0 | } |
567 | 0 | if (has_code()) { |
568 | 0 | result += ::yb::rpc::SingleSize<::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_ENUM, ::yb::rpc::LWErrorStatusPB::RpcErrorCodePB>, 1>(code_); |
569 | 0 | } |
570 | 0 | cached_size_ = result; |
571 | 0 | return result; |
572 | 0 | } |
573 | | |
574 | 0 | void LWErrorStatusPB::ToGoogleProtobuf(ErrorStatusPB* out) const { |
575 | 0 | if (has_message()) { |
576 | 0 | out->set_message(message_.cdata(), message_.size()); |
577 | 0 | } else { |
578 | 0 | out->clear_message(); |
579 | 0 | } |
580 | 0 | if (has_code()) { |
581 | 0 | out->set_code(code_); |
582 | 0 | } else { |
583 | 0 | out->clear_code(); |
584 | 0 | } |
585 | 0 | } |
586 | | |
587 | | } // namespace rpc |
588 | | } // namespace yb |