mutation.pb.cc 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892
  1. /*
  2. * Copyright 2018 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. // Generated by the protocol buffer compiler. DO NOT EDIT!
  17. // source: firestore/local/mutation.proto
  18. #include "firestore/local/mutation.pb.h"
  19. #include <algorithm>
  20. #include <google/protobuf/stubs/common.h>
  21. #include <google/protobuf/io/coded_stream.h>
  22. #include <google/protobuf/extension_set.h>
  23. #include <google/protobuf/wire_format_lite.h>
  24. #include <google/protobuf/descriptor.h>
  25. #include <google/protobuf/generated_message_reflection.h>
  26. #include <google/protobuf/reflection_ops.h>
  27. #include <google/protobuf/wire_format.h>
  28. // @@protoc_insertion_point(includes)
  29. #include <google/protobuf/port_def.inc>
  30. extern PROTOBUF_INTERNAL_EXPORT_google_2ffirestore_2fv1_2fwrite_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<4> scc_info_Write_google_2ffirestore_2fv1_2fwrite_2eproto;
  31. extern PROTOBUF_INTERNAL_EXPORT_google_2fprotobuf_2ftimestamp_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Timestamp_google_2fprotobuf_2ftimestamp_2eproto;
  32. namespace firestore {
  33. namespace client {
  34. class MutationQueueDefaultTypeInternal {
  35. public:
  36. ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<MutationQueue> _instance;
  37. } _MutationQueue_default_instance_;
  38. class WriteBatchDefaultTypeInternal {
  39. public:
  40. ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<WriteBatch> _instance;
  41. } _WriteBatch_default_instance_;
  42. } // namespace client
  43. } // namespace firestore
  44. static void InitDefaultsscc_info_MutationQueue_firestore_2flocal_2fmutation_2eproto() {
  45. GOOGLE_PROTOBUF_VERIFY_VERSION;
  46. {
  47. void* ptr = &::firestore::client::_MutationQueue_default_instance_;
  48. new (ptr) ::firestore::client::MutationQueue();
  49. ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
  50. }
  51. ::firestore::client::MutationQueue::InitAsDefaultInstance();
  52. }
  53. ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_MutationQueue_firestore_2flocal_2fmutation_2eproto =
  54. {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_MutationQueue_firestore_2flocal_2fmutation_2eproto}, {}};
  55. static void InitDefaultsscc_info_WriteBatch_firestore_2flocal_2fmutation_2eproto() {
  56. GOOGLE_PROTOBUF_VERIFY_VERSION;
  57. {
  58. void* ptr = &::firestore::client::_WriteBatch_default_instance_;
  59. new (ptr) ::firestore::client::WriteBatch();
  60. ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
  61. }
  62. ::firestore::client::WriteBatch::InitAsDefaultInstance();
  63. }
  64. ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<2> scc_info_WriteBatch_firestore_2flocal_2fmutation_2eproto =
  65. {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 2, InitDefaultsscc_info_WriteBatch_firestore_2flocal_2fmutation_2eproto}, {
  66. &scc_info_Write_google_2ffirestore_2fv1_2fwrite_2eproto.base,
  67. &scc_info_Timestamp_google_2fprotobuf_2ftimestamp_2eproto.base,}};
  68. static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_firestore_2flocal_2fmutation_2eproto[2];
  69. static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_firestore_2flocal_2fmutation_2eproto = nullptr;
  70. static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_firestore_2flocal_2fmutation_2eproto = nullptr;
  71. const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_firestore_2flocal_2fmutation_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
  72. ~0u, // no _has_bits_
  73. PROTOBUF_FIELD_OFFSET(::firestore::client::MutationQueue, _internal_metadata_),
  74. ~0u, // no _extensions_
  75. ~0u, // no _oneof_case_
  76. ~0u, // no _weak_field_map_
  77. PROTOBUF_FIELD_OFFSET(::firestore::client::MutationQueue, last_acknowledged_batch_id_),
  78. PROTOBUF_FIELD_OFFSET(::firestore::client::MutationQueue, last_stream_token_),
  79. ~0u, // no _has_bits_
  80. PROTOBUF_FIELD_OFFSET(::firestore::client::WriteBatch, _internal_metadata_),
  81. ~0u, // no _extensions_
  82. ~0u, // no _oneof_case_
  83. ~0u, // no _weak_field_map_
  84. PROTOBUF_FIELD_OFFSET(::firestore::client::WriteBatch, batch_id_),
  85. PROTOBUF_FIELD_OFFSET(::firestore::client::WriteBatch, writes_),
  86. PROTOBUF_FIELD_OFFSET(::firestore::client::WriteBatch, local_write_time_),
  87. PROTOBUF_FIELD_OFFSET(::firestore::client::WriteBatch, base_writes_),
  88. };
  89. static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
  90. { 0, -1, sizeof(::firestore::client::MutationQueue)},
  91. { 7, -1, sizeof(::firestore::client::WriteBatch)},
  92. };
  93. static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = {
  94. reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::firestore::client::_MutationQueue_default_instance_),
  95. reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::firestore::client::_WriteBatch_default_instance_),
  96. };
  97. const char descriptor_table_protodef_firestore_2flocal_2fmutation_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
  98. "\n\036firestore/local/mutation.proto\022\020firest"
  99. "ore.client\032\037google/firestore/v1/write.pr"
  100. "oto\032\037google/protobuf/timestamp.proto\"N\n\r"
  101. "MutationQueue\022\"\n\032last_acknowledged_batch"
  102. "_id\030\001 \001(\005\022\031\n\021last_stream_token\030\002 \001(\014\"\261\001\n"
  103. "\nWriteBatch\022\020\n\010batch_id\030\001 \001(\005\022*\n\006writes\030"
  104. "\002 \003(\0132\032.google.firestore.v1.Write\0224\n\020loc"
  105. "al_write_time\030\003 \001(\0132\032.google.protobuf.Ti"
  106. "mestamp\022/\n\013base_writes\030\004 \003(\0132\032.google.fi"
  107. "restore.v1.WriteB/\n#com.google.firebase."
  108. "firestore.protoP\001\242\002\005FSTPBb\006proto3"
  109. ;
  110. static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_firestore_2flocal_2fmutation_2eproto_deps[2] = {
  111. &::descriptor_table_google_2ffirestore_2fv1_2fwrite_2eproto,
  112. &::descriptor_table_google_2fprotobuf_2ftimestamp_2eproto,
  113. };
  114. static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_firestore_2flocal_2fmutation_2eproto_sccs[2] = {
  115. &scc_info_MutationQueue_firestore_2flocal_2fmutation_2eproto.base,
  116. &scc_info_WriteBatch_firestore_2flocal_2fmutation_2eproto.base,
  117. };
  118. static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_firestore_2flocal_2fmutation_2eproto_once;
  119. static bool descriptor_table_firestore_2flocal_2fmutation_2eproto_initialized = false;
  120. const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_firestore_2flocal_2fmutation_2eproto = {
  121. &descriptor_table_firestore_2flocal_2fmutation_2eproto_initialized, descriptor_table_protodef_firestore_2flocal_2fmutation_2eproto, "firestore/local/mutation.proto", 433,
  122. &descriptor_table_firestore_2flocal_2fmutation_2eproto_once, descriptor_table_firestore_2flocal_2fmutation_2eproto_sccs, descriptor_table_firestore_2flocal_2fmutation_2eproto_deps, 2, 2,
  123. schemas, file_default_instances, TableStruct_firestore_2flocal_2fmutation_2eproto::offsets,
  124. file_level_metadata_firestore_2flocal_2fmutation_2eproto, 2, file_level_enum_descriptors_firestore_2flocal_2fmutation_2eproto, file_level_service_descriptors_firestore_2flocal_2fmutation_2eproto,
  125. };
  126. // Force running AddDescriptors() at dynamic initialization time.
  127. static bool dynamic_init_dummy_firestore_2flocal_2fmutation_2eproto = ( ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_firestore_2flocal_2fmutation_2eproto), true);
  128. namespace firestore {
  129. namespace client {
  130. // ===================================================================
  131. void MutationQueue::InitAsDefaultInstance() {
  132. }
  133. class MutationQueue::_Internal {
  134. public:
  135. };
  136. MutationQueue::MutationQueue()
  137. : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
  138. SharedCtor();
  139. // @@protoc_insertion_point(constructor:firestore.client.MutationQueue)
  140. }
  141. MutationQueue::MutationQueue(const MutationQueue& from)
  142. : ::PROTOBUF_NAMESPACE_ID::Message(),
  143. _internal_metadata_(nullptr) {
  144. _internal_metadata_.MergeFrom(from._internal_metadata_);
  145. last_stream_token_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  146. if (!from.last_stream_token().empty()) {
  147. last_stream_token_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.last_stream_token_);
  148. }
  149. last_acknowledged_batch_id_ = from.last_acknowledged_batch_id_;
  150. // @@protoc_insertion_point(copy_constructor:firestore.client.MutationQueue)
  151. }
  152. void MutationQueue::SharedCtor() {
  153. ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_MutationQueue_firestore_2flocal_2fmutation_2eproto.base);
  154. last_stream_token_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  155. last_acknowledged_batch_id_ = 0;
  156. }
  157. MutationQueue::~MutationQueue() {
  158. // @@protoc_insertion_point(destructor:firestore.client.MutationQueue)
  159. SharedDtor();
  160. }
  161. void MutationQueue::SharedDtor() {
  162. last_stream_token_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  163. }
  164. void MutationQueue::SetCachedSize(int size) const {
  165. _cached_size_.Set(size);
  166. }
  167. const MutationQueue& MutationQueue::default_instance() {
  168. ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_MutationQueue_firestore_2flocal_2fmutation_2eproto.base);
  169. return *internal_default_instance();
  170. }
  171. void MutationQueue::Clear() {
  172. // @@protoc_insertion_point(message_clear_start:firestore.client.MutationQueue)
  173. ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  174. // Prevent compiler warnings about cached_has_bits being unused
  175. (void) cached_has_bits;
  176. last_stream_token_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  177. last_acknowledged_batch_id_ = 0;
  178. _internal_metadata_.Clear();
  179. }
  180. #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
  181. const char* MutationQueue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
  182. #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  183. while (!ctx->Done(&ptr)) {
  184. ::PROTOBUF_NAMESPACE_ID::uint32 tag;
  185. ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
  186. CHK_(ptr);
  187. switch (tag >> 3) {
  188. // int32 last_acknowledged_batch_id = 1;
  189. case 1:
  190. if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
  191. last_acknowledged_batch_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr);
  192. CHK_(ptr);
  193. } else goto handle_unusual;
  194. continue;
  195. // bytes last_stream_token = 2;
  196. case 2:
  197. if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
  198. ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(mutable_last_stream_token(), ptr, ctx);
  199. CHK_(ptr);
  200. } else goto handle_unusual;
  201. continue;
  202. default: {
  203. handle_unusual:
  204. if ((tag & 7) == 4 || tag == 0) {
  205. ctx->SetLastTag(tag);
  206. goto success;
  207. }
  208. ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
  209. CHK_(ptr != nullptr);
  210. continue;
  211. }
  212. } // switch
  213. } // while
  214. success:
  215. return ptr;
  216. failure:
  217. ptr = nullptr;
  218. goto success;
  219. #undef CHK_
  220. }
  221. #else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
  222. bool MutationQueue::MergePartialFromCodedStream(
  223. ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) {
  224. #define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure
  225. ::PROTOBUF_NAMESPACE_ID::uint32 tag;
  226. // @@protoc_insertion_point(parse_start:firestore.client.MutationQueue)
  227. for (;;) {
  228. ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
  229. tag = p.first;
  230. if (!p.second) goto handle_unusual;
  231. switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) {
  232. // int32 last_acknowledged_batch_id = 1;
  233. case 1: {
  234. if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (8 & 0xFF)) {
  235. DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive<
  236. ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>(
  237. input, &last_acknowledged_batch_id_)));
  238. } else {
  239. goto handle_unusual;
  240. }
  241. break;
  242. }
  243. // bytes last_stream_token = 2;
  244. case 2: {
  245. if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) {
  246. DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadBytes(
  247. input, this->mutable_last_stream_token()));
  248. } else {
  249. goto handle_unusual;
  250. }
  251. break;
  252. }
  253. default: {
  254. handle_unusual:
  255. if (tag == 0) {
  256. goto success;
  257. }
  258. DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField(
  259. input, tag, _internal_metadata_.mutable_unknown_fields()));
  260. break;
  261. }
  262. }
  263. }
  264. success:
  265. // @@protoc_insertion_point(parse_success:firestore.client.MutationQueue)
  266. return true;
  267. failure:
  268. // @@protoc_insertion_point(parse_failure:firestore.client.MutationQueue)
  269. return false;
  270. #undef DO_
  271. }
  272. #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
  273. void MutationQueue::SerializeWithCachedSizes(
  274. ::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream* output) const {
  275. // @@protoc_insertion_point(serialize_start:firestore.client.MutationQueue)
  276. ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  277. (void) cached_has_bits;
  278. // int32 last_acknowledged_batch_id = 1;
  279. if (this->last_acknowledged_batch_id() != 0) {
  280. ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32(1, this->last_acknowledged_batch_id(), output);
  281. }
  282. // bytes last_stream_token = 2;
  283. if (this->last_stream_token().size() > 0) {
  284. ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBytesMaybeAliased(
  285. 2, this->last_stream_token(), output);
  286. }
  287. if (_internal_metadata_.have_unknown_fields()) {
  288. ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFields(
  289. _internal_metadata_.unknown_fields(), output);
  290. }
  291. // @@protoc_insertion_point(serialize_end:firestore.client.MutationQueue)
  292. }
  293. ::PROTOBUF_NAMESPACE_ID::uint8* MutationQueue::InternalSerializeWithCachedSizesToArray(
  294. ::PROTOBUF_NAMESPACE_ID::uint8* target) const {
  295. // @@protoc_insertion_point(serialize_to_array_start:firestore.client.MutationQueue)
  296. ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  297. (void) cached_has_bits;
  298. // int32 last_acknowledged_batch_id = 1;
  299. if (this->last_acknowledged_batch_id() != 0) {
  300. target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->last_acknowledged_batch_id(), target);
  301. }
  302. // bytes last_stream_token = 2;
  303. if (this->last_stream_token().size() > 0) {
  304. target =
  305. ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBytesToArray(
  306. 2, this->last_stream_token(), target);
  307. }
  308. if (_internal_metadata_.have_unknown_fields()) {
  309. target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFieldsToArray(
  310. _internal_metadata_.unknown_fields(), target);
  311. }
  312. // @@protoc_insertion_point(serialize_to_array_end:firestore.client.MutationQueue)
  313. return target;
  314. }
  315. size_t MutationQueue::ByteSizeLong() const {
  316. // @@protoc_insertion_point(message_byte_size_start:firestore.client.MutationQueue)
  317. size_t total_size = 0;
  318. if (_internal_metadata_.have_unknown_fields()) {
  319. total_size +=
  320. ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::ComputeUnknownFieldsSize(
  321. _internal_metadata_.unknown_fields());
  322. }
  323. ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  324. // Prevent compiler warnings about cached_has_bits being unused
  325. (void) cached_has_bits;
  326. // bytes last_stream_token = 2;
  327. if (this->last_stream_token().size() > 0) {
  328. total_size += 1 +
  329. ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
  330. this->last_stream_token());
  331. }
  332. // int32 last_acknowledged_batch_id = 1;
  333. if (this->last_acknowledged_batch_id() != 0) {
  334. total_size += 1 +
  335. ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
  336. this->last_acknowledged_batch_id());
  337. }
  338. int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  339. SetCachedSize(cached_size);
  340. return total_size;
  341. }
  342. void MutationQueue::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
  343. // @@protoc_insertion_point(generalized_merge_from_start:firestore.client.MutationQueue)
  344. GOOGLE_DCHECK_NE(&from, this);
  345. const MutationQueue* source =
  346. ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<MutationQueue>(
  347. &from);
  348. if (source == nullptr) {
  349. // @@protoc_insertion_point(generalized_merge_from_cast_fail:firestore.client.MutationQueue)
  350. ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
  351. } else {
  352. // @@protoc_insertion_point(generalized_merge_from_cast_success:firestore.client.MutationQueue)
  353. MergeFrom(*source);
  354. }
  355. }
  356. void MutationQueue::MergeFrom(const MutationQueue& from) {
  357. // @@protoc_insertion_point(class_specific_merge_from_start:firestore.client.MutationQueue)
  358. GOOGLE_DCHECK_NE(&from, this);
  359. _internal_metadata_.MergeFrom(from._internal_metadata_);
  360. ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  361. (void) cached_has_bits;
  362. if (from.last_stream_token().size() > 0) {
  363. last_stream_token_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.last_stream_token_);
  364. }
  365. if (from.last_acknowledged_batch_id() != 0) {
  366. set_last_acknowledged_batch_id(from.last_acknowledged_batch_id());
  367. }
  368. }
  369. void MutationQueue::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
  370. // @@protoc_insertion_point(generalized_copy_from_start:firestore.client.MutationQueue)
  371. if (&from == this) return;
  372. Clear();
  373. MergeFrom(from);
  374. }
  375. void MutationQueue::CopyFrom(const MutationQueue& from) {
  376. // @@protoc_insertion_point(class_specific_copy_from_start:firestore.client.MutationQueue)
  377. if (&from == this) return;
  378. Clear();
  379. MergeFrom(from);
  380. }
  381. bool MutationQueue::IsInitialized() const {
  382. return true;
  383. }
  384. void MutationQueue::InternalSwap(MutationQueue* other) {
  385. using std::swap;
  386. _internal_metadata_.Swap(&other->_internal_metadata_);
  387. last_stream_token_.Swap(&other->last_stream_token_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
  388. GetArenaNoVirtual());
  389. swap(last_acknowledged_batch_id_, other->last_acknowledged_batch_id_);
  390. }
  391. ::PROTOBUF_NAMESPACE_ID::Metadata MutationQueue::GetMetadata() const {
  392. return GetMetadataStatic();
  393. }
  394. // ===================================================================
  395. void WriteBatch::InitAsDefaultInstance() {
  396. ::firestore::client::_WriteBatch_default_instance_._instance.get_mutable()->local_write_time_ = const_cast< PROTOBUF_NAMESPACE_ID::Timestamp*>(
  397. PROTOBUF_NAMESPACE_ID::Timestamp::internal_default_instance());
  398. }
  399. class WriteBatch::_Internal {
  400. public:
  401. static const PROTOBUF_NAMESPACE_ID::Timestamp& local_write_time(const WriteBatch* msg);
  402. };
  403. const PROTOBUF_NAMESPACE_ID::Timestamp&
  404. WriteBatch::_Internal::local_write_time(const WriteBatch* msg) {
  405. return *msg->local_write_time_;
  406. }
  407. void WriteBatch::clear_writes() {
  408. writes_.Clear();
  409. }
  410. void WriteBatch::clear_local_write_time() {
  411. if (GetArenaNoVirtual() == nullptr && local_write_time_ != nullptr) {
  412. delete local_write_time_;
  413. }
  414. local_write_time_ = nullptr;
  415. }
  416. void WriteBatch::clear_base_writes() {
  417. base_writes_.Clear();
  418. }
  419. WriteBatch::WriteBatch()
  420. : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
  421. SharedCtor();
  422. // @@protoc_insertion_point(constructor:firestore.client.WriteBatch)
  423. }
  424. WriteBatch::WriteBatch(const WriteBatch& from)
  425. : ::PROTOBUF_NAMESPACE_ID::Message(),
  426. _internal_metadata_(nullptr),
  427. writes_(from.writes_),
  428. base_writes_(from.base_writes_) {
  429. _internal_metadata_.MergeFrom(from._internal_metadata_);
  430. if (from.has_local_write_time()) {
  431. local_write_time_ = new PROTOBUF_NAMESPACE_ID::Timestamp(*from.local_write_time_);
  432. } else {
  433. local_write_time_ = nullptr;
  434. }
  435. batch_id_ = from.batch_id_;
  436. // @@protoc_insertion_point(copy_constructor:firestore.client.WriteBatch)
  437. }
  438. void WriteBatch::SharedCtor() {
  439. ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_WriteBatch_firestore_2flocal_2fmutation_2eproto.base);
  440. ::memset(&local_write_time_, 0, static_cast<size_t>(
  441. reinterpret_cast<char*>(&batch_id_) -
  442. reinterpret_cast<char*>(&local_write_time_)) + sizeof(batch_id_));
  443. }
  444. WriteBatch::~WriteBatch() {
  445. // @@protoc_insertion_point(destructor:firestore.client.WriteBatch)
  446. SharedDtor();
  447. }
  448. void WriteBatch::SharedDtor() {
  449. if (this != internal_default_instance()) delete local_write_time_;
  450. }
  451. void WriteBatch::SetCachedSize(int size) const {
  452. _cached_size_.Set(size);
  453. }
  454. const WriteBatch& WriteBatch::default_instance() {
  455. ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_WriteBatch_firestore_2flocal_2fmutation_2eproto.base);
  456. return *internal_default_instance();
  457. }
  458. void WriteBatch::Clear() {
  459. // @@protoc_insertion_point(message_clear_start:firestore.client.WriteBatch)
  460. ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  461. // Prevent compiler warnings about cached_has_bits being unused
  462. (void) cached_has_bits;
  463. writes_.Clear();
  464. base_writes_.Clear();
  465. if (GetArenaNoVirtual() == nullptr && local_write_time_ != nullptr) {
  466. delete local_write_time_;
  467. }
  468. local_write_time_ = nullptr;
  469. batch_id_ = 0;
  470. _internal_metadata_.Clear();
  471. }
  472. #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
  473. const char* WriteBatch::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
  474. #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  475. while (!ctx->Done(&ptr)) {
  476. ::PROTOBUF_NAMESPACE_ID::uint32 tag;
  477. ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
  478. CHK_(ptr);
  479. switch (tag >> 3) {
  480. // int32 batch_id = 1;
  481. case 1:
  482. if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
  483. batch_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr);
  484. CHK_(ptr);
  485. } else goto handle_unusual;
  486. continue;
  487. // repeated .google.firestore.v1.Write writes = 2;
  488. case 2:
  489. if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
  490. ptr -= 1;
  491. do {
  492. ptr += 1;
  493. ptr = ctx->ParseMessage(add_writes(), ptr);
  494. CHK_(ptr);
  495. if (!ctx->DataAvailable(ptr)) break;
  496. } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 18);
  497. } else goto handle_unusual;
  498. continue;
  499. // .google.protobuf.Timestamp local_write_time = 3;
  500. case 3:
  501. if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
  502. ptr = ctx->ParseMessage(mutable_local_write_time(), ptr);
  503. CHK_(ptr);
  504. } else goto handle_unusual;
  505. continue;
  506. // repeated .google.firestore.v1.Write base_writes = 4;
  507. case 4:
  508. if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
  509. ptr -= 1;
  510. do {
  511. ptr += 1;
  512. ptr = ctx->ParseMessage(add_base_writes(), ptr);
  513. CHK_(ptr);
  514. if (!ctx->DataAvailable(ptr)) break;
  515. } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 34);
  516. } else goto handle_unusual;
  517. continue;
  518. default: {
  519. handle_unusual:
  520. if ((tag & 7) == 4 || tag == 0) {
  521. ctx->SetLastTag(tag);
  522. goto success;
  523. }
  524. ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
  525. CHK_(ptr != nullptr);
  526. continue;
  527. }
  528. } // switch
  529. } // while
  530. success:
  531. return ptr;
  532. failure:
  533. ptr = nullptr;
  534. goto success;
  535. #undef CHK_
  536. }
  537. #else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
  538. bool WriteBatch::MergePartialFromCodedStream(
  539. ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) {
  540. #define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure
  541. ::PROTOBUF_NAMESPACE_ID::uint32 tag;
  542. // @@protoc_insertion_point(parse_start:firestore.client.WriteBatch)
  543. for (;;) {
  544. ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
  545. tag = p.first;
  546. if (!p.second) goto handle_unusual;
  547. switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) {
  548. // int32 batch_id = 1;
  549. case 1: {
  550. if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (8 & 0xFF)) {
  551. DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive<
  552. ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>(
  553. input, &batch_id_)));
  554. } else {
  555. goto handle_unusual;
  556. }
  557. break;
  558. }
  559. // repeated .google.firestore.v1.Write writes = 2;
  560. case 2: {
  561. if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) {
  562. DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage(
  563. input, add_writes()));
  564. } else {
  565. goto handle_unusual;
  566. }
  567. break;
  568. }
  569. // .google.protobuf.Timestamp local_write_time = 3;
  570. case 3: {
  571. if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (26 & 0xFF)) {
  572. DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage(
  573. input, mutable_local_write_time()));
  574. } else {
  575. goto handle_unusual;
  576. }
  577. break;
  578. }
  579. // repeated .google.firestore.v1.Write base_writes = 4;
  580. case 4: {
  581. if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (34 & 0xFF)) {
  582. DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage(
  583. input, add_base_writes()));
  584. } else {
  585. goto handle_unusual;
  586. }
  587. break;
  588. }
  589. default: {
  590. handle_unusual:
  591. if (tag == 0) {
  592. goto success;
  593. }
  594. DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField(
  595. input, tag, _internal_metadata_.mutable_unknown_fields()));
  596. break;
  597. }
  598. }
  599. }
  600. success:
  601. // @@protoc_insertion_point(parse_success:firestore.client.WriteBatch)
  602. return true;
  603. failure:
  604. // @@protoc_insertion_point(parse_failure:firestore.client.WriteBatch)
  605. return false;
  606. #undef DO_
  607. }
  608. #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
  609. void WriteBatch::SerializeWithCachedSizes(
  610. ::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream* output) const {
  611. // @@protoc_insertion_point(serialize_start:firestore.client.WriteBatch)
  612. ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  613. (void) cached_has_bits;
  614. // int32 batch_id = 1;
  615. if (this->batch_id() != 0) {
  616. ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32(1, this->batch_id(), output);
  617. }
  618. // repeated .google.firestore.v1.Write writes = 2;
  619. for (unsigned int i = 0,
  620. n = static_cast<unsigned int>(this->writes_size()); i < n; i++) {
  621. ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteMessageMaybeToArray(
  622. 2,
  623. this->writes(static_cast<int>(i)),
  624. output);
  625. }
  626. // .google.protobuf.Timestamp local_write_time = 3;
  627. if (this->has_local_write_time()) {
  628. ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteMessageMaybeToArray(
  629. 3, _Internal::local_write_time(this), output);
  630. }
  631. // repeated .google.firestore.v1.Write base_writes = 4;
  632. for (unsigned int i = 0,
  633. n = static_cast<unsigned int>(this->base_writes_size()); i < n; i++) {
  634. ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteMessageMaybeToArray(
  635. 4,
  636. this->base_writes(static_cast<int>(i)),
  637. output);
  638. }
  639. if (_internal_metadata_.have_unknown_fields()) {
  640. ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFields(
  641. _internal_metadata_.unknown_fields(), output);
  642. }
  643. // @@protoc_insertion_point(serialize_end:firestore.client.WriteBatch)
  644. }
  645. ::PROTOBUF_NAMESPACE_ID::uint8* WriteBatch::InternalSerializeWithCachedSizesToArray(
  646. ::PROTOBUF_NAMESPACE_ID::uint8* target) const {
  647. // @@protoc_insertion_point(serialize_to_array_start:firestore.client.WriteBatch)
  648. ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  649. (void) cached_has_bits;
  650. // int32 batch_id = 1;
  651. if (this->batch_id() != 0) {
  652. target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->batch_id(), target);
  653. }
  654. // repeated .google.firestore.v1.Write writes = 2;
  655. for (unsigned int i = 0,
  656. n = static_cast<unsigned int>(this->writes_size()); i < n; i++) {
  657. target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
  658. InternalWriteMessageToArray(
  659. 2, this->writes(static_cast<int>(i)), target);
  660. }
  661. // .google.protobuf.Timestamp local_write_time = 3;
  662. if (this->has_local_write_time()) {
  663. target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
  664. InternalWriteMessageToArray(
  665. 3, _Internal::local_write_time(this), target);
  666. }
  667. // repeated .google.firestore.v1.Write base_writes = 4;
  668. for (unsigned int i = 0,
  669. n = static_cast<unsigned int>(this->base_writes_size()); i < n; i++) {
  670. target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
  671. InternalWriteMessageToArray(
  672. 4, this->base_writes(static_cast<int>(i)), target);
  673. }
  674. if (_internal_metadata_.have_unknown_fields()) {
  675. target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFieldsToArray(
  676. _internal_metadata_.unknown_fields(), target);
  677. }
  678. // @@protoc_insertion_point(serialize_to_array_end:firestore.client.WriteBatch)
  679. return target;
  680. }
  681. size_t WriteBatch::ByteSizeLong() const {
  682. // @@protoc_insertion_point(message_byte_size_start:firestore.client.WriteBatch)
  683. size_t total_size = 0;
  684. if (_internal_metadata_.have_unknown_fields()) {
  685. total_size +=
  686. ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::ComputeUnknownFieldsSize(
  687. _internal_metadata_.unknown_fields());
  688. }
  689. ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  690. // Prevent compiler warnings about cached_has_bits being unused
  691. (void) cached_has_bits;
  692. // repeated .google.firestore.v1.Write writes = 2;
  693. {
  694. unsigned int count = static_cast<unsigned int>(this->writes_size());
  695. total_size += 1UL * count;
  696. for (unsigned int i = 0; i < count; i++) {
  697. total_size +=
  698. ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
  699. this->writes(static_cast<int>(i)));
  700. }
  701. }
  702. // repeated .google.firestore.v1.Write base_writes = 4;
  703. {
  704. unsigned int count = static_cast<unsigned int>(this->base_writes_size());
  705. total_size += 1UL * count;
  706. for (unsigned int i = 0; i < count; i++) {
  707. total_size +=
  708. ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
  709. this->base_writes(static_cast<int>(i)));
  710. }
  711. }
  712. // .google.protobuf.Timestamp local_write_time = 3;
  713. if (this->has_local_write_time()) {
  714. total_size += 1 +
  715. ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
  716. *local_write_time_);
  717. }
  718. // int32 batch_id = 1;
  719. if (this->batch_id() != 0) {
  720. total_size += 1 +
  721. ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
  722. this->batch_id());
  723. }
  724. int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  725. SetCachedSize(cached_size);
  726. return total_size;
  727. }
  728. void WriteBatch::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
  729. // @@protoc_insertion_point(generalized_merge_from_start:firestore.client.WriteBatch)
  730. GOOGLE_DCHECK_NE(&from, this);
  731. const WriteBatch* source =
  732. ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<WriteBatch>(
  733. &from);
  734. if (source == nullptr) {
  735. // @@protoc_insertion_point(generalized_merge_from_cast_fail:firestore.client.WriteBatch)
  736. ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
  737. } else {
  738. // @@protoc_insertion_point(generalized_merge_from_cast_success:firestore.client.WriteBatch)
  739. MergeFrom(*source);
  740. }
  741. }
  742. void WriteBatch::MergeFrom(const WriteBatch& from) {
  743. // @@protoc_insertion_point(class_specific_merge_from_start:firestore.client.WriteBatch)
  744. GOOGLE_DCHECK_NE(&from, this);
  745. _internal_metadata_.MergeFrom(from._internal_metadata_);
  746. ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  747. (void) cached_has_bits;
  748. writes_.MergeFrom(from.writes_);
  749. base_writes_.MergeFrom(from.base_writes_);
  750. if (from.has_local_write_time()) {
  751. mutable_local_write_time()->PROTOBUF_NAMESPACE_ID::Timestamp::MergeFrom(from.local_write_time());
  752. }
  753. if (from.batch_id() != 0) {
  754. set_batch_id(from.batch_id());
  755. }
  756. }
  757. void WriteBatch::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
  758. // @@protoc_insertion_point(generalized_copy_from_start:firestore.client.WriteBatch)
  759. if (&from == this) return;
  760. Clear();
  761. MergeFrom(from);
  762. }
  763. void WriteBatch::CopyFrom(const WriteBatch& from) {
  764. // @@protoc_insertion_point(class_specific_copy_from_start:firestore.client.WriteBatch)
  765. if (&from == this) return;
  766. Clear();
  767. MergeFrom(from);
  768. }
  769. bool WriteBatch::IsInitialized() const {
  770. return true;
  771. }
  772. void WriteBatch::InternalSwap(WriteBatch* other) {
  773. using std::swap;
  774. _internal_metadata_.Swap(&other->_internal_metadata_);
  775. CastToBase(&writes_)->InternalSwap(CastToBase(&other->writes_));
  776. CastToBase(&base_writes_)->InternalSwap(CastToBase(&other->base_writes_));
  777. swap(local_write_time_, other->local_write_time_);
  778. swap(batch_id_, other->batch_id_);
  779. }
  780. ::PROTOBUF_NAMESPACE_ID::Metadata WriteBatch::GetMetadata() const {
  781. return GetMetadataStatic();
  782. }
  783. // @@protoc_insertion_point(namespace_scope)
  784. } // namespace client
  785. } // namespace firestore
  786. PROTOBUF_NAMESPACE_OPEN
  787. template<> PROTOBUF_NOINLINE ::firestore::client::MutationQueue* Arena::CreateMaybeMessage< ::firestore::client::MutationQueue >(Arena* arena) {
  788. return Arena::CreateInternal< ::firestore::client::MutationQueue >(arena);
  789. }
  790. template<> PROTOBUF_NOINLINE ::firestore::client::WriteBatch* Arena::CreateMaybeMessage< ::firestore::client::WriteBatch >(Arena* arena) {
  791. return Arena::CreateInternal< ::firestore::client::WriteBatch >(arena);
  792. }
  793. PROTOBUF_NAMESPACE_CLOSE
  794. // @@protoc_insertion_point(global_scope)
  795. #include <google/protobuf/port_undef.inc>