/src/brpc/build/brpc/policy/mongo.pb.cc
Line | Count | Source |
1 | | // Generated by the protocol buffer compiler. DO NOT EDIT! |
2 | | // source: brpc/policy/mongo.proto |
3 | | |
4 | | #include "brpc/policy/mongo.pb.h" |
5 | | |
6 | | #include <algorithm> |
7 | | |
8 | | #include <google/protobuf/io/coded_stream.h> |
9 | | #include <google/protobuf/extension_set.h> |
10 | | #include <google/protobuf/wire_format_lite.h> |
11 | | #include <google/protobuf/descriptor.h> |
12 | | #include <google/protobuf/generated_message_reflection.h> |
13 | | #include <google/protobuf/reflection_ops.h> |
14 | | #include <google/protobuf/wire_format.h> |
15 | | // @@protoc_insertion_point(includes) |
16 | | #include <google/protobuf/port_def.inc> |
17 | | |
18 | | PROTOBUF_PRAGMA_INIT_SEG |
19 | | |
20 | | namespace _pb = ::PROTOBUF_NAMESPACE_ID; |
21 | | namespace _pbi = _pb::internal; |
22 | | |
23 | | namespace brpc { |
24 | | namespace policy { |
25 | | PROTOBUF_CONSTEXPR MongoHeader::MongoHeader( |
26 | | ::_pbi::ConstantInitialized): _impl_{ |
27 | | /*decltype(_impl_._has_bits_)*/{} |
28 | | , /*decltype(_impl_._cached_size_)*/{} |
29 | | , /*decltype(_impl_.message_length_)*/0 |
30 | | , /*decltype(_impl_.request_id_)*/0 |
31 | | , /*decltype(_impl_.response_to_)*/0 |
32 | | , /*decltype(_impl_.op_code_)*/1} {} |
33 | | struct MongoHeaderDefaultTypeInternal { |
34 | | PROTOBUF_CONSTEXPR MongoHeaderDefaultTypeInternal() |
35 | 0 | : _instance(::_pbi::ConstantInitialized{}) {} |
36 | 0 | ~MongoHeaderDefaultTypeInternal() {} |
37 | | union { |
38 | | MongoHeader _instance; |
39 | | }; |
40 | | }; |
41 | | PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 MongoHeaderDefaultTypeInternal _MongoHeader_default_instance_; |
42 | | PROTOBUF_CONSTEXPR MongoRequest::MongoRequest( |
43 | | ::_pbi::ConstantInitialized): _impl_{ |
44 | | /*decltype(_impl_._has_bits_)*/{} |
45 | | , /*decltype(_impl_._cached_size_)*/{} |
46 | | , /*decltype(_impl_.message_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} |
47 | | , /*decltype(_impl_.header_)*/nullptr} {} |
48 | | struct MongoRequestDefaultTypeInternal { |
49 | | PROTOBUF_CONSTEXPR MongoRequestDefaultTypeInternal() |
50 | 0 | : _instance(::_pbi::ConstantInitialized{}) {} |
51 | 0 | ~MongoRequestDefaultTypeInternal() {} |
52 | | union { |
53 | | MongoRequest _instance; |
54 | | }; |
55 | | }; |
56 | | PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 MongoRequestDefaultTypeInternal _MongoRequest_default_instance_; |
57 | | PROTOBUF_CONSTEXPR MongoResponse::MongoResponse( |
58 | | ::_pbi::ConstantInitialized): _impl_{ |
59 | | /*decltype(_impl_._has_bits_)*/{} |
60 | | , /*decltype(_impl_._cached_size_)*/{} |
61 | | , /*decltype(_impl_.message_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} |
62 | | , /*decltype(_impl_.header_)*/nullptr |
63 | | , /*decltype(_impl_.cursor_id_)*/int64_t{0} |
64 | | , /*decltype(_impl_.response_flags_)*/0 |
65 | | , /*decltype(_impl_.starting_from_)*/0 |
66 | | , /*decltype(_impl_.number_returned_)*/0} {} |
67 | | struct MongoResponseDefaultTypeInternal { |
68 | | PROTOBUF_CONSTEXPR MongoResponseDefaultTypeInternal() |
69 | 0 | : _instance(::_pbi::ConstantInitialized{}) {} |
70 | 0 | ~MongoResponseDefaultTypeInternal() {} |
71 | | union { |
72 | | MongoResponse _instance; |
73 | | }; |
74 | | }; |
75 | | PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 MongoResponseDefaultTypeInternal _MongoResponse_default_instance_; |
76 | | } // namespace policy |
77 | | } // namespace brpc |
78 | | static ::_pb::Metadata file_level_metadata_brpc_2fpolicy_2fmongo_2eproto[3]; |
79 | | static const ::_pb::EnumDescriptor* file_level_enum_descriptors_brpc_2fpolicy_2fmongo_2eproto[1]; |
80 | | static const ::_pb::ServiceDescriptor* file_level_service_descriptors_brpc_2fpolicy_2fmongo_2eproto[1]; |
81 | | |
82 | | const uint32_t TableStruct_brpc_2fpolicy_2fmongo_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { |
83 | | PROTOBUF_FIELD_OFFSET(::brpc::policy::MongoHeader, _impl_._has_bits_), |
84 | | PROTOBUF_FIELD_OFFSET(::brpc::policy::MongoHeader, _internal_metadata_), |
85 | | ~0u, // no _extensions_ |
86 | | ~0u, // no _oneof_case_ |
87 | | ~0u, // no _weak_field_map_ |
88 | | ~0u, // no _inlined_string_donated_ |
89 | | PROTOBUF_FIELD_OFFSET(::brpc::policy::MongoHeader, _impl_.message_length_), |
90 | | PROTOBUF_FIELD_OFFSET(::brpc::policy::MongoHeader, _impl_.request_id_), |
91 | | PROTOBUF_FIELD_OFFSET(::brpc::policy::MongoHeader, _impl_.response_to_), |
92 | | PROTOBUF_FIELD_OFFSET(::brpc::policy::MongoHeader, _impl_.op_code_), |
93 | | 0, |
94 | | 1, |
95 | | 2, |
96 | | 3, |
97 | | PROTOBUF_FIELD_OFFSET(::brpc::policy::MongoRequest, _impl_._has_bits_), |
98 | | PROTOBUF_FIELD_OFFSET(::brpc::policy::MongoRequest, _internal_metadata_), |
99 | | ~0u, // no _extensions_ |
100 | | ~0u, // no _oneof_case_ |
101 | | ~0u, // no _weak_field_map_ |
102 | | ~0u, // no _inlined_string_donated_ |
103 | | PROTOBUF_FIELD_OFFSET(::brpc::policy::MongoRequest, _impl_.header_), |
104 | | PROTOBUF_FIELD_OFFSET(::brpc::policy::MongoRequest, _impl_.message_), |
105 | | 1, |
106 | | 0, |
107 | | PROTOBUF_FIELD_OFFSET(::brpc::policy::MongoResponse, _impl_._has_bits_), |
108 | | PROTOBUF_FIELD_OFFSET(::brpc::policy::MongoResponse, _internal_metadata_), |
109 | | ~0u, // no _extensions_ |
110 | | ~0u, // no _oneof_case_ |
111 | | ~0u, // no _weak_field_map_ |
112 | | ~0u, // no _inlined_string_donated_ |
113 | | PROTOBUF_FIELD_OFFSET(::brpc::policy::MongoResponse, _impl_.header_), |
114 | | PROTOBUF_FIELD_OFFSET(::brpc::policy::MongoResponse, _impl_.response_flags_), |
115 | | PROTOBUF_FIELD_OFFSET(::brpc::policy::MongoResponse, _impl_.cursor_id_), |
116 | | PROTOBUF_FIELD_OFFSET(::brpc::policy::MongoResponse, _impl_.starting_from_), |
117 | | PROTOBUF_FIELD_OFFSET(::brpc::policy::MongoResponse, _impl_.number_returned_), |
118 | | PROTOBUF_FIELD_OFFSET(::brpc::policy::MongoResponse, _impl_.message_), |
119 | | 1, |
120 | | 3, |
121 | | 2, |
122 | | 4, |
123 | | 5, |
124 | | 0, |
125 | | }; |
126 | | static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { |
127 | | { 0, 10, -1, sizeof(::brpc::policy::MongoHeader)}, |
128 | | { 14, 22, -1, sizeof(::brpc::policy::MongoRequest)}, |
129 | | { 24, 36, -1, sizeof(::brpc::policy::MongoResponse)}, |
130 | | }; |
131 | | |
132 | | static const ::_pb::Message* const file_default_instances[] = { |
133 | | &::brpc::policy::_MongoHeader_default_instance_._instance, |
134 | | &::brpc::policy::_MongoRequest_default_instance_._instance, |
135 | | &::brpc::policy::_MongoResponse_default_instance_._instance, |
136 | | }; |
137 | | |
138 | | const char descriptor_table_protodef_brpc_2fpolicy_2fmongo_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = |
139 | | "\n\027brpc/policy/mongo.proto\022\013brpc.policy\"u" |
140 | | "\n\013MongoHeader\022\026\n\016message_length\030\001 \002(\005\022\022\n" |
141 | | "\nrequest_id\030\002 \002(\005\022\023\n\013response_to\030\003 \002(\005\022%" |
142 | | "\n\007op_code\030\004 \002(\0162\024.brpc.policy.MongoOp\"I\n" |
143 | | "\014MongoRequest\022(\n\006header\030\001 \002(\0132\030.brpc.pol" |
144 | | "icy.MongoHeader\022\017\n\007message\030\002 \002(\t\"\245\001\n\rMon" |
145 | | "goResponse\022(\n\006header\030\001 \002(\0132\030.brpc.policy" |
146 | | ".MongoHeader\022\026\n\016response_flags\030\002 \002(\005\022\021\n\t" |
147 | | "cursor_id\030\003 \002(\003\022\025\n\rstarting_from\030\004 \002(\005\022\027" |
148 | | "\n\017number_returned\030\005 \002(\005\022\017\n\007message\030\006 \002(\t" |
149 | | "*\256\001\n\007MongoOp\022\013\n\007OPREPLY\020\001\022\n\n\005DBMSG\020\350\007\022\016\n" |
150 | | "\tDB_UPDATE\020\321\017\022\016\n\tDB_INSERT\020\322\017\022\r\n\010DB_QUER" |
151 | | "Y\020\324\017\022\017\n\nDB_GETMORE\020\325\017\022\016\n\tDB_DELETE\020\326\017\022\023\n" |
152 | | "\016DB_KILLCURSORS\020\327\017\022\017\n\nDB_COMMAND\020\330\017\022\024\n\017D" |
153 | | "B_COMMANDREPLY\020\331\0172W\n\014MongoService\022G\n\016def" |
154 | | "ault_method\022\031.brpc.policy.MongoRequest\032\032" |
155 | | ".brpc.policy.MongoResponseB#\n\017com.brpc.p" |
156 | | "olicyB\nMongoProto\200\001\001\210\001\001" |
157 | | ; |
158 | | static ::_pbi::once_flag descriptor_table_brpc_2fpolicy_2fmongo_2eproto_once; |
159 | | const ::_pbi::DescriptorTable descriptor_table_brpc_2fpolicy_2fmongo_2eproto = { |
160 | | false, false, 703, descriptor_table_protodef_brpc_2fpolicy_2fmongo_2eproto, |
161 | | "brpc/policy/mongo.proto", |
162 | | &descriptor_table_brpc_2fpolicy_2fmongo_2eproto_once, nullptr, 0, 3, |
163 | | schemas, file_default_instances, TableStruct_brpc_2fpolicy_2fmongo_2eproto::offsets, |
164 | | file_level_metadata_brpc_2fpolicy_2fmongo_2eproto, file_level_enum_descriptors_brpc_2fpolicy_2fmongo_2eproto, |
165 | | file_level_service_descriptors_brpc_2fpolicy_2fmongo_2eproto, |
166 | | }; |
167 | 0 | PROTOBUF_ATTRIBUTE_WEAK const ::_pbi::DescriptorTable* descriptor_table_brpc_2fpolicy_2fmongo_2eproto_getter() { |
168 | 0 | return &descriptor_table_brpc_2fpolicy_2fmongo_2eproto; |
169 | 0 | } |
170 | | |
171 | | // Force running AddDescriptors() at dynamic initialization time. |
172 | | PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_brpc_2fpolicy_2fmongo_2eproto(&descriptor_table_brpc_2fpolicy_2fmongo_2eproto); |
173 | | namespace brpc { |
174 | | namespace policy { |
175 | 0 | const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* MongoOp_descriptor() { |
176 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_brpc_2fpolicy_2fmongo_2eproto); |
177 | 0 | return file_level_enum_descriptors_brpc_2fpolicy_2fmongo_2eproto[0]; |
178 | 0 | } |
179 | 0 | bool MongoOp_IsValid(int value) { |
180 | 0 | switch (value) { |
181 | 0 | case 1: |
182 | 0 | case 1000: |
183 | 0 | case 2001: |
184 | 0 | case 2002: |
185 | 0 | case 2004: |
186 | 0 | case 2005: |
187 | 0 | case 2006: |
188 | 0 | case 2007: |
189 | 0 | case 2008: |
190 | 0 | case 2009: |
191 | 0 | return true; |
192 | 0 | default: |
193 | 0 | return false; |
194 | 0 | } |
195 | 0 | } |
196 | | |
197 | | |
198 | | // =================================================================== |
199 | | |
200 | | class MongoHeader::_Internal { |
201 | | public: |
202 | | using HasBits = decltype(std::declval<MongoHeader>()._impl_._has_bits_); |
203 | 0 | static void set_has_message_length(HasBits* has_bits) { |
204 | 0 | (*has_bits)[0] |= 1u; |
205 | 0 | } |
206 | 0 | static void set_has_request_id(HasBits* has_bits) { |
207 | 0 | (*has_bits)[0] |= 2u; |
208 | 0 | } |
209 | 0 | static void set_has_response_to(HasBits* has_bits) { |
210 | 0 | (*has_bits)[0] |= 4u; |
211 | 0 | } |
212 | 0 | static void set_has_op_code(HasBits* has_bits) { |
213 | 0 | (*has_bits)[0] |= 8u; |
214 | 0 | } |
215 | 0 | static bool MissingRequiredFields(const HasBits& has_bits) { |
216 | 0 | return ((has_bits[0] & 0x0000000f) ^ 0x0000000f) != 0; |
217 | 0 | } |
218 | | }; |
219 | | |
220 | | MongoHeader::MongoHeader(::PROTOBUF_NAMESPACE_ID::Arena* arena, |
221 | | bool is_message_owned) |
222 | 0 | : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { |
223 | 0 | SharedCtor(arena, is_message_owned); |
224 | | // @@protoc_insertion_point(arena_constructor:brpc.policy.MongoHeader) |
225 | 0 | } |
226 | | MongoHeader::MongoHeader(const MongoHeader& from) |
227 | 0 | : ::PROTOBUF_NAMESPACE_ID::Message() { |
228 | 0 | MongoHeader* const _this = this; (void)_this; |
229 | 0 | new (&_impl_) Impl_{ |
230 | 0 | decltype(_impl_._has_bits_){from._impl_._has_bits_} |
231 | 0 | , /*decltype(_impl_._cached_size_)*/{} |
232 | 0 | , decltype(_impl_.message_length_){} |
233 | 0 | , decltype(_impl_.request_id_){} |
234 | 0 | , decltype(_impl_.response_to_){} |
235 | 0 | , decltype(_impl_.op_code_){}}; |
236 | |
|
237 | 0 | _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); |
238 | 0 | ::memcpy(&_impl_.message_length_, &from._impl_.message_length_, |
239 | 0 | static_cast<size_t>(reinterpret_cast<char*>(&_impl_.op_code_) - |
240 | 0 | reinterpret_cast<char*>(&_impl_.message_length_)) + sizeof(_impl_.op_code_)); |
241 | | // @@protoc_insertion_point(copy_constructor:brpc.policy.MongoHeader) |
242 | 0 | } |
243 | | |
244 | | inline void MongoHeader::SharedCtor( |
245 | 0 | ::_pb::Arena* arena, bool is_message_owned) { |
246 | 0 | (void)arena; |
247 | 0 | (void)is_message_owned; |
248 | 0 | new (&_impl_) Impl_{ |
249 | 0 | decltype(_impl_._has_bits_){} |
250 | 0 | , /*decltype(_impl_._cached_size_)*/{} |
251 | 0 | , decltype(_impl_.message_length_){0} |
252 | 0 | , decltype(_impl_.request_id_){0} |
253 | 0 | , decltype(_impl_.response_to_){0} |
254 | 0 | , decltype(_impl_.op_code_){1} |
255 | 0 | }; |
256 | 0 | } |
257 | | |
258 | 0 | MongoHeader::~MongoHeader() { |
259 | | // @@protoc_insertion_point(destructor:brpc.policy.MongoHeader) |
260 | 0 | if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { |
261 | 0 | (void)arena; |
262 | 0 | return; |
263 | 0 | } |
264 | 0 | SharedDtor(); |
265 | 0 | } |
266 | | |
267 | 0 | inline void MongoHeader::SharedDtor() { |
268 | 0 | GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); |
269 | 0 | } |
270 | | |
271 | 0 | void MongoHeader::SetCachedSize(int size) const { |
272 | 0 | _impl_._cached_size_.Set(size); |
273 | 0 | } |
274 | | |
275 | 0 | void MongoHeader::Clear() { |
276 | | // @@protoc_insertion_point(message_clear_start:brpc.policy.MongoHeader) |
277 | 0 | uint32_t cached_has_bits = 0; |
278 | | // Prevent compiler warnings about cached_has_bits being unused |
279 | 0 | (void) cached_has_bits; |
280 | |
|
281 | 0 | cached_has_bits = _impl_._has_bits_[0]; |
282 | 0 | if (cached_has_bits & 0x0000000fu) { |
283 | 0 | ::memset(&_impl_.message_length_, 0, static_cast<size_t>( |
284 | 0 | reinterpret_cast<char*>(&_impl_.response_to_) - |
285 | 0 | reinterpret_cast<char*>(&_impl_.message_length_)) + sizeof(_impl_.response_to_)); |
286 | 0 | _impl_.op_code_ = 1; |
287 | 0 | } |
288 | 0 | _impl_._has_bits_.Clear(); |
289 | 0 | _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); |
290 | 0 | } |
291 | | |
292 | 0 | const char* MongoHeader::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { |
293 | 0 | #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure |
294 | 0 | _Internal::HasBits has_bits{}; |
295 | 0 | while (!ctx->Done(&ptr)) { |
296 | 0 | uint32_t tag; |
297 | 0 | ptr = ::_pbi::ReadTag(ptr, &tag); |
298 | 0 | switch (tag >> 3) { |
299 | | // required int32 message_length = 1; |
300 | 0 | case 1: |
301 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) { |
302 | 0 | _Internal::set_has_message_length(&has_bits); |
303 | 0 | _impl_.message_length_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); |
304 | 0 | CHK_(ptr); |
305 | 0 | } else |
306 | 0 | goto handle_unusual; |
307 | 0 | continue; |
308 | | // required int32 request_id = 2; |
309 | 0 | case 2: |
310 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) { |
311 | 0 | _Internal::set_has_request_id(&has_bits); |
312 | 0 | _impl_.request_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); |
313 | 0 | CHK_(ptr); |
314 | 0 | } else |
315 | 0 | goto handle_unusual; |
316 | 0 | continue; |
317 | | // required int32 response_to = 3; |
318 | 0 | case 3: |
319 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) { |
320 | 0 | _Internal::set_has_response_to(&has_bits); |
321 | 0 | _impl_.response_to_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); |
322 | 0 | CHK_(ptr); |
323 | 0 | } else |
324 | 0 | goto handle_unusual; |
325 | 0 | continue; |
326 | | // required .brpc.policy.MongoOp op_code = 4; |
327 | 0 | case 4: |
328 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 32)) { |
329 | 0 | uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); |
330 | 0 | CHK_(ptr); |
331 | 0 | if (PROTOBUF_PREDICT_TRUE(::brpc::policy::MongoOp_IsValid(val))) { |
332 | 0 | _internal_set_op_code(static_cast<::brpc::policy::MongoOp>(val)); |
333 | 0 | } else { |
334 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(4, val, mutable_unknown_fields()); |
335 | 0 | } |
336 | 0 | } else |
337 | 0 | goto handle_unusual; |
338 | 0 | continue; |
339 | 0 | default: |
340 | 0 | goto handle_unusual; |
341 | 0 | } // switch |
342 | 0 | handle_unusual: |
343 | 0 | if ((tag == 0) || ((tag & 7) == 4)) { |
344 | 0 | CHK_(ptr); |
345 | 0 | ctx->SetLastTag(tag); |
346 | 0 | goto message_done; |
347 | 0 | } |
348 | 0 | ptr = UnknownFieldParse( |
349 | 0 | tag, |
350 | 0 | _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), |
351 | 0 | ptr, ctx); |
352 | 0 | CHK_(ptr != nullptr); |
353 | 0 | } // while |
354 | 0 | message_done: |
355 | 0 | _impl_._has_bits_.Or(has_bits); |
356 | 0 | return ptr; |
357 | 0 | failure: |
358 | 0 | ptr = nullptr; |
359 | 0 | goto message_done; |
360 | 0 | #undef CHK_ |
361 | 0 | } |
362 | | |
363 | | uint8_t* MongoHeader::_InternalSerialize( |
364 | 0 | uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { |
365 | | // @@protoc_insertion_point(serialize_to_array_start:brpc.policy.MongoHeader) |
366 | 0 | uint32_t cached_has_bits = 0; |
367 | 0 | (void) cached_has_bits; |
368 | |
|
369 | 0 | cached_has_bits = _impl_._has_bits_[0]; |
370 | | // required int32 message_length = 1; |
371 | 0 | if (cached_has_bits & 0x00000001u) { |
372 | 0 | target = stream->EnsureSpace(target); |
373 | 0 | target = ::_pbi::WireFormatLite::WriteInt32ToArray(1, this->_internal_message_length(), target); |
374 | 0 | } |
375 | | |
376 | | // required int32 request_id = 2; |
377 | 0 | if (cached_has_bits & 0x00000002u) { |
378 | 0 | target = stream->EnsureSpace(target); |
379 | 0 | target = ::_pbi::WireFormatLite::WriteInt32ToArray(2, this->_internal_request_id(), target); |
380 | 0 | } |
381 | | |
382 | | // required int32 response_to = 3; |
383 | 0 | if (cached_has_bits & 0x00000004u) { |
384 | 0 | target = stream->EnsureSpace(target); |
385 | 0 | target = ::_pbi::WireFormatLite::WriteInt32ToArray(3, this->_internal_response_to(), target); |
386 | 0 | } |
387 | | |
388 | | // required .brpc.policy.MongoOp op_code = 4; |
389 | 0 | if (cached_has_bits & 0x00000008u) { |
390 | 0 | target = stream->EnsureSpace(target); |
391 | 0 | target = ::_pbi::WireFormatLite::WriteEnumToArray( |
392 | 0 | 4, this->_internal_op_code(), target); |
393 | 0 | } |
394 | |
|
395 | 0 | if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { |
396 | 0 | target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( |
397 | 0 | _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); |
398 | 0 | } |
399 | | // @@protoc_insertion_point(serialize_to_array_end:brpc.policy.MongoHeader) |
400 | 0 | return target; |
401 | 0 | } |
402 | | |
403 | 0 | size_t MongoHeader::RequiredFieldsByteSizeFallback() const { |
404 | | // @@protoc_insertion_point(required_fields_byte_size_fallback_start:brpc.policy.MongoHeader) |
405 | 0 | size_t total_size = 0; |
406 | |
|
407 | 0 | if (_internal_has_message_length()) { |
408 | | // required int32 message_length = 1; |
409 | 0 | total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_message_length()); |
410 | 0 | } |
411 | |
|
412 | 0 | if (_internal_has_request_id()) { |
413 | | // required int32 request_id = 2; |
414 | 0 | total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_request_id()); |
415 | 0 | } |
416 | |
|
417 | 0 | if (_internal_has_response_to()) { |
418 | | // required int32 response_to = 3; |
419 | 0 | total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_response_to()); |
420 | 0 | } |
421 | |
|
422 | 0 | if (_internal_has_op_code()) { |
423 | | // required .brpc.policy.MongoOp op_code = 4; |
424 | 0 | total_size += 1 + |
425 | 0 | ::_pbi::WireFormatLite::EnumSize(this->_internal_op_code()); |
426 | 0 | } |
427 | |
|
428 | 0 | return total_size; |
429 | 0 | } |
430 | 0 | size_t MongoHeader::ByteSizeLong() const { |
431 | | // @@protoc_insertion_point(message_byte_size_start:brpc.policy.MongoHeader) |
432 | 0 | size_t total_size = 0; |
433 | |
|
434 | 0 | if (((_impl_._has_bits_[0] & 0x0000000f) ^ 0x0000000f) == 0) { // All required fields are present. |
435 | | // required int32 message_length = 1; |
436 | 0 | total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_message_length()); |
437 | | |
438 | | // required int32 request_id = 2; |
439 | 0 | total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_request_id()); |
440 | | |
441 | | // required int32 response_to = 3; |
442 | 0 | total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_response_to()); |
443 | | |
444 | | // required .brpc.policy.MongoOp op_code = 4; |
445 | 0 | total_size += 1 + |
446 | 0 | ::_pbi::WireFormatLite::EnumSize(this->_internal_op_code()); |
447 | |
|
448 | 0 | } else { |
449 | 0 | total_size += RequiredFieldsByteSizeFallback(); |
450 | 0 | } |
451 | 0 | uint32_t cached_has_bits = 0; |
452 | | // Prevent compiler warnings about cached_has_bits being unused |
453 | 0 | (void) cached_has_bits; |
454 | |
|
455 | 0 | return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); |
456 | 0 | } |
457 | | |
458 | | const ::PROTOBUF_NAMESPACE_ID::Message::ClassData MongoHeader::_class_data_ = { |
459 | | ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, |
460 | | MongoHeader::MergeImpl |
461 | | }; |
462 | 0 | const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*MongoHeader::GetClassData() const { return &_class_data_; } |
463 | | |
464 | | |
465 | 0 | void MongoHeader::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { |
466 | 0 | auto* const _this = static_cast<MongoHeader*>(&to_msg); |
467 | 0 | auto& from = static_cast<const MongoHeader&>(from_msg); |
468 | | // @@protoc_insertion_point(class_specific_merge_from_start:brpc.policy.MongoHeader) |
469 | 0 | GOOGLE_DCHECK_NE(&from, _this); |
470 | 0 | uint32_t cached_has_bits = 0; |
471 | 0 | (void) cached_has_bits; |
472 | |
|
473 | 0 | cached_has_bits = from._impl_._has_bits_[0]; |
474 | 0 | if (cached_has_bits & 0x0000000fu) { |
475 | 0 | if (cached_has_bits & 0x00000001u) { |
476 | 0 | _this->_impl_.message_length_ = from._impl_.message_length_; |
477 | 0 | } |
478 | 0 | if (cached_has_bits & 0x00000002u) { |
479 | 0 | _this->_impl_.request_id_ = from._impl_.request_id_; |
480 | 0 | } |
481 | 0 | if (cached_has_bits & 0x00000004u) { |
482 | 0 | _this->_impl_.response_to_ = from._impl_.response_to_; |
483 | 0 | } |
484 | 0 | if (cached_has_bits & 0x00000008u) { |
485 | 0 | _this->_impl_.op_code_ = from._impl_.op_code_; |
486 | 0 | } |
487 | 0 | _this->_impl_._has_bits_[0] |= cached_has_bits; |
488 | 0 | } |
489 | 0 | _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); |
490 | 0 | } |
491 | | |
492 | 0 | void MongoHeader::CopyFrom(const MongoHeader& from) { |
493 | | // @@protoc_insertion_point(class_specific_copy_from_start:brpc.policy.MongoHeader) |
494 | 0 | if (&from == this) return; |
495 | 0 | Clear(); |
496 | 0 | MergeFrom(from); |
497 | 0 | } |
498 | | |
499 | 0 | bool MongoHeader::IsInitialized() const { |
500 | 0 | if (_Internal::MissingRequiredFields(_impl_._has_bits_)) return false; |
501 | 0 | return true; |
502 | 0 | } |
503 | | |
504 | 0 | void MongoHeader::InternalSwap(MongoHeader* other) { |
505 | 0 | using std::swap; |
506 | 0 | _internal_metadata_.InternalSwap(&other->_internal_metadata_); |
507 | 0 | swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); |
508 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::memswap< |
509 | 0 | PROTOBUF_FIELD_OFFSET(MongoHeader, _impl_.response_to_) |
510 | 0 | + sizeof(MongoHeader::_impl_.response_to_) |
511 | 0 | - PROTOBUF_FIELD_OFFSET(MongoHeader, _impl_.message_length_)>( |
512 | 0 | reinterpret_cast<char*>(&_impl_.message_length_), |
513 | 0 | reinterpret_cast<char*>(&other->_impl_.message_length_)); |
514 | 0 | swap(_impl_.op_code_, other->_impl_.op_code_); |
515 | 0 | } |
516 | | |
517 | 0 | ::PROTOBUF_NAMESPACE_ID::Metadata MongoHeader::GetMetadata() const { |
518 | 0 | return ::_pbi::AssignDescriptors( |
519 | 0 | &descriptor_table_brpc_2fpolicy_2fmongo_2eproto_getter, &descriptor_table_brpc_2fpolicy_2fmongo_2eproto_once, |
520 | 0 | file_level_metadata_brpc_2fpolicy_2fmongo_2eproto[0]); |
521 | 0 | } |
522 | | |
523 | | // =================================================================== |
524 | | |
525 | | class MongoRequest::_Internal { |
526 | | public: |
527 | | using HasBits = decltype(std::declval<MongoRequest>()._impl_._has_bits_); |
528 | | static const ::brpc::policy::MongoHeader& header(const MongoRequest* msg); |
529 | 0 | static void set_has_header(HasBits* has_bits) { |
530 | 0 | (*has_bits)[0] |= 2u; |
531 | 0 | } |
532 | 0 | static void set_has_message(HasBits* has_bits) { |
533 | 0 | (*has_bits)[0] |= 1u; |
534 | 0 | } |
535 | 0 | static bool MissingRequiredFields(const HasBits& has_bits) { |
536 | 0 | return ((has_bits[0] & 0x00000003) ^ 0x00000003) != 0; |
537 | 0 | } |
538 | | }; |
539 | | |
540 | | const ::brpc::policy::MongoHeader& |
541 | 0 | MongoRequest::_Internal::header(const MongoRequest* msg) { |
542 | 0 | return *msg->_impl_.header_; |
543 | 0 | } |
544 | | MongoRequest::MongoRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, |
545 | | bool is_message_owned) |
546 | 0 | : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { |
547 | 0 | SharedCtor(arena, is_message_owned); |
548 | | // @@protoc_insertion_point(arena_constructor:brpc.policy.MongoRequest) |
549 | 0 | } |
550 | | MongoRequest::MongoRequest(const MongoRequest& from) |
551 | 0 | : ::PROTOBUF_NAMESPACE_ID::Message() { |
552 | 0 | MongoRequest* const _this = this; (void)_this; |
553 | 0 | new (&_impl_) Impl_{ |
554 | 0 | decltype(_impl_._has_bits_){from._impl_._has_bits_} |
555 | 0 | , /*decltype(_impl_._cached_size_)*/{} |
556 | 0 | , decltype(_impl_.message_){} |
557 | 0 | , decltype(_impl_.header_){nullptr}}; |
558 | |
|
559 | 0 | _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); |
560 | 0 | _impl_.message_.InitDefault(); |
561 | | #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING |
562 | | _impl_.message_.Set("", GetArenaForAllocation()); |
563 | | #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING |
564 | 0 | if (from._internal_has_message()) { |
565 | 0 | _this->_impl_.message_.Set(from._internal_message(), |
566 | 0 | _this->GetArenaForAllocation()); |
567 | 0 | } |
568 | 0 | if (from._internal_has_header()) { |
569 | 0 | _this->_impl_.header_ = new ::brpc::policy::MongoHeader(*from._impl_.header_); |
570 | 0 | } |
571 | | // @@protoc_insertion_point(copy_constructor:brpc.policy.MongoRequest) |
572 | 0 | } |
573 | | |
574 | | inline void MongoRequest::SharedCtor( |
575 | 0 | ::_pb::Arena* arena, bool is_message_owned) { |
576 | 0 | (void)arena; |
577 | 0 | (void)is_message_owned; |
578 | 0 | new (&_impl_) Impl_{ |
579 | 0 | decltype(_impl_._has_bits_){} |
580 | 0 | , /*decltype(_impl_._cached_size_)*/{} |
581 | 0 | , decltype(_impl_.message_){} |
582 | 0 | , decltype(_impl_.header_){nullptr} |
583 | 0 | }; |
584 | 0 | _impl_.message_.InitDefault(); |
585 | | #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING |
586 | | _impl_.message_.Set("", GetArenaForAllocation()); |
587 | | #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING |
588 | 0 | } |
589 | | |
590 | 0 | MongoRequest::~MongoRequest() { |
591 | | // @@protoc_insertion_point(destructor:brpc.policy.MongoRequest) |
592 | 0 | if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { |
593 | 0 | (void)arena; |
594 | 0 | return; |
595 | 0 | } |
596 | 0 | SharedDtor(); |
597 | 0 | } |
598 | | |
599 | 0 | inline void MongoRequest::SharedDtor() { |
600 | 0 | GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); |
601 | 0 | _impl_.message_.Destroy(); |
602 | 0 | if (this != internal_default_instance()) delete _impl_.header_; |
603 | 0 | } |
604 | | |
605 | 0 | void MongoRequest::SetCachedSize(int size) const { |
606 | 0 | _impl_._cached_size_.Set(size); |
607 | 0 | } |
608 | | |
609 | 0 | void MongoRequest::Clear() { |
610 | | // @@protoc_insertion_point(message_clear_start:brpc.policy.MongoRequest) |
611 | 0 | uint32_t cached_has_bits = 0; |
612 | | // Prevent compiler warnings about cached_has_bits being unused |
613 | 0 | (void) cached_has_bits; |
614 | |
|
615 | 0 | cached_has_bits = _impl_._has_bits_[0]; |
616 | 0 | if (cached_has_bits & 0x00000003u) { |
617 | 0 | if (cached_has_bits & 0x00000001u) { |
618 | 0 | _impl_.message_.ClearNonDefaultToEmpty(); |
619 | 0 | } |
620 | 0 | if (cached_has_bits & 0x00000002u) { |
621 | 0 | GOOGLE_DCHECK(_impl_.header_ != nullptr); |
622 | 0 | _impl_.header_->Clear(); |
623 | 0 | } |
624 | 0 | } |
625 | 0 | _impl_._has_bits_.Clear(); |
626 | 0 | _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); |
627 | 0 | } |
628 | | |
629 | 0 | const char* MongoRequest::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { |
630 | 0 | #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure |
631 | 0 | _Internal::HasBits has_bits{}; |
632 | 0 | while (!ctx->Done(&ptr)) { |
633 | 0 | uint32_t tag; |
634 | 0 | ptr = ::_pbi::ReadTag(ptr, &tag); |
635 | 0 | switch (tag >> 3) { |
636 | | // required .brpc.policy.MongoHeader header = 1; |
637 | 0 | case 1: |
638 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { |
639 | 0 | ptr = ctx->ParseMessage(_internal_mutable_header(), ptr); |
640 | 0 | CHK_(ptr); |
641 | 0 | } else |
642 | 0 | goto handle_unusual; |
643 | 0 | continue; |
644 | | // required string message = 2; |
645 | 0 | case 2: |
646 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) { |
647 | 0 | auto str = _internal_mutable_message(); |
648 | 0 | ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); |
649 | 0 | CHK_(ptr); |
650 | 0 | #ifndef NDEBUG |
651 | 0 | ::_pbi::VerifyUTF8(str, "brpc.policy.MongoRequest.message"); |
652 | 0 | #endif // !NDEBUG |
653 | 0 | } else |
654 | 0 | goto handle_unusual; |
655 | 0 | continue; |
656 | 0 | default: |
657 | 0 | goto handle_unusual; |
658 | 0 | } // switch |
659 | 0 | handle_unusual: |
660 | 0 | if ((tag == 0) || ((tag & 7) == 4)) { |
661 | 0 | CHK_(ptr); |
662 | 0 | ctx->SetLastTag(tag); |
663 | 0 | goto message_done; |
664 | 0 | } |
665 | 0 | ptr = UnknownFieldParse( |
666 | 0 | tag, |
667 | 0 | _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), |
668 | 0 | ptr, ctx); |
669 | 0 | CHK_(ptr != nullptr); |
670 | 0 | } // while |
671 | 0 | message_done: |
672 | 0 | _impl_._has_bits_.Or(has_bits); |
673 | 0 | return ptr; |
674 | 0 | failure: |
675 | 0 | ptr = nullptr; |
676 | 0 | goto message_done; |
677 | 0 | #undef CHK_ |
678 | 0 | } |
679 | | |
680 | | uint8_t* MongoRequest::_InternalSerialize( |
681 | 0 | uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { |
682 | | // @@protoc_insertion_point(serialize_to_array_start:brpc.policy.MongoRequest) |
683 | 0 | uint32_t cached_has_bits = 0; |
684 | 0 | (void) cached_has_bits; |
685 | |
|
686 | 0 | cached_has_bits = _impl_._has_bits_[0]; |
687 | | // required .brpc.policy.MongoHeader header = 1; |
688 | 0 | if (cached_has_bits & 0x00000002u) { |
689 | 0 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: |
690 | 0 | InternalWriteMessage(1, _Internal::header(this), |
691 | 0 | _Internal::header(this).GetCachedSize(), target, stream); |
692 | 0 | } |
693 | | |
694 | | // required string message = 2; |
695 | 0 | if (cached_has_bits & 0x00000001u) { |
696 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( |
697 | 0 | this->_internal_message().data(), static_cast<int>(this->_internal_message().length()), |
698 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, |
699 | 0 | "brpc.policy.MongoRequest.message"); |
700 | 0 | target = stream->WriteStringMaybeAliased( |
701 | 0 | 2, this->_internal_message(), target); |
702 | 0 | } |
703 | |
|
704 | 0 | if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { |
705 | 0 | target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( |
706 | 0 | _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); |
707 | 0 | } |
708 | | // @@protoc_insertion_point(serialize_to_array_end:brpc.policy.MongoRequest) |
709 | 0 | return target; |
710 | 0 | } |
711 | | |
712 | 0 | size_t MongoRequest::RequiredFieldsByteSizeFallback() const { |
713 | | // @@protoc_insertion_point(required_fields_byte_size_fallback_start:brpc.policy.MongoRequest) |
714 | 0 | size_t total_size = 0; |
715 | |
|
716 | 0 | if (_internal_has_message()) { |
717 | | // required string message = 2; |
718 | 0 | total_size += 1 + |
719 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( |
720 | 0 | this->_internal_message()); |
721 | 0 | } |
722 | |
|
723 | 0 | if (_internal_has_header()) { |
724 | | // required .brpc.policy.MongoHeader header = 1; |
725 | 0 | total_size += 1 + |
726 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( |
727 | 0 | *_impl_.header_); |
728 | 0 | } |
729 | |
|
730 | 0 | return total_size; |
731 | 0 | } |
732 | 0 | size_t MongoRequest::ByteSizeLong() const { |
733 | | // @@protoc_insertion_point(message_byte_size_start:brpc.policy.MongoRequest) |
734 | 0 | size_t total_size = 0; |
735 | |
|
736 | 0 | if (((_impl_._has_bits_[0] & 0x00000003) ^ 0x00000003) == 0) { // All required fields are present. |
737 | | // required string message = 2; |
738 | 0 | total_size += 1 + |
739 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( |
740 | 0 | this->_internal_message()); |
741 | | |
742 | | // required .brpc.policy.MongoHeader header = 1; |
743 | 0 | total_size += 1 + |
744 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( |
745 | 0 | *_impl_.header_); |
746 | |
|
747 | 0 | } else { |
748 | 0 | total_size += RequiredFieldsByteSizeFallback(); |
749 | 0 | } |
750 | 0 | uint32_t cached_has_bits = 0; |
751 | | // Prevent compiler warnings about cached_has_bits being unused |
752 | 0 | (void) cached_has_bits; |
753 | |
|
754 | 0 | return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); |
755 | 0 | } |
756 | | |
757 | | const ::PROTOBUF_NAMESPACE_ID::Message::ClassData MongoRequest::_class_data_ = { |
758 | | ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, |
759 | | MongoRequest::MergeImpl |
760 | | }; |
761 | 0 | const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*MongoRequest::GetClassData() const { return &_class_data_; } |
762 | | |
763 | | |
764 | 0 | void MongoRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { |
765 | 0 | auto* const _this = static_cast<MongoRequest*>(&to_msg); |
766 | 0 | auto& from = static_cast<const MongoRequest&>(from_msg); |
767 | | // @@protoc_insertion_point(class_specific_merge_from_start:brpc.policy.MongoRequest) |
768 | 0 | GOOGLE_DCHECK_NE(&from, _this); |
769 | 0 | uint32_t cached_has_bits = 0; |
770 | 0 | (void) cached_has_bits; |
771 | |
|
772 | 0 | cached_has_bits = from._impl_._has_bits_[0]; |
773 | 0 | if (cached_has_bits & 0x00000003u) { |
774 | 0 | if (cached_has_bits & 0x00000001u) { |
775 | 0 | _this->_internal_set_message(from._internal_message()); |
776 | 0 | } |
777 | 0 | if (cached_has_bits & 0x00000002u) { |
778 | 0 | _this->_internal_mutable_header()->::brpc::policy::MongoHeader::MergeFrom( |
779 | 0 | from._internal_header()); |
780 | 0 | } |
781 | 0 | } |
782 | 0 | _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); |
783 | 0 | } |
784 | | |
785 | 0 | void MongoRequest::CopyFrom(const MongoRequest& from) { |
786 | | // @@protoc_insertion_point(class_specific_copy_from_start:brpc.policy.MongoRequest) |
787 | 0 | if (&from == this) return; |
788 | 0 | Clear(); |
789 | 0 | MergeFrom(from); |
790 | 0 | } |
791 | | |
792 | 0 | bool MongoRequest::IsInitialized() const { |
793 | 0 | if (_Internal::MissingRequiredFields(_impl_._has_bits_)) return false; |
794 | 0 | if (_internal_has_header()) { |
795 | 0 | if (!_impl_.header_->IsInitialized()) return false; |
796 | 0 | } |
797 | 0 | return true; |
798 | 0 | } |
799 | | |
800 | 0 | void MongoRequest::InternalSwap(MongoRequest* other) { |
801 | 0 | using std::swap; |
802 | 0 | auto* lhs_arena = GetArenaForAllocation(); |
803 | 0 | auto* rhs_arena = other->GetArenaForAllocation(); |
804 | 0 | _internal_metadata_.InternalSwap(&other->_internal_metadata_); |
805 | 0 | swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); |
806 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( |
807 | 0 | &_impl_.message_, lhs_arena, |
808 | 0 | &other->_impl_.message_, rhs_arena |
809 | 0 | ); |
810 | 0 | swap(_impl_.header_, other->_impl_.header_); |
811 | 0 | } |
812 | | |
813 | 0 | ::PROTOBUF_NAMESPACE_ID::Metadata MongoRequest::GetMetadata() const { |
814 | 0 | return ::_pbi::AssignDescriptors( |
815 | 0 | &descriptor_table_brpc_2fpolicy_2fmongo_2eproto_getter, &descriptor_table_brpc_2fpolicy_2fmongo_2eproto_once, |
816 | 0 | file_level_metadata_brpc_2fpolicy_2fmongo_2eproto[1]); |
817 | 0 | } |
818 | | |
819 | | // =================================================================== |
820 | | |
821 | | class MongoResponse::_Internal { |
822 | | public: |
823 | | using HasBits = decltype(std::declval<MongoResponse>()._impl_._has_bits_); |
824 | | static const ::brpc::policy::MongoHeader& header(const MongoResponse* msg); |
825 | 0 | static void set_has_header(HasBits* has_bits) { |
826 | 0 | (*has_bits)[0] |= 2u; |
827 | 0 | } |
828 | 0 | static void set_has_response_flags(HasBits* has_bits) { |
829 | 0 | (*has_bits)[0] |= 8u; |
830 | 0 | } |
831 | 0 | static void set_has_cursor_id(HasBits* has_bits) { |
832 | 0 | (*has_bits)[0] |= 4u; |
833 | 0 | } |
834 | 0 | static void set_has_starting_from(HasBits* has_bits) { |
835 | 0 | (*has_bits)[0] |= 16u; |
836 | 0 | } |
837 | 0 | static void set_has_number_returned(HasBits* has_bits) { |
838 | 0 | (*has_bits)[0] |= 32u; |
839 | 0 | } |
840 | 0 | static void set_has_message(HasBits* has_bits) { |
841 | 0 | (*has_bits)[0] |= 1u; |
842 | 0 | } |
843 | 0 | static bool MissingRequiredFields(const HasBits& has_bits) { |
844 | 0 | return ((has_bits[0] & 0x0000003f) ^ 0x0000003f) != 0; |
845 | 0 | } |
846 | | }; |
847 | | |
848 | | const ::brpc::policy::MongoHeader& |
849 | 0 | MongoResponse::_Internal::header(const MongoResponse* msg) { |
850 | 0 | return *msg->_impl_.header_; |
851 | 0 | } |
852 | | MongoResponse::MongoResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, |
853 | | bool is_message_owned) |
854 | 0 | : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { |
855 | 0 | SharedCtor(arena, is_message_owned); |
856 | | // @@protoc_insertion_point(arena_constructor:brpc.policy.MongoResponse) |
857 | 0 | } |
858 | | MongoResponse::MongoResponse(const MongoResponse& from) |
859 | 0 | : ::PROTOBUF_NAMESPACE_ID::Message() { |
860 | 0 | MongoResponse* const _this = this; (void)_this; |
861 | 0 | new (&_impl_) Impl_{ |
862 | 0 | decltype(_impl_._has_bits_){from._impl_._has_bits_} |
863 | 0 | , /*decltype(_impl_._cached_size_)*/{} |
864 | 0 | , decltype(_impl_.message_){} |
865 | 0 | , decltype(_impl_.header_){nullptr} |
866 | 0 | , decltype(_impl_.cursor_id_){} |
867 | 0 | , decltype(_impl_.response_flags_){} |
868 | 0 | , decltype(_impl_.starting_from_){} |
869 | 0 | , decltype(_impl_.number_returned_){}}; |
870 | |
|
871 | 0 | _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); |
872 | 0 | _impl_.message_.InitDefault(); |
873 | | #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING |
874 | | _impl_.message_.Set("", GetArenaForAllocation()); |
875 | | #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING |
876 | 0 | if (from._internal_has_message()) { |
877 | 0 | _this->_impl_.message_.Set(from._internal_message(), |
878 | 0 | _this->GetArenaForAllocation()); |
879 | 0 | } |
880 | 0 | if (from._internal_has_header()) { |
881 | 0 | _this->_impl_.header_ = new ::brpc::policy::MongoHeader(*from._impl_.header_); |
882 | 0 | } |
883 | 0 | ::memcpy(&_impl_.cursor_id_, &from._impl_.cursor_id_, |
884 | 0 | static_cast<size_t>(reinterpret_cast<char*>(&_impl_.number_returned_) - |
885 | 0 | reinterpret_cast<char*>(&_impl_.cursor_id_)) + sizeof(_impl_.number_returned_)); |
886 | | // @@protoc_insertion_point(copy_constructor:brpc.policy.MongoResponse) |
887 | 0 | } |
888 | | |
889 | | inline void MongoResponse::SharedCtor( |
890 | 0 | ::_pb::Arena* arena, bool is_message_owned) { |
891 | 0 | (void)arena; |
892 | 0 | (void)is_message_owned; |
893 | 0 | new (&_impl_) Impl_{ |
894 | 0 | decltype(_impl_._has_bits_){} |
895 | 0 | , /*decltype(_impl_._cached_size_)*/{} |
896 | 0 | , decltype(_impl_.message_){} |
897 | 0 | , decltype(_impl_.header_){nullptr} |
898 | 0 | , decltype(_impl_.cursor_id_){int64_t{0}} |
899 | 0 | , decltype(_impl_.response_flags_){0} |
900 | 0 | , decltype(_impl_.starting_from_){0} |
901 | 0 | , decltype(_impl_.number_returned_){0} |
902 | 0 | }; |
903 | 0 | _impl_.message_.InitDefault(); |
904 | | #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING |
905 | | _impl_.message_.Set("", GetArenaForAllocation()); |
906 | | #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING |
907 | 0 | } |
908 | | |
909 | 0 | MongoResponse::~MongoResponse() { |
910 | | // @@protoc_insertion_point(destructor:brpc.policy.MongoResponse) |
911 | 0 | if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { |
912 | 0 | (void)arena; |
913 | 0 | return; |
914 | 0 | } |
915 | 0 | SharedDtor(); |
916 | 0 | } |
917 | | |
918 | 0 | inline void MongoResponse::SharedDtor() { |
919 | 0 | GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); |
920 | 0 | _impl_.message_.Destroy(); |
921 | 0 | if (this != internal_default_instance()) delete _impl_.header_; |
922 | 0 | } |
923 | | |
924 | 0 | void MongoResponse::SetCachedSize(int size) const { |
925 | 0 | _impl_._cached_size_.Set(size); |
926 | 0 | } |
927 | | |
928 | 0 | void MongoResponse::Clear() { |
929 | | // @@protoc_insertion_point(message_clear_start:brpc.policy.MongoResponse) |
930 | 0 | uint32_t cached_has_bits = 0; |
931 | | // Prevent compiler warnings about cached_has_bits being unused |
932 | 0 | (void) cached_has_bits; |
933 | |
|
934 | 0 | cached_has_bits = _impl_._has_bits_[0]; |
935 | 0 | if (cached_has_bits & 0x00000003u) { |
936 | 0 | if (cached_has_bits & 0x00000001u) { |
937 | 0 | _impl_.message_.ClearNonDefaultToEmpty(); |
938 | 0 | } |
939 | 0 | if (cached_has_bits & 0x00000002u) { |
940 | 0 | GOOGLE_DCHECK(_impl_.header_ != nullptr); |
941 | 0 | _impl_.header_->Clear(); |
942 | 0 | } |
943 | 0 | } |
944 | 0 | if (cached_has_bits & 0x0000003cu) { |
945 | 0 | ::memset(&_impl_.cursor_id_, 0, static_cast<size_t>( |
946 | 0 | reinterpret_cast<char*>(&_impl_.number_returned_) - |
947 | 0 | reinterpret_cast<char*>(&_impl_.cursor_id_)) + sizeof(_impl_.number_returned_)); |
948 | 0 | } |
949 | 0 | _impl_._has_bits_.Clear(); |
950 | 0 | _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); |
951 | 0 | } |
952 | | |
953 | 0 | const char* MongoResponse::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { |
954 | 0 | #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure |
955 | 0 | _Internal::HasBits has_bits{}; |
956 | 0 | while (!ctx->Done(&ptr)) { |
957 | 0 | uint32_t tag; |
958 | 0 | ptr = ::_pbi::ReadTag(ptr, &tag); |
959 | 0 | switch (tag >> 3) { |
960 | | // required .brpc.policy.MongoHeader header = 1; |
961 | 0 | case 1: |
962 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { |
963 | 0 | ptr = ctx->ParseMessage(_internal_mutable_header(), ptr); |
964 | 0 | CHK_(ptr); |
965 | 0 | } else |
966 | 0 | goto handle_unusual; |
967 | 0 | continue; |
968 | | // required int32 response_flags = 2; |
969 | 0 | case 2: |
970 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) { |
971 | 0 | _Internal::set_has_response_flags(&has_bits); |
972 | 0 | _impl_.response_flags_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); |
973 | 0 | CHK_(ptr); |
974 | 0 | } else |
975 | 0 | goto handle_unusual; |
976 | 0 | continue; |
977 | | // required int64 cursor_id = 3; |
978 | 0 | case 3: |
979 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) { |
980 | 0 | _Internal::set_has_cursor_id(&has_bits); |
981 | 0 | _impl_.cursor_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); |
982 | 0 | CHK_(ptr); |
983 | 0 | } else |
984 | 0 | goto handle_unusual; |
985 | 0 | continue; |
986 | | // required int32 starting_from = 4; |
987 | 0 | case 4: |
988 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 32)) { |
989 | 0 | _Internal::set_has_starting_from(&has_bits); |
990 | 0 | _impl_.starting_from_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); |
991 | 0 | CHK_(ptr); |
992 | 0 | } else |
993 | 0 | goto handle_unusual; |
994 | 0 | continue; |
995 | | // required int32 number_returned = 5; |
996 | 0 | case 5: |
997 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 40)) { |
998 | 0 | _Internal::set_has_number_returned(&has_bits); |
999 | 0 | _impl_.number_returned_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); |
1000 | 0 | CHK_(ptr); |
1001 | 0 | } else |
1002 | 0 | goto handle_unusual; |
1003 | 0 | continue; |
1004 | | // required string message = 6; |
1005 | 0 | case 6: |
1006 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 50)) { |
1007 | 0 | auto str = _internal_mutable_message(); |
1008 | 0 | ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); |
1009 | 0 | CHK_(ptr); |
1010 | 0 | #ifndef NDEBUG |
1011 | 0 | ::_pbi::VerifyUTF8(str, "brpc.policy.MongoResponse.message"); |
1012 | 0 | #endif // !NDEBUG |
1013 | 0 | } else |
1014 | 0 | goto handle_unusual; |
1015 | 0 | continue; |
1016 | 0 | default: |
1017 | 0 | goto handle_unusual; |
1018 | 0 | } // switch |
1019 | 0 | handle_unusual: |
1020 | 0 | if ((tag == 0) || ((tag & 7) == 4)) { |
1021 | 0 | CHK_(ptr); |
1022 | 0 | ctx->SetLastTag(tag); |
1023 | 0 | goto message_done; |
1024 | 0 | } |
1025 | 0 | ptr = UnknownFieldParse( |
1026 | 0 | tag, |
1027 | 0 | _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), |
1028 | 0 | ptr, ctx); |
1029 | 0 | CHK_(ptr != nullptr); |
1030 | 0 | } // while |
1031 | 0 | message_done: |
1032 | 0 | _impl_._has_bits_.Or(has_bits); |
1033 | 0 | return ptr; |
1034 | 0 | failure: |
1035 | 0 | ptr = nullptr; |
1036 | 0 | goto message_done; |
1037 | 0 | #undef CHK_ |
1038 | 0 | } |
1039 | | |
1040 | | uint8_t* MongoResponse::_InternalSerialize( |
1041 | 0 | uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { |
1042 | | // @@protoc_insertion_point(serialize_to_array_start:brpc.policy.MongoResponse) |
1043 | 0 | uint32_t cached_has_bits = 0; |
1044 | 0 | (void) cached_has_bits; |
1045 | |
|
1046 | 0 | cached_has_bits = _impl_._has_bits_[0]; |
1047 | | // required .brpc.policy.MongoHeader header = 1; |
1048 | 0 | if (cached_has_bits & 0x00000002u) { |
1049 | 0 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: |
1050 | 0 | InternalWriteMessage(1, _Internal::header(this), |
1051 | 0 | _Internal::header(this).GetCachedSize(), target, stream); |
1052 | 0 | } |
1053 | | |
1054 | | // required int32 response_flags = 2; |
1055 | 0 | if (cached_has_bits & 0x00000008u) { |
1056 | 0 | target = stream->EnsureSpace(target); |
1057 | 0 | target = ::_pbi::WireFormatLite::WriteInt32ToArray(2, this->_internal_response_flags(), target); |
1058 | 0 | } |
1059 | | |
1060 | | // required int64 cursor_id = 3; |
1061 | 0 | if (cached_has_bits & 0x00000004u) { |
1062 | 0 | target = stream->EnsureSpace(target); |
1063 | 0 | target = ::_pbi::WireFormatLite::WriteInt64ToArray(3, this->_internal_cursor_id(), target); |
1064 | 0 | } |
1065 | | |
1066 | | // required int32 starting_from = 4; |
1067 | 0 | if (cached_has_bits & 0x00000010u) { |
1068 | 0 | target = stream->EnsureSpace(target); |
1069 | 0 | target = ::_pbi::WireFormatLite::WriteInt32ToArray(4, this->_internal_starting_from(), target); |
1070 | 0 | } |
1071 | | |
1072 | | // required int32 number_returned = 5; |
1073 | 0 | if (cached_has_bits & 0x00000020u) { |
1074 | 0 | target = stream->EnsureSpace(target); |
1075 | 0 | target = ::_pbi::WireFormatLite::WriteInt32ToArray(5, this->_internal_number_returned(), target); |
1076 | 0 | } |
1077 | | |
1078 | | // required string message = 6; |
1079 | 0 | if (cached_has_bits & 0x00000001u) { |
1080 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( |
1081 | 0 | this->_internal_message().data(), static_cast<int>(this->_internal_message().length()), |
1082 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, |
1083 | 0 | "brpc.policy.MongoResponse.message"); |
1084 | 0 | target = stream->WriteStringMaybeAliased( |
1085 | 0 | 6, this->_internal_message(), target); |
1086 | 0 | } |
1087 | |
|
1088 | 0 | if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { |
1089 | 0 | target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( |
1090 | 0 | _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); |
1091 | 0 | } |
1092 | | // @@protoc_insertion_point(serialize_to_array_end:brpc.policy.MongoResponse) |
1093 | 0 | return target; |
1094 | 0 | } |
1095 | | |
1096 | 0 | size_t MongoResponse::RequiredFieldsByteSizeFallback() const { |
1097 | | // @@protoc_insertion_point(required_fields_byte_size_fallback_start:brpc.policy.MongoResponse) |
1098 | 0 | size_t total_size = 0; |
1099 | |
|
1100 | 0 | if (_internal_has_message()) { |
1101 | | // required string message = 6; |
1102 | 0 | total_size += 1 + |
1103 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( |
1104 | 0 | this->_internal_message()); |
1105 | 0 | } |
1106 | |
|
1107 | 0 | if (_internal_has_header()) { |
1108 | | // required .brpc.policy.MongoHeader header = 1; |
1109 | 0 | total_size += 1 + |
1110 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( |
1111 | 0 | *_impl_.header_); |
1112 | 0 | } |
1113 | |
|
1114 | 0 | if (_internal_has_cursor_id()) { |
1115 | | // required int64 cursor_id = 3; |
1116 | 0 | total_size += ::_pbi::WireFormatLite::Int64SizePlusOne(this->_internal_cursor_id()); |
1117 | 0 | } |
1118 | |
|
1119 | 0 | if (_internal_has_response_flags()) { |
1120 | | // required int32 response_flags = 2; |
1121 | 0 | total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_response_flags()); |
1122 | 0 | } |
1123 | |
|
1124 | 0 | if (_internal_has_starting_from()) { |
1125 | | // required int32 starting_from = 4; |
1126 | 0 | total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_starting_from()); |
1127 | 0 | } |
1128 | |
|
1129 | 0 | if (_internal_has_number_returned()) { |
1130 | | // required int32 number_returned = 5; |
1131 | 0 | total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_number_returned()); |
1132 | 0 | } |
1133 | |
|
1134 | 0 | return total_size; |
1135 | 0 | } |
1136 | 0 | size_t MongoResponse::ByteSizeLong() const { |
1137 | | // @@protoc_insertion_point(message_byte_size_start:brpc.policy.MongoResponse) |
1138 | 0 | size_t total_size = 0; |
1139 | |
|
1140 | 0 | if (((_impl_._has_bits_[0] & 0x0000003f) ^ 0x0000003f) == 0) { // All required fields are present. |
1141 | | // required string message = 6; |
1142 | 0 | total_size += 1 + |
1143 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( |
1144 | 0 | this->_internal_message()); |
1145 | | |
1146 | | // required .brpc.policy.MongoHeader header = 1; |
1147 | 0 | total_size += 1 + |
1148 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( |
1149 | 0 | *_impl_.header_); |
1150 | | |
1151 | | // required int64 cursor_id = 3; |
1152 | 0 | total_size += ::_pbi::WireFormatLite::Int64SizePlusOne(this->_internal_cursor_id()); |
1153 | | |
1154 | | // required int32 response_flags = 2; |
1155 | 0 | total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_response_flags()); |
1156 | | |
1157 | | // required int32 starting_from = 4; |
1158 | 0 | total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_starting_from()); |
1159 | | |
1160 | | // required int32 number_returned = 5; |
1161 | 0 | total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_number_returned()); |
1162 | |
|
1163 | 0 | } else { |
1164 | 0 | total_size += RequiredFieldsByteSizeFallback(); |
1165 | 0 | } |
1166 | 0 | uint32_t cached_has_bits = 0; |
1167 | | // Prevent compiler warnings about cached_has_bits being unused |
1168 | 0 | (void) cached_has_bits; |
1169 | |
|
1170 | 0 | return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); |
1171 | 0 | } |
1172 | | |
1173 | | const ::PROTOBUF_NAMESPACE_ID::Message::ClassData MongoResponse::_class_data_ = { |
1174 | | ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, |
1175 | | MongoResponse::MergeImpl |
1176 | | }; |
1177 | 0 | const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*MongoResponse::GetClassData() const { return &_class_data_; } |
1178 | | |
1179 | | |
1180 | 0 | void MongoResponse::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { |
1181 | 0 | auto* const _this = static_cast<MongoResponse*>(&to_msg); |
1182 | 0 | auto& from = static_cast<const MongoResponse&>(from_msg); |
1183 | | // @@protoc_insertion_point(class_specific_merge_from_start:brpc.policy.MongoResponse) |
1184 | 0 | GOOGLE_DCHECK_NE(&from, _this); |
1185 | 0 | uint32_t cached_has_bits = 0; |
1186 | 0 | (void) cached_has_bits; |
1187 | |
|
1188 | 0 | cached_has_bits = from._impl_._has_bits_[0]; |
1189 | 0 | if (cached_has_bits & 0x0000003fu) { |
1190 | 0 | if (cached_has_bits & 0x00000001u) { |
1191 | 0 | _this->_internal_set_message(from._internal_message()); |
1192 | 0 | } |
1193 | 0 | if (cached_has_bits & 0x00000002u) { |
1194 | 0 | _this->_internal_mutable_header()->::brpc::policy::MongoHeader::MergeFrom( |
1195 | 0 | from._internal_header()); |
1196 | 0 | } |
1197 | 0 | if (cached_has_bits & 0x00000004u) { |
1198 | 0 | _this->_impl_.cursor_id_ = from._impl_.cursor_id_; |
1199 | 0 | } |
1200 | 0 | if (cached_has_bits & 0x00000008u) { |
1201 | 0 | _this->_impl_.response_flags_ = from._impl_.response_flags_; |
1202 | 0 | } |
1203 | 0 | if (cached_has_bits & 0x00000010u) { |
1204 | 0 | _this->_impl_.starting_from_ = from._impl_.starting_from_; |
1205 | 0 | } |
1206 | 0 | if (cached_has_bits & 0x00000020u) { |
1207 | 0 | _this->_impl_.number_returned_ = from._impl_.number_returned_; |
1208 | 0 | } |
1209 | 0 | _this->_impl_._has_bits_[0] |= cached_has_bits; |
1210 | 0 | } |
1211 | 0 | _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); |
1212 | 0 | } |
1213 | | |
1214 | 0 | void MongoResponse::CopyFrom(const MongoResponse& from) { |
1215 | | // @@protoc_insertion_point(class_specific_copy_from_start:brpc.policy.MongoResponse) |
1216 | 0 | if (&from == this) return; |
1217 | 0 | Clear(); |
1218 | 0 | MergeFrom(from); |
1219 | 0 | } |
1220 | | |
1221 | 0 | bool MongoResponse::IsInitialized() const { |
1222 | 0 | if (_Internal::MissingRequiredFields(_impl_._has_bits_)) return false; |
1223 | 0 | if (_internal_has_header()) { |
1224 | 0 | if (!_impl_.header_->IsInitialized()) return false; |
1225 | 0 | } |
1226 | 0 | return true; |
1227 | 0 | } |
1228 | | |
1229 | 0 | void MongoResponse::InternalSwap(MongoResponse* other) { |
1230 | 0 | using std::swap; |
1231 | 0 | auto* lhs_arena = GetArenaForAllocation(); |
1232 | 0 | auto* rhs_arena = other->GetArenaForAllocation(); |
1233 | 0 | _internal_metadata_.InternalSwap(&other->_internal_metadata_); |
1234 | 0 | swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); |
1235 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( |
1236 | 0 | &_impl_.message_, lhs_arena, |
1237 | 0 | &other->_impl_.message_, rhs_arena |
1238 | 0 | ); |
1239 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::memswap< |
1240 | 0 | PROTOBUF_FIELD_OFFSET(MongoResponse, _impl_.number_returned_) |
1241 | 0 | + sizeof(MongoResponse::_impl_.number_returned_) |
1242 | 0 | - PROTOBUF_FIELD_OFFSET(MongoResponse, _impl_.header_)>( |
1243 | 0 | reinterpret_cast<char*>(&_impl_.header_), |
1244 | 0 | reinterpret_cast<char*>(&other->_impl_.header_)); |
1245 | 0 | } |
1246 | | |
1247 | 0 | ::PROTOBUF_NAMESPACE_ID::Metadata MongoResponse::GetMetadata() const { |
1248 | 0 | return ::_pbi::AssignDescriptors( |
1249 | 0 | &descriptor_table_brpc_2fpolicy_2fmongo_2eproto_getter, &descriptor_table_brpc_2fpolicy_2fmongo_2eproto_once, |
1250 | 0 | file_level_metadata_brpc_2fpolicy_2fmongo_2eproto[2]); |
1251 | 0 | } |
1252 | | |
1253 | | // =================================================================== |
1254 | | |
1255 | 0 | MongoService::~MongoService() {} |
1256 | | |
1257 | 0 | const ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor* MongoService::descriptor() { |
1258 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_brpc_2fpolicy_2fmongo_2eproto); |
1259 | 0 | return file_level_service_descriptors_brpc_2fpolicy_2fmongo_2eproto[0]; |
1260 | 0 | } |
1261 | | |
1262 | 0 | const ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor* MongoService::GetDescriptor() { |
1263 | 0 | return descriptor(); |
1264 | 0 | } |
1265 | | |
1266 | | void MongoService::default_method(::PROTOBUF_NAMESPACE_ID::RpcController* controller, |
1267 | | const ::brpc::policy::MongoRequest*, |
1268 | | ::brpc::policy::MongoResponse*, |
1269 | 0 | ::google::protobuf::Closure* done) { |
1270 | 0 | controller->SetFailed("Method default_method() not implemented."); |
1271 | 0 | done->Run(); |
1272 | 0 | } |
1273 | | |
1274 | | void MongoService::CallMethod(const ::PROTOBUF_NAMESPACE_ID::MethodDescriptor* method, |
1275 | | ::PROTOBUF_NAMESPACE_ID::RpcController* controller, |
1276 | | const ::PROTOBUF_NAMESPACE_ID::Message* request, |
1277 | | ::PROTOBUF_NAMESPACE_ID::Message* response, |
1278 | 0 | ::google::protobuf::Closure* done) { |
1279 | 0 | GOOGLE_DCHECK_EQ(method->service(), file_level_service_descriptors_brpc_2fpolicy_2fmongo_2eproto[0]); |
1280 | 0 | switch(method->index()) { |
1281 | 0 | case 0: |
1282 | 0 | default_method(controller, |
1283 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::DownCast<const ::brpc::policy::MongoRequest*>( |
1284 | 0 | request), |
1285 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::DownCast<::brpc::policy::MongoResponse*>( |
1286 | 0 | response), |
1287 | 0 | done); |
1288 | 0 | break; |
1289 | 0 | default: |
1290 | 0 | GOOGLE_LOG(FATAL) << "Bad method index; this should never happen."; |
1291 | 0 | break; |
1292 | 0 | } |
1293 | 0 | } |
1294 | | |
1295 | | const ::PROTOBUF_NAMESPACE_ID::Message& MongoService::GetRequestPrototype( |
1296 | 0 | const ::PROTOBUF_NAMESPACE_ID::MethodDescriptor* method) const { |
1297 | 0 | GOOGLE_DCHECK_EQ(method->service(), descriptor()); |
1298 | 0 | switch(method->index()) { |
1299 | 0 | case 0: |
1300 | 0 | return ::brpc::policy::MongoRequest::default_instance(); |
1301 | 0 | default: |
1302 | 0 | GOOGLE_LOG(FATAL) << "Bad method index; this should never happen."; |
1303 | 0 | return *::PROTOBUF_NAMESPACE_ID::MessageFactory::generated_factory() |
1304 | 0 | ->GetPrototype(method->input_type()); |
1305 | 0 | } |
1306 | 0 | } |
1307 | | |
1308 | | const ::PROTOBUF_NAMESPACE_ID::Message& MongoService::GetResponsePrototype( |
1309 | 0 | const ::PROTOBUF_NAMESPACE_ID::MethodDescriptor* method) const { |
1310 | 0 | GOOGLE_DCHECK_EQ(method->service(), descriptor()); |
1311 | 0 | switch(method->index()) { |
1312 | 0 | case 0: |
1313 | 0 | return ::brpc::policy::MongoResponse::default_instance(); |
1314 | 0 | default: |
1315 | 0 | GOOGLE_LOG(FATAL) << "Bad method index; this should never happen."; |
1316 | 0 | return *::PROTOBUF_NAMESPACE_ID::MessageFactory::generated_factory() |
1317 | 0 | ->GetPrototype(method->output_type()); |
1318 | 0 | } |
1319 | 0 | } |
1320 | | |
1321 | | MongoService_Stub::MongoService_Stub(::PROTOBUF_NAMESPACE_ID::RpcChannel* channel) |
1322 | 0 | : channel_(channel), owns_channel_(false) {} |
1323 | | MongoService_Stub::MongoService_Stub( |
1324 | | ::PROTOBUF_NAMESPACE_ID::RpcChannel* channel, |
1325 | | ::PROTOBUF_NAMESPACE_ID::Service::ChannelOwnership ownership) |
1326 | 0 | : channel_(channel), |
1327 | 0 | owns_channel_(ownership == ::PROTOBUF_NAMESPACE_ID::Service::STUB_OWNS_CHANNEL) {} |
1328 | 0 | MongoService_Stub::~MongoService_Stub() { |
1329 | 0 | if (owns_channel_) delete channel_; |
1330 | 0 | } |
1331 | | |
1332 | | void MongoService_Stub::default_method(::PROTOBUF_NAMESPACE_ID::RpcController* controller, |
1333 | | const ::brpc::policy::MongoRequest* request, |
1334 | | ::brpc::policy::MongoResponse* response, |
1335 | 0 | ::google::protobuf::Closure* done) { |
1336 | 0 | channel_->CallMethod(descriptor()->method(0), |
1337 | 0 | controller, request, response, done); |
1338 | 0 | } |
1339 | | |
1340 | | // @@protoc_insertion_point(namespace_scope) |
1341 | | } // namespace policy |
1342 | | } // namespace brpc |
1343 | | PROTOBUF_NAMESPACE_OPEN |
1344 | | template<> PROTOBUF_NOINLINE ::brpc::policy::MongoHeader* |
1345 | 0 | Arena::CreateMaybeMessage< ::brpc::policy::MongoHeader >(Arena* arena) { |
1346 | 0 | return Arena::CreateMessageInternal< ::brpc::policy::MongoHeader >(arena); |
1347 | 0 | } |
1348 | | template<> PROTOBUF_NOINLINE ::brpc::policy::MongoRequest* |
1349 | 0 | Arena::CreateMaybeMessage< ::brpc::policy::MongoRequest >(Arena* arena) { |
1350 | 0 | return Arena::CreateMessageInternal< ::brpc::policy::MongoRequest >(arena); |
1351 | 0 | } |
1352 | | template<> PROTOBUF_NOINLINE ::brpc::policy::MongoResponse* |
1353 | 0 | Arena::CreateMaybeMessage< ::brpc::policy::MongoResponse >(Arena* arena) { |
1354 | 0 | return Arena::CreateMessageInternal< ::brpc::policy::MongoResponse >(arena); |
1355 | 0 | } |
1356 | | PROTOBUF_NAMESPACE_CLOSE |
1357 | | |
1358 | | // @@protoc_insertion_point(global_scope) |
1359 | | #include <google/protobuf/port_undef.inc> |