mutation.pb.cc 30 KB

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