mutation.pb.cc 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684
  1. /*
  2. * Copyright 2021 Google LLC
  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/io/coded_stream.h>
  21. #include <google/protobuf/extension_set.h>
  22. #include <google/protobuf/wire_format_lite.h>
  23. #include <google/protobuf/descriptor.h>
  24. #include <google/protobuf/generated_message_reflection.h>
  25. #include <google/protobuf/reflection_ops.h>
  26. #include <google/protobuf/wire_format.h>
  27. // @@protoc_insertion_point(includes)
  28. #include <google/protobuf/port_def.inc>
  29. extern PROTOBUF_INTERNAL_EXPORT_google_2ffirestore_2fv1_2fwrite_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<5> scc_info_Write_google_2ffirestore_2fv1_2fwrite_2eproto;
  30. extern PROTOBUF_INTERNAL_EXPORT_google_2fprotobuf_2ftimestamp_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Timestamp_google_2fprotobuf_2ftimestamp_2eproto;
  31. namespace firestore {
  32. namespace client {
  33. class MutationQueueDefaultTypeInternal {
  34. public:
  35. ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<MutationQueue> _instance;
  36. } _MutationQueue_default_instance_;
  37. class WriteBatchDefaultTypeInternal {
  38. public:
  39. ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<WriteBatch> _instance;
  40. } _WriteBatch_default_instance_;
  41. } // namespace client
  42. } // namespace firestore
  43. static void InitDefaultsscc_info_MutationQueue_firestore_2flocal_2fmutation_2eproto() {
  44. GOOGLE_PROTOBUF_VERIFY_VERSION;
  45. {
  46. void* ptr = &::firestore::client::_MutationQueue_default_instance_;
  47. new (ptr) ::firestore::client::MutationQueue();
  48. ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
  49. }
  50. ::firestore::client::MutationQueue::InitAsDefaultInstance();
  51. }
  52. ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_MutationQueue_firestore_2flocal_2fmutation_2eproto =
  53. {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_MutationQueue_firestore_2flocal_2fmutation_2eproto}, {}};
  54. static void InitDefaultsscc_info_WriteBatch_firestore_2flocal_2fmutation_2eproto() {
  55. GOOGLE_PROTOBUF_VERIFY_VERSION;
  56. {
  57. void* ptr = &::firestore::client::_WriteBatch_default_instance_;
  58. new (ptr) ::firestore::client::WriteBatch();
  59. ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
  60. }
  61. ::firestore::client::WriteBatch::InitAsDefaultInstance();
  62. }
  63. ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<2> scc_info_WriteBatch_firestore_2flocal_2fmutation_2eproto =
  64. {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 2, 0, InitDefaultsscc_info_WriteBatch_firestore_2flocal_2fmutation_2eproto}, {
  65. &scc_info_Write_google_2ffirestore_2fv1_2fwrite_2eproto.base,
  66. &scc_info_Timestamp_google_2fprotobuf_2ftimestamp_2eproto.base,}};
  67. static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_firestore_2flocal_2fmutation_2eproto[2];
  68. static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_firestore_2flocal_2fmutation_2eproto = nullptr;
  69. static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_firestore_2flocal_2fmutation_2eproto = nullptr;
  70. const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_firestore_2flocal_2fmutation_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
  71. ~0u, // no _has_bits_
  72. PROTOBUF_FIELD_OFFSET(::firestore::client::MutationQueue, _internal_metadata_),
  73. ~0u, // no _extensions_
  74. ~0u, // no _oneof_case_
  75. ~0u, // no _weak_field_map_
  76. PROTOBUF_FIELD_OFFSET(::firestore::client::MutationQueue, last_acknowledged_batch_id_),
  77. PROTOBUF_FIELD_OFFSET(::firestore::client::MutationQueue, last_stream_token_),
  78. ~0u, // no _has_bits_
  79. PROTOBUF_FIELD_OFFSET(::firestore::client::WriteBatch, _internal_metadata_),
  80. ~0u, // no _extensions_
  81. ~0u, // no _oneof_case_
  82. ~0u, // no _weak_field_map_
  83. PROTOBUF_FIELD_OFFSET(::firestore::client::WriteBatch, batch_id_),
  84. PROTOBUF_FIELD_OFFSET(::firestore::client::WriteBatch, writes_),
  85. PROTOBUF_FIELD_OFFSET(::firestore::client::WriteBatch, local_write_time_),
  86. PROTOBUF_FIELD_OFFSET(::firestore::client::WriteBatch, base_writes_),
  87. };
  88. static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
  89. { 0, -1, sizeof(::firestore::client::MutationQueue)},
  90. { 7, -1, sizeof(::firestore::client::WriteBatch)},
  91. };
  92. static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = {
  93. reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::firestore::client::_MutationQueue_default_instance_),
  94. reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::firestore::client::_WriteBatch_default_instance_),
  95. };
  96. const char descriptor_table_protodef_firestore_2flocal_2fmutation_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
  97. "\n\036firestore/local/mutation.proto\022\020firest"
  98. "ore.client\032\037google/firestore/v1/write.pr"
  99. "oto\032\037google/protobuf/timestamp.proto\"N\n\r"
  100. "MutationQueue\022\"\n\032last_acknowledged_batch"
  101. "_id\030\001 \001(\005\022\031\n\021last_stream_token\030\002 \001(\014\"\261\001\n"
  102. "\nWriteBatch\022\020\n\010batch_id\030\001 \001(\005\022*\n\006writes\030"
  103. "\002 \003(\0132\032.google.firestore.v1.Write\0224\n\020loc"
  104. "al_write_time\030\003 \001(\0132\032.google.protobuf.Ti"
  105. "mestamp\022/\n\013base_writes\030\004 \003(\0132\032.google.fi"
  106. "restore.v1.WriteB/\n#com.google.firebase."
  107. "firestore.protoP\001\242\002\005FSTPBb\006proto3"
  108. ;
  109. static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_firestore_2flocal_2fmutation_2eproto_deps[2] = {
  110. &::descriptor_table_google_2ffirestore_2fv1_2fwrite_2eproto,
  111. &::descriptor_table_google_2fprotobuf_2ftimestamp_2eproto,
  112. };
  113. static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_firestore_2flocal_2fmutation_2eproto_sccs[2] = {
  114. &scc_info_MutationQueue_firestore_2flocal_2fmutation_2eproto.base,
  115. &scc_info_WriteBatch_firestore_2flocal_2fmutation_2eproto.base,
  116. };
  117. static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_firestore_2flocal_2fmutation_2eproto_once;
  118. static bool descriptor_table_firestore_2flocal_2fmutation_2eproto_initialized = false;
  119. const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_firestore_2flocal_2fmutation_2eproto = {
  120. &descriptor_table_firestore_2flocal_2fmutation_2eproto_initialized, descriptor_table_protodef_firestore_2flocal_2fmutation_2eproto, "firestore/local/mutation.proto", 433,
  121. &descriptor_table_firestore_2flocal_2fmutation_2eproto_once, descriptor_table_firestore_2flocal_2fmutation_2eproto_sccs, descriptor_table_firestore_2flocal_2fmutation_2eproto_deps, 2, 2,
  122. schemas, file_default_instances, TableStruct_firestore_2flocal_2fmutation_2eproto::offsets,
  123. file_level_metadata_firestore_2flocal_2fmutation_2eproto, 2, file_level_enum_descriptors_firestore_2flocal_2fmutation_2eproto, file_level_service_descriptors_firestore_2flocal_2fmutation_2eproto,
  124. };
  125. // Force running AddDescriptors() at dynamic initialization time.
  126. static bool dynamic_init_dummy_firestore_2flocal_2fmutation_2eproto = ( ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_firestore_2flocal_2fmutation_2eproto), true);
  127. namespace firestore {
  128. namespace client {
  129. // ===================================================================
  130. void MutationQueue::InitAsDefaultInstance() {
  131. }
  132. class MutationQueue::_Internal {
  133. public:
  134. };
  135. MutationQueue::MutationQueue()
  136. : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
  137. SharedCtor();
  138. // @@protoc_insertion_point(constructor:firestore.client.MutationQueue)
  139. }
  140. MutationQueue::MutationQueue(const MutationQueue& from)
  141. : ::PROTOBUF_NAMESPACE_ID::Message(),
  142. _internal_metadata_(nullptr) {
  143. _internal_metadata_.MergeFrom(from._internal_metadata_);
  144. last_stream_token_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  145. if (!from._internal_last_stream_token().empty()) {
  146. last_stream_token_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.last_stream_token_);
  147. }
  148. last_acknowledged_batch_id_ = from.last_acknowledged_batch_id_;
  149. // @@protoc_insertion_point(copy_constructor:firestore.client.MutationQueue)
  150. }
  151. void MutationQueue::SharedCtor() {
  152. ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_MutationQueue_firestore_2flocal_2fmutation_2eproto.base);
  153. last_stream_token_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  154. last_acknowledged_batch_id_ = 0;
  155. }
  156. MutationQueue::~MutationQueue() {
  157. // @@protoc_insertion_point(destructor:firestore.client.MutationQueue)
  158. SharedDtor();
  159. }
  160. void MutationQueue::SharedDtor() {
  161. last_stream_token_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  162. }
  163. void MutationQueue::SetCachedSize(int size) const {
  164. _cached_size_.Set(size);
  165. }
  166. const MutationQueue& MutationQueue::default_instance() {
  167. ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_MutationQueue_firestore_2flocal_2fmutation_2eproto.base);
  168. return *internal_default_instance();
  169. }
  170. void MutationQueue::Clear() {
  171. // @@protoc_insertion_point(message_clear_start:firestore.client.MutationQueue)
  172. ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  173. // Prevent compiler warnings about cached_has_bits being unused
  174. (void) cached_has_bits;
  175. last_stream_token_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  176. last_acknowledged_batch_id_ = 0;
  177. _internal_metadata_.Clear();
  178. }
  179. const char* MutationQueue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
  180. #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  181. while (!ctx->Done(&ptr)) {
  182. ::PROTOBUF_NAMESPACE_ID::uint32 tag;
  183. ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
  184. CHK_(ptr);
  185. switch (tag >> 3) {
  186. // int32 last_acknowledged_batch_id = 1;
  187. case 1:
  188. if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
  189. last_acknowledged_batch_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr);
  190. CHK_(ptr);
  191. } else goto handle_unusual;
  192. continue;
  193. // bytes last_stream_token = 2;
  194. case 2:
  195. if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
  196. auto str = _internal_mutable_last_stream_token();
  197. ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
  198. CHK_(ptr);
  199. } else goto handle_unusual;
  200. continue;
  201. default: {
  202. handle_unusual:
  203. if ((tag & 7) == 4 || tag == 0) {
  204. ctx->SetLastTag(tag);
  205. goto success;
  206. }
  207. ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
  208. CHK_(ptr != nullptr);
  209. continue;
  210. }
  211. } // switch
  212. } // while
  213. success:
  214. return ptr;
  215. failure:
  216. ptr = nullptr;
  217. goto success;
  218. #undef CHK_
  219. }
  220. ::PROTOBUF_NAMESPACE_ID::uint8* MutationQueue::_InternalSerialize(
  221. ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  222. // @@protoc_insertion_point(serialize_to_array_start:firestore.client.MutationQueue)
  223. ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  224. (void) cached_has_bits;
  225. // int32 last_acknowledged_batch_id = 1;
  226. if (this->last_acknowledged_batch_id() != 0) {
  227. target = stream->EnsureSpace(target);
  228. target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_last_acknowledged_batch_id(), target);
  229. }
  230. // bytes last_stream_token = 2;
  231. if (this->last_stream_token().size() > 0) {
  232. target = stream->WriteBytesMaybeAliased(
  233. 2, this->_internal_last_stream_token(), target);
  234. }
  235. if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
  236. target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
  237. _internal_metadata_.unknown_fields(), target, stream);
  238. }
  239. // @@protoc_insertion_point(serialize_to_array_end:firestore.client.MutationQueue)
  240. return target;
  241. }
  242. size_t MutationQueue::ByteSizeLong() const {
  243. // @@protoc_insertion_point(message_byte_size_start:firestore.client.MutationQueue)
  244. size_t total_size = 0;
  245. ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  246. // Prevent compiler warnings about cached_has_bits being unused
  247. (void) cached_has_bits;
  248. // bytes last_stream_token = 2;
  249. if (this->last_stream_token().size() > 0) {
  250. total_size += 1 +
  251. ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
  252. this->_internal_last_stream_token());
  253. }
  254. // int32 last_acknowledged_batch_id = 1;
  255. if (this->last_acknowledged_batch_id() != 0) {
  256. total_size += 1 +
  257. ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
  258. this->_internal_last_acknowledged_batch_id());
  259. }
  260. if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
  261. return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
  262. _internal_metadata_, total_size, &_cached_size_);
  263. }
  264. int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  265. SetCachedSize(cached_size);
  266. return total_size;
  267. }
  268. void MutationQueue::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
  269. // @@protoc_insertion_point(generalized_merge_from_start:firestore.client.MutationQueue)
  270. GOOGLE_DCHECK_NE(&from, this);
  271. const MutationQueue* source =
  272. ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<MutationQueue>(
  273. &from);
  274. if (source == nullptr) {
  275. // @@protoc_insertion_point(generalized_merge_from_cast_fail:firestore.client.MutationQueue)
  276. ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
  277. } else {
  278. // @@protoc_insertion_point(generalized_merge_from_cast_success:firestore.client.MutationQueue)
  279. MergeFrom(*source);
  280. }
  281. }
  282. void MutationQueue::MergeFrom(const MutationQueue& from) {
  283. // @@protoc_insertion_point(class_specific_merge_from_start:firestore.client.MutationQueue)
  284. GOOGLE_DCHECK_NE(&from, this);
  285. _internal_metadata_.MergeFrom(from._internal_metadata_);
  286. ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  287. (void) cached_has_bits;
  288. if (from.last_stream_token().size() > 0) {
  289. last_stream_token_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.last_stream_token_);
  290. }
  291. if (from.last_acknowledged_batch_id() != 0) {
  292. _internal_set_last_acknowledged_batch_id(from._internal_last_acknowledged_batch_id());
  293. }
  294. }
  295. void MutationQueue::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
  296. // @@protoc_insertion_point(generalized_copy_from_start:firestore.client.MutationQueue)
  297. if (&from == this) return;
  298. Clear();
  299. MergeFrom(from);
  300. }
  301. void MutationQueue::CopyFrom(const MutationQueue& from) {
  302. // @@protoc_insertion_point(class_specific_copy_from_start:firestore.client.MutationQueue)
  303. if (&from == this) return;
  304. Clear();
  305. MergeFrom(from);
  306. }
  307. bool MutationQueue::IsInitialized() const {
  308. return true;
  309. }
  310. void MutationQueue::InternalSwap(MutationQueue* other) {
  311. using std::swap;
  312. _internal_metadata_.Swap(&other->_internal_metadata_);
  313. last_stream_token_.Swap(&other->last_stream_token_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
  314. GetArenaNoVirtual());
  315. swap(last_acknowledged_batch_id_, other->last_acknowledged_batch_id_);
  316. }
  317. ::PROTOBUF_NAMESPACE_ID::Metadata MutationQueue::GetMetadata() const {
  318. return GetMetadataStatic();
  319. }
  320. // ===================================================================
  321. void WriteBatch::InitAsDefaultInstance() {
  322. ::firestore::client::_WriteBatch_default_instance_._instance.get_mutable()->local_write_time_ = const_cast< PROTOBUF_NAMESPACE_ID::Timestamp*>(
  323. PROTOBUF_NAMESPACE_ID::Timestamp::internal_default_instance());
  324. }
  325. class WriteBatch::_Internal {
  326. public:
  327. static const PROTOBUF_NAMESPACE_ID::Timestamp& local_write_time(const WriteBatch* msg);
  328. };
  329. const PROTOBUF_NAMESPACE_ID::Timestamp&
  330. WriteBatch::_Internal::local_write_time(const WriteBatch* msg) {
  331. return *msg->local_write_time_;
  332. }
  333. void WriteBatch::clear_writes() {
  334. writes_.Clear();
  335. }
  336. void WriteBatch::clear_local_write_time() {
  337. if (GetArenaNoVirtual() == nullptr && local_write_time_ != nullptr) {
  338. delete local_write_time_;
  339. }
  340. local_write_time_ = nullptr;
  341. }
  342. void WriteBatch::clear_base_writes() {
  343. base_writes_.Clear();
  344. }
  345. WriteBatch::WriteBatch()
  346. : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
  347. SharedCtor();
  348. // @@protoc_insertion_point(constructor:firestore.client.WriteBatch)
  349. }
  350. WriteBatch::WriteBatch(const WriteBatch& from)
  351. : ::PROTOBUF_NAMESPACE_ID::Message(),
  352. _internal_metadata_(nullptr),
  353. writes_(from.writes_),
  354. base_writes_(from.base_writes_) {
  355. _internal_metadata_.MergeFrom(from._internal_metadata_);
  356. if (from._internal_has_local_write_time()) {
  357. local_write_time_ = new PROTOBUF_NAMESPACE_ID::Timestamp(*from.local_write_time_);
  358. } else {
  359. local_write_time_ = nullptr;
  360. }
  361. batch_id_ = from.batch_id_;
  362. // @@protoc_insertion_point(copy_constructor:firestore.client.WriteBatch)
  363. }
  364. void WriteBatch::SharedCtor() {
  365. ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_WriteBatch_firestore_2flocal_2fmutation_2eproto.base);
  366. ::memset(&local_write_time_, 0, static_cast<size_t>(
  367. reinterpret_cast<char*>(&batch_id_) -
  368. reinterpret_cast<char*>(&local_write_time_)) + sizeof(batch_id_));
  369. }
  370. WriteBatch::~WriteBatch() {
  371. // @@protoc_insertion_point(destructor:firestore.client.WriteBatch)
  372. SharedDtor();
  373. }
  374. void WriteBatch::SharedDtor() {
  375. if (this != internal_default_instance()) delete local_write_time_;
  376. }
  377. void WriteBatch::SetCachedSize(int size) const {
  378. _cached_size_.Set(size);
  379. }
  380. const WriteBatch& WriteBatch::default_instance() {
  381. ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_WriteBatch_firestore_2flocal_2fmutation_2eproto.base);
  382. return *internal_default_instance();
  383. }
  384. void WriteBatch::Clear() {
  385. // @@protoc_insertion_point(message_clear_start:firestore.client.WriteBatch)
  386. ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  387. // Prevent compiler warnings about cached_has_bits being unused
  388. (void) cached_has_bits;
  389. writes_.Clear();
  390. base_writes_.Clear();
  391. if (GetArenaNoVirtual() == nullptr && local_write_time_ != nullptr) {
  392. delete local_write_time_;
  393. }
  394. local_write_time_ = nullptr;
  395. batch_id_ = 0;
  396. _internal_metadata_.Clear();
  397. }
  398. const char* WriteBatch::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
  399. #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  400. while (!ctx->Done(&ptr)) {
  401. ::PROTOBUF_NAMESPACE_ID::uint32 tag;
  402. ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
  403. CHK_(ptr);
  404. switch (tag >> 3) {
  405. // int32 batch_id = 1;
  406. case 1:
  407. if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
  408. batch_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr);
  409. CHK_(ptr);
  410. } else goto handle_unusual;
  411. continue;
  412. // repeated .google.firestore.v1.Write writes = 2;
  413. case 2:
  414. if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
  415. ptr -= 1;
  416. do {
  417. ptr += 1;
  418. ptr = ctx->ParseMessage(_internal_add_writes(), ptr);
  419. CHK_(ptr);
  420. if (!ctx->DataAvailable(ptr)) break;
  421. } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr));
  422. } else goto handle_unusual;
  423. continue;
  424. // .google.protobuf.Timestamp local_write_time = 3;
  425. case 3:
  426. if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
  427. ptr = ctx->ParseMessage(_internal_mutable_local_write_time(), ptr);
  428. CHK_(ptr);
  429. } else goto handle_unusual;
  430. continue;
  431. // repeated .google.firestore.v1.Write base_writes = 4;
  432. case 4:
  433. if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
  434. ptr -= 1;
  435. do {
  436. ptr += 1;
  437. ptr = ctx->ParseMessage(_internal_add_base_writes(), ptr);
  438. CHK_(ptr);
  439. if (!ctx->DataAvailable(ptr)) break;
  440. } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<34>(ptr));
  441. } else goto handle_unusual;
  442. continue;
  443. default: {
  444. handle_unusual:
  445. if ((tag & 7) == 4 || tag == 0) {
  446. ctx->SetLastTag(tag);
  447. goto success;
  448. }
  449. ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
  450. CHK_(ptr != nullptr);
  451. continue;
  452. }
  453. } // switch
  454. } // while
  455. success:
  456. return ptr;
  457. failure:
  458. ptr = nullptr;
  459. goto success;
  460. #undef CHK_
  461. }
  462. ::PROTOBUF_NAMESPACE_ID::uint8* WriteBatch::_InternalSerialize(
  463. ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  464. // @@protoc_insertion_point(serialize_to_array_start:firestore.client.WriteBatch)
  465. ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  466. (void) cached_has_bits;
  467. // int32 batch_id = 1;
  468. if (this->batch_id() != 0) {
  469. target = stream->EnsureSpace(target);
  470. target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_batch_id(), target);
  471. }
  472. // repeated .google.firestore.v1.Write writes = 2;
  473. for (unsigned int i = 0,
  474. n = static_cast<unsigned int>(this->_internal_writes_size()); i < n; i++) {
  475. target = stream->EnsureSpace(target);
  476. target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
  477. InternalWriteMessage(2, this->_internal_writes(i), target, stream);
  478. }
  479. // .google.protobuf.Timestamp local_write_time = 3;
  480. if (this->has_local_write_time()) {
  481. target = stream->EnsureSpace(target);
  482. target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
  483. InternalWriteMessage(
  484. 3, _Internal::local_write_time(this), target, stream);
  485. }
  486. // repeated .google.firestore.v1.Write base_writes = 4;
  487. for (unsigned int i = 0,
  488. n = static_cast<unsigned int>(this->_internal_base_writes_size()); i < n; i++) {
  489. target = stream->EnsureSpace(target);
  490. target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
  491. InternalWriteMessage(4, this->_internal_base_writes(i), target, stream);
  492. }
  493. if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
  494. target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
  495. _internal_metadata_.unknown_fields(), target, stream);
  496. }
  497. // @@protoc_insertion_point(serialize_to_array_end:firestore.client.WriteBatch)
  498. return target;
  499. }
  500. size_t WriteBatch::ByteSizeLong() const {
  501. // @@protoc_insertion_point(message_byte_size_start:firestore.client.WriteBatch)
  502. size_t total_size = 0;
  503. ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  504. // Prevent compiler warnings about cached_has_bits being unused
  505. (void) cached_has_bits;
  506. // repeated .google.firestore.v1.Write writes = 2;
  507. total_size += 1UL * this->_internal_writes_size();
  508. for (const auto& msg : this->writes_) {
  509. total_size +=
  510. ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
  511. }
  512. // repeated .google.firestore.v1.Write base_writes = 4;
  513. total_size += 1UL * this->_internal_base_writes_size();
  514. for (const auto& msg : this->base_writes_) {
  515. total_size +=
  516. ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
  517. }
  518. // .google.protobuf.Timestamp local_write_time = 3;
  519. if (this->has_local_write_time()) {
  520. total_size += 1 +
  521. ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
  522. *local_write_time_);
  523. }
  524. // int32 batch_id = 1;
  525. if (this->batch_id() != 0) {
  526. total_size += 1 +
  527. ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
  528. this->_internal_batch_id());
  529. }
  530. if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
  531. return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
  532. _internal_metadata_, total_size, &_cached_size_);
  533. }
  534. int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  535. SetCachedSize(cached_size);
  536. return total_size;
  537. }
  538. void WriteBatch::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
  539. // @@protoc_insertion_point(generalized_merge_from_start:firestore.client.WriteBatch)
  540. GOOGLE_DCHECK_NE(&from, this);
  541. const WriteBatch* source =
  542. ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<WriteBatch>(
  543. &from);
  544. if (source == nullptr) {
  545. // @@protoc_insertion_point(generalized_merge_from_cast_fail:firestore.client.WriteBatch)
  546. ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
  547. } else {
  548. // @@protoc_insertion_point(generalized_merge_from_cast_success:firestore.client.WriteBatch)
  549. MergeFrom(*source);
  550. }
  551. }
  552. void WriteBatch::MergeFrom(const WriteBatch& from) {
  553. // @@protoc_insertion_point(class_specific_merge_from_start:firestore.client.WriteBatch)
  554. GOOGLE_DCHECK_NE(&from, this);
  555. _internal_metadata_.MergeFrom(from._internal_metadata_);
  556. ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  557. (void) cached_has_bits;
  558. writes_.MergeFrom(from.writes_);
  559. base_writes_.MergeFrom(from.base_writes_);
  560. if (from.has_local_write_time()) {
  561. _internal_mutable_local_write_time()->PROTOBUF_NAMESPACE_ID::Timestamp::MergeFrom(from._internal_local_write_time());
  562. }
  563. if (from.batch_id() != 0) {
  564. _internal_set_batch_id(from._internal_batch_id());
  565. }
  566. }
  567. void WriteBatch::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
  568. // @@protoc_insertion_point(generalized_copy_from_start:firestore.client.WriteBatch)
  569. if (&from == this) return;
  570. Clear();
  571. MergeFrom(from);
  572. }
  573. void WriteBatch::CopyFrom(const WriteBatch& from) {
  574. // @@protoc_insertion_point(class_specific_copy_from_start:firestore.client.WriteBatch)
  575. if (&from == this) return;
  576. Clear();
  577. MergeFrom(from);
  578. }
  579. bool WriteBatch::IsInitialized() const {
  580. return true;
  581. }
  582. void WriteBatch::InternalSwap(WriteBatch* other) {
  583. using std::swap;
  584. _internal_metadata_.Swap(&other->_internal_metadata_);
  585. writes_.InternalSwap(&other->writes_);
  586. base_writes_.InternalSwap(&other->base_writes_);
  587. swap(local_write_time_, other->local_write_time_);
  588. swap(batch_id_, other->batch_id_);
  589. }
  590. ::PROTOBUF_NAMESPACE_ID::Metadata WriteBatch::GetMetadata() const {
  591. return GetMetadataStatic();
  592. }
  593. // @@protoc_insertion_point(namespace_scope)
  594. } // namespace client
  595. } // namespace firestore
  596. PROTOBUF_NAMESPACE_OPEN
  597. template<> PROTOBUF_NOINLINE ::firestore::client::MutationQueue* Arena::CreateMaybeMessage< ::firestore::client::MutationQueue >(Arena* arena) {
  598. return Arena::CreateInternal< ::firestore::client::MutationQueue >(arena);
  599. }
  600. template<> PROTOBUF_NOINLINE ::firestore::client::WriteBatch* Arena::CreateMaybeMessage< ::firestore::client::WriteBatch >(Arena* arena) {
  601. return Arena::CreateInternal< ::firestore::client::WriteBatch >(arena);
  602. }
  603. PROTOBUF_NAMESPACE_CLOSE
  604. // @@protoc_insertion_point(global_scope)
  605. #include <google/protobuf/port_undef.inc>