mutation.pb.cc 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855
  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/stubs/port.h>
  22. #include <google/protobuf/stubs/once.h>
  23. #include <google/protobuf/io/coded_stream.h>
  24. #include <google/protobuf/wire_format_lite_inl.h>
  25. #include <google/protobuf/descriptor.h>
  26. #include <google/protobuf/generated_message_reflection.h>
  27. #include <google/protobuf/reflection_ops.h>
  28. #include <google/protobuf/wire_format.h>
  29. // This is a temporary google only hack
  30. #ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
  31. #include "third_party/protobuf/version.h"
  32. #endif
  33. // @@protoc_insertion_point(includes)
  34. namespace firestore {
  35. namespace client {
  36. class MutationQueueDefaultTypeInternal {
  37. public:
  38. ::google::protobuf::internal::ExplicitlyConstructed<MutationQueue>
  39. _instance;
  40. } _MutationQueue_default_instance_;
  41. class WriteBatchDefaultTypeInternal {
  42. public:
  43. ::google::protobuf::internal::ExplicitlyConstructed<WriteBatch>
  44. _instance;
  45. } _WriteBatch_default_instance_;
  46. } // namespace client
  47. } // namespace firestore
  48. namespace protobuf_firestore_2flocal_2fmutation_2eproto {
  49. void InitDefaultsMutationQueueImpl() {
  50. GOOGLE_PROTOBUF_VERIFY_VERSION;
  51. #ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
  52. ::google::protobuf::internal::InitProtobufDefaultsForceUnique();
  53. #else
  54. ::google::protobuf::internal::InitProtobufDefaults();
  55. #endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
  56. {
  57. void* ptr = &::firestore::client::_MutationQueue_default_instance_;
  58. new (ptr) ::firestore::client::MutationQueue();
  59. ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  60. }
  61. ::firestore::client::MutationQueue::InitAsDefaultInstance();
  62. }
  63. void InitDefaultsMutationQueue() {
  64. static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
  65. ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsMutationQueueImpl);
  66. }
  67. void InitDefaultsWriteBatchImpl() {
  68. GOOGLE_PROTOBUF_VERIFY_VERSION;
  69. #ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
  70. ::google::protobuf::internal::InitProtobufDefaultsForceUnique();
  71. #else
  72. ::google::protobuf::internal::InitProtobufDefaults();
  73. #endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
  74. protobuf_google_2ffirestore_2fv1_2fwrite_2eproto::InitDefaultsWrite();
  75. protobuf_google_2fprotobuf_2ftimestamp_2eproto::InitDefaultsTimestamp();
  76. {
  77. void* ptr = &::firestore::client::_WriteBatch_default_instance_;
  78. new (ptr) ::firestore::client::WriteBatch();
  79. ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  80. }
  81. ::firestore::client::WriteBatch::InitAsDefaultInstance();
  82. }
  83. void InitDefaultsWriteBatch() {
  84. static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
  85. ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsWriteBatchImpl);
  86. }
  87. ::google::protobuf::Metadata file_level_metadata[2];
  88. const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  89. ~0u, // no _has_bits_
  90. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::firestore::client::MutationQueue, _internal_metadata_),
  91. ~0u, // no _extensions_
  92. ~0u, // no _oneof_case_
  93. ~0u, // no _weak_field_map_
  94. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::firestore::client::MutationQueue, last_acknowledged_batch_id_),
  95. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::firestore::client::MutationQueue, last_stream_token_),
  96. ~0u, // no _has_bits_
  97. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::firestore::client::WriteBatch, _internal_metadata_),
  98. ~0u, // no _extensions_
  99. ~0u, // no _oneof_case_
  100. ~0u, // no _weak_field_map_
  101. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::firestore::client::WriteBatch, batch_id_),
  102. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::firestore::client::WriteBatch, writes_),
  103. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::firestore::client::WriteBatch, local_write_time_),
  104. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::firestore::client::WriteBatch, base_writes_),
  105. };
  106. static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  107. { 0, -1, sizeof(::firestore::client::MutationQueue)},
  108. { 7, -1, sizeof(::firestore::client::WriteBatch)},
  109. };
  110. static ::google::protobuf::Message const * const file_default_instances[] = {
  111. reinterpret_cast<const ::google::protobuf::Message*>(&::firestore::client::_MutationQueue_default_instance_),
  112. reinterpret_cast<const ::google::protobuf::Message*>(&::firestore::client::_WriteBatch_default_instance_),
  113. };
  114. void protobuf_AssignDescriptors() {
  115. AddDescriptors();
  116. ::google::protobuf::MessageFactory* factory = NULL;
  117. AssignDescriptors(
  118. "firestore/local/mutation.proto", schemas, file_default_instances, TableStruct::offsets, factory,
  119. file_level_metadata, NULL, NULL);
  120. }
  121. void protobuf_AssignDescriptorsOnce() {
  122. static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
  123. ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors);
  124. }
  125. void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
  126. void protobuf_RegisterTypes(const ::std::string&) {
  127. protobuf_AssignDescriptorsOnce();
  128. ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 2);
  129. }
  130. void AddDescriptorsImpl() {
  131. InitDefaults();
  132. static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  133. "\n\036firestore/local/mutation.proto\022\020firest"
  134. "ore.client\032\037google/firestore/v1/write.pr"
  135. "oto\032\037google/protobuf/timestamp.proto\"N\n\r"
  136. "MutationQueue\022\"\n\032last_acknowledged_batch"
  137. "_id\030\001 \001(\005\022\031\n\021last_stream_token\030\002 \001(\014\"\261\001\n"
  138. "\nWriteBatch\022\020\n\010batch_id\030\001 \001(\005\022*\n\006writes\030"
  139. "\002 \003(\0132\032.google.firestore.v1.Write\0224\n\020loc"
  140. "al_write_time\030\003 \001(\0132\032.google.protobuf.Ti"
  141. "mestamp\022/\n\013base_writes\030\004 \003(\0132\032.google.fi"
  142. "restore.v1.WriteB/\n#com.google.firebase."
  143. "firestore.protoP\001\242\002\005FSTPBb\006proto3"
  144. };
  145. ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
  146. descriptor, 433);
  147. ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
  148. "firestore/local/mutation.proto", &protobuf_RegisterTypes);
  149. ::protobuf_google_2ffirestore_2fv1_2fwrite_2eproto::AddDescriptors();
  150. ::protobuf_google_2fprotobuf_2ftimestamp_2eproto::AddDescriptors();
  151. }
  152. void AddDescriptors() {
  153. static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
  154. ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);
  155. }
  156. // Force AddDescriptors() to be called at dynamic initialization time.
  157. struct StaticDescriptorInitializer {
  158. StaticDescriptorInitializer() {
  159. AddDescriptors();
  160. }
  161. } static_descriptor_initializer;
  162. } // namespace protobuf_firestore_2flocal_2fmutation_2eproto
  163. namespace firestore {
  164. namespace client {
  165. // ===================================================================
  166. void MutationQueue::InitAsDefaultInstance() {
  167. }
  168. #if !defined(_MSC_VER) || _MSC_VER >= 1900
  169. const int MutationQueue::kLastAcknowledgedBatchIdFieldNumber;
  170. const int MutationQueue::kLastStreamTokenFieldNumber;
  171. #endif // !defined(_MSC_VER) || _MSC_VER >= 1900
  172. MutationQueue::MutationQueue()
  173. : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  174. if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
  175. ::protobuf_firestore_2flocal_2fmutation_2eproto::InitDefaultsMutationQueue();
  176. }
  177. SharedCtor();
  178. // @@protoc_insertion_point(constructor:firestore.client.MutationQueue)
  179. }
  180. MutationQueue::MutationQueue(const MutationQueue& from)
  181. : ::google::protobuf::Message(),
  182. _internal_metadata_(NULL),
  183. _cached_size_(0) {
  184. _internal_metadata_.MergeFrom(from._internal_metadata_);
  185. last_stream_token_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  186. if (from.last_stream_token().size() > 0) {
  187. last_stream_token_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.last_stream_token_);
  188. }
  189. last_acknowledged_batch_id_ = from.last_acknowledged_batch_id_;
  190. // @@protoc_insertion_point(copy_constructor:firestore.client.MutationQueue)
  191. }
  192. void MutationQueue::SharedCtor() {
  193. last_stream_token_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  194. last_acknowledged_batch_id_ = 0;
  195. _cached_size_ = 0;
  196. }
  197. MutationQueue::~MutationQueue() {
  198. // @@protoc_insertion_point(destructor:firestore.client.MutationQueue)
  199. SharedDtor();
  200. }
  201. void MutationQueue::SharedDtor() {
  202. last_stream_token_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  203. }
  204. void MutationQueue::SetCachedSize(int size) const {
  205. GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  206. _cached_size_ = size;
  207. GOOGLE_SAFE_CONCURRENT_WRITES_END();
  208. }
  209. const ::google::protobuf::Descriptor* MutationQueue::descriptor() {
  210. ::protobuf_firestore_2flocal_2fmutation_2eproto::protobuf_AssignDescriptorsOnce();
  211. return ::protobuf_firestore_2flocal_2fmutation_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
  212. }
  213. const MutationQueue& MutationQueue::default_instance() {
  214. ::protobuf_firestore_2flocal_2fmutation_2eproto::InitDefaultsMutationQueue();
  215. return *internal_default_instance();
  216. }
  217. MutationQueue* MutationQueue::New(::google::protobuf::Arena* arena) const {
  218. MutationQueue* n = new MutationQueue;
  219. if (arena != NULL) {
  220. arena->Own(n);
  221. }
  222. return n;
  223. }
  224. void MutationQueue::Clear() {
  225. // @@protoc_insertion_point(message_clear_start:firestore.client.MutationQueue)
  226. ::google::protobuf::uint32 cached_has_bits = 0;
  227. // Prevent compiler warnings about cached_has_bits being unused
  228. (void) cached_has_bits;
  229. last_stream_token_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  230. last_acknowledged_batch_id_ = 0;
  231. _internal_metadata_.Clear();
  232. }
  233. bool MutationQueue::MergePartialFromCodedStream(
  234. ::google::protobuf::io::CodedInputStream* input) {
  235. #define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  236. ::google::protobuf::uint32 tag;
  237. // @@protoc_insertion_point(parse_start:firestore.client.MutationQueue)
  238. for (;;) {
  239. ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
  240. tag = p.first;
  241. if (!p.second) goto handle_unusual;
  242. switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
  243. // int32 last_acknowledged_batch_id = 1;
  244. case 1: {
  245. if (static_cast< ::google::protobuf::uint8>(tag) ==
  246. static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) {
  247. DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
  248. ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
  249. input, &last_acknowledged_batch_id_)));
  250. } else {
  251. goto handle_unusual;
  252. }
  253. break;
  254. }
  255. // bytes last_stream_token = 2;
  256. case 2: {
  257. if (static_cast< ::google::protobuf::uint8>(tag) ==
  258. static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
  259. DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
  260. input, this->mutable_last_stream_token()));
  261. } else {
  262. goto handle_unusual;
  263. }
  264. break;
  265. }
  266. default: {
  267. handle_unusual:
  268. if (tag == 0) {
  269. goto success;
  270. }
  271. DO_(::google::protobuf::internal::WireFormat::SkipField(
  272. input, tag, _internal_metadata_.mutable_unknown_fields()));
  273. break;
  274. }
  275. }
  276. }
  277. success:
  278. // @@protoc_insertion_point(parse_success:firestore.client.MutationQueue)
  279. return true;
  280. failure:
  281. // @@protoc_insertion_point(parse_failure:firestore.client.MutationQueue)
  282. return false;
  283. #undef DO_
  284. }
  285. void MutationQueue::SerializeWithCachedSizes(
  286. ::google::protobuf::io::CodedOutputStream* output) const {
  287. // @@protoc_insertion_point(serialize_start:firestore.client.MutationQueue)
  288. ::google::protobuf::uint32 cached_has_bits = 0;
  289. (void) cached_has_bits;
  290. // int32 last_acknowledged_batch_id = 1;
  291. if (this->last_acknowledged_batch_id() != 0) {
  292. ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->last_acknowledged_batch_id(), output);
  293. }
  294. // bytes last_stream_token = 2;
  295. if (this->last_stream_token().size() > 0) {
  296. ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(
  297. 2, this->last_stream_token(), output);
  298. }
  299. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  300. ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
  301. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output);
  302. }
  303. // @@protoc_insertion_point(serialize_end:firestore.client.MutationQueue)
  304. }
  305. ::google::protobuf::uint8* MutationQueue::InternalSerializeWithCachedSizesToArray(
  306. bool deterministic, ::google::protobuf::uint8* target) const {
  307. (void)deterministic; // Unused
  308. // @@protoc_insertion_point(serialize_to_array_start:firestore.client.MutationQueue)
  309. ::google::protobuf::uint32 cached_has_bits = 0;
  310. (void) cached_has_bits;
  311. // int32 last_acknowledged_batch_id = 1;
  312. if (this->last_acknowledged_batch_id() != 0) {
  313. target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->last_acknowledged_batch_id(), target);
  314. }
  315. // bytes last_stream_token = 2;
  316. if (this->last_stream_token().size() > 0) {
  317. target =
  318. ::google::protobuf::internal::WireFormatLite::WriteBytesToArray(
  319. 2, this->last_stream_token(), target);
  320. }
  321. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  322. target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
  323. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target);
  324. }
  325. // @@protoc_insertion_point(serialize_to_array_end:firestore.client.MutationQueue)
  326. return target;
  327. }
  328. size_t MutationQueue::ByteSizeLong() const {
  329. // @@protoc_insertion_point(message_byte_size_start:firestore.client.MutationQueue)
  330. size_t total_size = 0;
  331. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  332. total_size +=
  333. ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
  334. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
  335. }
  336. // bytes last_stream_token = 2;
  337. if (this->last_stream_token().size() > 0) {
  338. total_size += 1 +
  339. ::google::protobuf::internal::WireFormatLite::BytesSize(
  340. this->last_stream_token());
  341. }
  342. // int32 last_acknowledged_batch_id = 1;
  343. if (this->last_acknowledged_batch_id() != 0) {
  344. total_size += 1 +
  345. ::google::protobuf::internal::WireFormatLite::Int32Size(
  346. this->last_acknowledged_batch_id());
  347. }
  348. int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  349. GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  350. _cached_size_ = cached_size;
  351. GOOGLE_SAFE_CONCURRENT_WRITES_END();
  352. return total_size;
  353. }
  354. void MutationQueue::MergeFrom(const ::google::protobuf::Message& from) {
  355. // @@protoc_insertion_point(generalized_merge_from_start:firestore.client.MutationQueue)
  356. GOOGLE_DCHECK_NE(&from, this);
  357. const MutationQueue* source =
  358. ::google::protobuf::internal::DynamicCastToGenerated<const MutationQueue>(
  359. &from);
  360. if (source == NULL) {
  361. // @@protoc_insertion_point(generalized_merge_from_cast_fail:firestore.client.MutationQueue)
  362. ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  363. } else {
  364. // @@protoc_insertion_point(generalized_merge_from_cast_success:firestore.client.MutationQueue)
  365. MergeFrom(*source);
  366. }
  367. }
  368. void MutationQueue::MergeFrom(const MutationQueue& from) {
  369. // @@protoc_insertion_point(class_specific_merge_from_start:firestore.client.MutationQueue)
  370. GOOGLE_DCHECK_NE(&from, this);
  371. _internal_metadata_.MergeFrom(from._internal_metadata_);
  372. ::google::protobuf::uint32 cached_has_bits = 0;
  373. (void) cached_has_bits;
  374. if (from.last_stream_token().size() > 0) {
  375. last_stream_token_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.last_stream_token_);
  376. }
  377. if (from.last_acknowledged_batch_id() != 0) {
  378. set_last_acknowledged_batch_id(from.last_acknowledged_batch_id());
  379. }
  380. }
  381. void MutationQueue::CopyFrom(const ::google::protobuf::Message& from) {
  382. // @@protoc_insertion_point(generalized_copy_from_start:firestore.client.MutationQueue)
  383. if (&from == this) return;
  384. Clear();
  385. MergeFrom(from);
  386. }
  387. void MutationQueue::CopyFrom(const MutationQueue& from) {
  388. // @@protoc_insertion_point(class_specific_copy_from_start:firestore.client.MutationQueue)
  389. if (&from == this) return;
  390. Clear();
  391. MergeFrom(from);
  392. }
  393. bool MutationQueue::IsInitialized() const {
  394. return true;
  395. }
  396. void MutationQueue::Swap(MutationQueue* other) {
  397. if (other == this) return;
  398. InternalSwap(other);
  399. }
  400. void MutationQueue::InternalSwap(MutationQueue* other) {
  401. using std::swap;
  402. last_stream_token_.Swap(&other->last_stream_token_);
  403. swap(last_acknowledged_batch_id_, other->last_acknowledged_batch_id_);
  404. _internal_metadata_.Swap(&other->_internal_metadata_);
  405. swap(_cached_size_, other->_cached_size_);
  406. }
  407. ::google::protobuf::Metadata MutationQueue::GetMetadata() const {
  408. protobuf_firestore_2flocal_2fmutation_2eproto::protobuf_AssignDescriptorsOnce();
  409. return ::protobuf_firestore_2flocal_2fmutation_2eproto::file_level_metadata[kIndexInFileMessages];
  410. }
  411. // ===================================================================
  412. void WriteBatch::InitAsDefaultInstance() {
  413. ::firestore::client::_WriteBatch_default_instance_._instance.get_mutable()->local_write_time_ = const_cast< ::google::protobuf::Timestamp*>(
  414. ::google::protobuf::Timestamp::internal_default_instance());
  415. }
  416. void WriteBatch::clear_writes() {
  417. writes_.Clear();
  418. }
  419. void WriteBatch::clear_local_write_time() {
  420. if (GetArenaNoVirtual() == NULL && local_write_time_ != NULL) {
  421. delete local_write_time_;
  422. }
  423. local_write_time_ = NULL;
  424. }
  425. void WriteBatch::clear_base_writes() {
  426. base_writes_.Clear();
  427. }
  428. #if !defined(_MSC_VER) || _MSC_VER >= 1900
  429. const int WriteBatch::kBatchIdFieldNumber;
  430. const int WriteBatch::kWritesFieldNumber;
  431. const int WriteBatch::kLocalWriteTimeFieldNumber;
  432. const int WriteBatch::kBaseWritesFieldNumber;
  433. #endif // !defined(_MSC_VER) || _MSC_VER >= 1900
  434. WriteBatch::WriteBatch()
  435. : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  436. if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
  437. ::protobuf_firestore_2flocal_2fmutation_2eproto::InitDefaultsWriteBatch();
  438. }
  439. SharedCtor();
  440. // @@protoc_insertion_point(constructor:firestore.client.WriteBatch)
  441. }
  442. WriteBatch::WriteBatch(const WriteBatch& from)
  443. : ::google::protobuf::Message(),
  444. _internal_metadata_(NULL),
  445. writes_(from.writes_),
  446. base_writes_(from.base_writes_),
  447. _cached_size_(0) {
  448. _internal_metadata_.MergeFrom(from._internal_metadata_);
  449. if (from.has_local_write_time()) {
  450. local_write_time_ = new ::google::protobuf::Timestamp(*from.local_write_time_);
  451. } else {
  452. local_write_time_ = NULL;
  453. }
  454. batch_id_ = from.batch_id_;
  455. // @@protoc_insertion_point(copy_constructor:firestore.client.WriteBatch)
  456. }
  457. void WriteBatch::SharedCtor() {
  458. ::memset(&local_write_time_, 0, static_cast<size_t>(
  459. reinterpret_cast<char*>(&batch_id_) -
  460. reinterpret_cast<char*>(&local_write_time_)) + sizeof(batch_id_));
  461. _cached_size_ = 0;
  462. }
  463. WriteBatch::~WriteBatch() {
  464. // @@protoc_insertion_point(destructor:firestore.client.WriteBatch)
  465. SharedDtor();
  466. }
  467. void WriteBatch::SharedDtor() {
  468. if (this != internal_default_instance()) delete local_write_time_;
  469. }
  470. void WriteBatch::SetCachedSize(int size) const {
  471. GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  472. _cached_size_ = size;
  473. GOOGLE_SAFE_CONCURRENT_WRITES_END();
  474. }
  475. const ::google::protobuf::Descriptor* WriteBatch::descriptor() {
  476. ::protobuf_firestore_2flocal_2fmutation_2eproto::protobuf_AssignDescriptorsOnce();
  477. return ::protobuf_firestore_2flocal_2fmutation_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
  478. }
  479. const WriteBatch& WriteBatch::default_instance() {
  480. ::protobuf_firestore_2flocal_2fmutation_2eproto::InitDefaultsWriteBatch();
  481. return *internal_default_instance();
  482. }
  483. WriteBatch* WriteBatch::New(::google::protobuf::Arena* arena) const {
  484. WriteBatch* n = new WriteBatch;
  485. if (arena != NULL) {
  486. arena->Own(n);
  487. }
  488. return n;
  489. }
  490. void WriteBatch::Clear() {
  491. // @@protoc_insertion_point(message_clear_start:firestore.client.WriteBatch)
  492. ::google::protobuf::uint32 cached_has_bits = 0;
  493. // Prevent compiler warnings about cached_has_bits being unused
  494. (void) cached_has_bits;
  495. writes_.Clear();
  496. base_writes_.Clear();
  497. if (GetArenaNoVirtual() == NULL && local_write_time_ != NULL) {
  498. delete local_write_time_;
  499. }
  500. local_write_time_ = NULL;
  501. batch_id_ = 0;
  502. _internal_metadata_.Clear();
  503. }
  504. bool WriteBatch::MergePartialFromCodedStream(
  505. ::google::protobuf::io::CodedInputStream* input) {
  506. #define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  507. ::google::protobuf::uint32 tag;
  508. // @@protoc_insertion_point(parse_start:firestore.client.WriteBatch)
  509. for (;;) {
  510. ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
  511. tag = p.first;
  512. if (!p.second) goto handle_unusual;
  513. switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
  514. // int32 batch_id = 1;
  515. case 1: {
  516. if (static_cast< ::google::protobuf::uint8>(tag) ==
  517. static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) {
  518. DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
  519. ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
  520. input, &batch_id_)));
  521. } else {
  522. goto handle_unusual;
  523. }
  524. break;
  525. }
  526. // repeated .google.firestore.v1.Write writes = 2;
  527. case 2: {
  528. if (static_cast< ::google::protobuf::uint8>(tag) ==
  529. static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
  530. DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_writes()));
  531. } else {
  532. goto handle_unusual;
  533. }
  534. break;
  535. }
  536. // .google.protobuf.Timestamp local_write_time = 3;
  537. case 3: {
  538. if (static_cast< ::google::protobuf::uint8>(tag) ==
  539. static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
  540. DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
  541. input, mutable_local_write_time()));
  542. } else {
  543. goto handle_unusual;
  544. }
  545. break;
  546. }
  547. // repeated .google.firestore.v1.Write base_writes = 4;
  548. case 4: {
  549. if (static_cast< ::google::protobuf::uint8>(tag) ==
  550. static_cast< ::google::protobuf::uint8>(34u /* 34 & 0xFF */)) {
  551. DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_base_writes()));
  552. } else {
  553. goto handle_unusual;
  554. }
  555. break;
  556. }
  557. default: {
  558. handle_unusual:
  559. if (tag == 0) {
  560. goto success;
  561. }
  562. DO_(::google::protobuf::internal::WireFormat::SkipField(
  563. input, tag, _internal_metadata_.mutable_unknown_fields()));
  564. break;
  565. }
  566. }
  567. }
  568. success:
  569. // @@protoc_insertion_point(parse_success:firestore.client.WriteBatch)
  570. return true;
  571. failure:
  572. // @@protoc_insertion_point(parse_failure:firestore.client.WriteBatch)
  573. return false;
  574. #undef DO_
  575. }
  576. void WriteBatch::SerializeWithCachedSizes(
  577. ::google::protobuf::io::CodedOutputStream* output) const {
  578. // @@protoc_insertion_point(serialize_start:firestore.client.WriteBatch)
  579. ::google::protobuf::uint32 cached_has_bits = 0;
  580. (void) cached_has_bits;
  581. // int32 batch_id = 1;
  582. if (this->batch_id() != 0) {
  583. ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->batch_id(), output);
  584. }
  585. // repeated .google.firestore.v1.Write writes = 2;
  586. for (unsigned int i = 0,
  587. n = static_cast<unsigned int>(this->writes_size()); i < n; i++) {
  588. ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
  589. 2, this->writes(static_cast<int>(i)), output);
  590. }
  591. // .google.protobuf.Timestamp local_write_time = 3;
  592. if (this->has_local_write_time()) {
  593. ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
  594. 3, *this->local_write_time_, output);
  595. }
  596. // repeated .google.firestore.v1.Write base_writes = 4;
  597. for (unsigned int i = 0,
  598. n = static_cast<unsigned int>(this->base_writes_size()); i < n; i++) {
  599. ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
  600. 4, this->base_writes(static_cast<int>(i)), output);
  601. }
  602. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  603. ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
  604. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output);
  605. }
  606. // @@protoc_insertion_point(serialize_end:firestore.client.WriteBatch)
  607. }
  608. ::google::protobuf::uint8* WriteBatch::InternalSerializeWithCachedSizesToArray(
  609. bool deterministic, ::google::protobuf::uint8* target) const {
  610. (void)deterministic; // Unused
  611. // @@protoc_insertion_point(serialize_to_array_start:firestore.client.WriteBatch)
  612. ::google::protobuf::uint32 cached_has_bits = 0;
  613. (void) cached_has_bits;
  614. // int32 batch_id = 1;
  615. if (this->batch_id() != 0) {
  616. target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->batch_id(), target);
  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. target = ::google::protobuf::internal::WireFormatLite::
  622. InternalWriteMessageToArray(
  623. 2, this->writes(static_cast<int>(i)), deterministic, target);
  624. }
  625. // .google.protobuf.Timestamp local_write_time = 3;
  626. if (this->has_local_write_time()) {
  627. target = ::google::protobuf::internal::WireFormatLite::
  628. InternalWriteMessageToArray(
  629. 3, *this->local_write_time_, deterministic, target);
  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. target = ::google::protobuf::internal::WireFormatLite::
  635. InternalWriteMessageToArray(
  636. 4, this->base_writes(static_cast<int>(i)), deterministic, target);
  637. }
  638. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  639. target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
  640. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target);
  641. }
  642. // @@protoc_insertion_point(serialize_to_array_end:firestore.client.WriteBatch)
  643. return target;
  644. }
  645. size_t WriteBatch::ByteSizeLong() const {
  646. // @@protoc_insertion_point(message_byte_size_start:firestore.client.WriteBatch)
  647. size_t total_size = 0;
  648. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  649. total_size +=
  650. ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
  651. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
  652. }
  653. // repeated .google.firestore.v1.Write writes = 2;
  654. {
  655. unsigned int count = static_cast<unsigned int>(this->writes_size());
  656. total_size += 1UL * count;
  657. for (unsigned int i = 0; i < count; i++) {
  658. total_size +=
  659. ::google::protobuf::internal::WireFormatLite::MessageSize(
  660. this->writes(static_cast<int>(i)));
  661. }
  662. }
  663. // repeated .google.firestore.v1.Write base_writes = 4;
  664. {
  665. unsigned int count = static_cast<unsigned int>(this->base_writes_size());
  666. total_size += 1UL * count;
  667. for (unsigned int i = 0; i < count; i++) {
  668. total_size +=
  669. ::google::protobuf::internal::WireFormatLite::MessageSize(
  670. this->base_writes(static_cast<int>(i)));
  671. }
  672. }
  673. // .google.protobuf.Timestamp local_write_time = 3;
  674. if (this->has_local_write_time()) {
  675. total_size += 1 +
  676. ::google::protobuf::internal::WireFormatLite::MessageSize(
  677. *this->local_write_time_);
  678. }
  679. // int32 batch_id = 1;
  680. if (this->batch_id() != 0) {
  681. total_size += 1 +
  682. ::google::protobuf::internal::WireFormatLite::Int32Size(
  683. this->batch_id());
  684. }
  685. int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  686. GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  687. _cached_size_ = cached_size;
  688. GOOGLE_SAFE_CONCURRENT_WRITES_END();
  689. return total_size;
  690. }
  691. void WriteBatch::MergeFrom(const ::google::protobuf::Message& from) {
  692. // @@protoc_insertion_point(generalized_merge_from_start:firestore.client.WriteBatch)
  693. GOOGLE_DCHECK_NE(&from, this);
  694. const WriteBatch* source =
  695. ::google::protobuf::internal::DynamicCastToGenerated<const WriteBatch>(
  696. &from);
  697. if (source == NULL) {
  698. // @@protoc_insertion_point(generalized_merge_from_cast_fail:firestore.client.WriteBatch)
  699. ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  700. } else {
  701. // @@protoc_insertion_point(generalized_merge_from_cast_success:firestore.client.WriteBatch)
  702. MergeFrom(*source);
  703. }
  704. }
  705. void WriteBatch::MergeFrom(const WriteBatch& from) {
  706. // @@protoc_insertion_point(class_specific_merge_from_start:firestore.client.WriteBatch)
  707. GOOGLE_DCHECK_NE(&from, this);
  708. _internal_metadata_.MergeFrom(from._internal_metadata_);
  709. ::google::protobuf::uint32 cached_has_bits = 0;
  710. (void) cached_has_bits;
  711. writes_.MergeFrom(from.writes_);
  712. base_writes_.MergeFrom(from.base_writes_);
  713. if (from.has_local_write_time()) {
  714. mutable_local_write_time()->::google::protobuf::Timestamp::MergeFrom(from.local_write_time());
  715. }
  716. if (from.batch_id() != 0) {
  717. set_batch_id(from.batch_id());
  718. }
  719. }
  720. void WriteBatch::CopyFrom(const ::google::protobuf::Message& from) {
  721. // @@protoc_insertion_point(generalized_copy_from_start:firestore.client.WriteBatch)
  722. if (&from == this) return;
  723. Clear();
  724. MergeFrom(from);
  725. }
  726. void WriteBatch::CopyFrom(const WriteBatch& from) {
  727. // @@protoc_insertion_point(class_specific_copy_from_start:firestore.client.WriteBatch)
  728. if (&from == this) return;
  729. Clear();
  730. MergeFrom(from);
  731. }
  732. bool WriteBatch::IsInitialized() const {
  733. return true;
  734. }
  735. void WriteBatch::Swap(WriteBatch* other) {
  736. if (other == this) return;
  737. InternalSwap(other);
  738. }
  739. void WriteBatch::InternalSwap(WriteBatch* other) {
  740. using std::swap;
  741. writes_.InternalSwap(&other->writes_);
  742. base_writes_.InternalSwap(&other->base_writes_);
  743. swap(local_write_time_, other->local_write_time_);
  744. swap(batch_id_, other->batch_id_);
  745. _internal_metadata_.Swap(&other->_internal_metadata_);
  746. swap(_cached_size_, other->_cached_size_);
  747. }
  748. ::google::protobuf::Metadata WriteBatch::GetMetadata() const {
  749. protobuf_firestore_2flocal_2fmutation_2eproto::protobuf_AssignDescriptorsOnce();
  750. return ::protobuf_firestore_2flocal_2fmutation_2eproto::file_level_metadata[kIndexInFileMessages];
  751. }
  752. // @@protoc_insertion_point(namespace_scope)
  753. } // namespace client
  754. } // namespace firestore
  755. // @@protoc_insertion_point(global_scope)