Bläddra i källkod

Merge branch 'master' into mm/fis-integration-master

Maksym Malyhin 6 år sedan
förälder
incheckning
5a9150262e
100 ändrade filer med 9679 tillägg och 8418 borttagningar
  1. 3 1
      CMakeLists.txt
  2. 7 0
      CoreOnly/Tests/FirebasePodTest/Podfile
  3. 61 0
      Example/Core/Tests/FIRHeartbeatInfoTest.m
  4. 32 29
      Example/CoreDiagnostics/Tests/FIRCoreDiagnosticsTest.m
  5. 1 1
      Example/Podfile
  6. 9 9
      Firebase.podspec
  7. 3 0
      Firebase/Auth/CHANGELOG.md
  8. 15 2
      Firebase/Auth/Source/AuthProvider/OAuth/FIROAuthCredential.m
  9. 2 0
      Firebase/Auth/Source/AuthProvider/OAuth/FIROAuthCredential_Internal.h
  10. 25 0
      Firebase/Auth/Source/AuthProvider/OAuth/FIROAuthProvider.m
  11. 9 0
      Firebase/Auth/Source/Backend/FIRAuthBackend.m
  12. 5 0
      Firebase/Auth/Source/Backend/RPC/FIRVerifyAssertionRequest.h
  13. 10 0
      Firebase/Auth/Source/Backend/RPC/FIRVerifyAssertionRequest.m
  14. 4 0
      Firebase/Auth/Source/Public/FIRAuthErrors.h
  15. 29 0
      Firebase/Auth/Source/Public/FIROAuthProvider.h
  16. 7 0
      Firebase/Auth/Source/Utilities/FIRAuthErrorUtils.h
  17. 14 0
      Firebase/Auth/Source/Utilities/FIRAuthErrorUtils.m
  18. 5 0
      Firebase/Auth/Source/Utilities/FIRAuthInternalErrors.h
  19. 4 0
      Firebase/Core/CHANGELOG.md
  20. 61 0
      Firebase/Core/FIRHeartbeatInfo.m
  21. 39 0
      Firebase/Core/Private/FIRHeartbeatInfo.h
  22. 10 45
      Firebase/CoreDiagnostics/FIRCDLibrary/FIRCoreDiagnostics.m
  23. 0 64
      Firebase/CoreDiagnostics/FIRCDLibrary/FIRCoreDiagnosticsDateFileStorage.m
  24. 3 0
      Firebase/Messaging/CHANGELOG.md
  25. 3 0
      Firebase/Storage/CHANGELOG.md
  26. 6 2
      Firebase/Storage/FIRStorage.m
  27. 1 1
      FirebaseAuth.podspec
  28. 4 4
      FirebaseCore.podspec
  29. 1 3
      FirebaseFirestore.podspec
  30. 1 1
      FirebaseMessaging.podspec
  31. 1 1
      FirebaseRemoteConfig.podspec
  32. 3 0
      FirebaseRemoteConfig/CHANGELOG.md
  33. 4 4
      FirebaseRemoteConfig/Sources/FIRRemoteConfig.m
  34. 2 0
      FirebaseRemoteConfig/Sources/Private/RCNConfigSettings.h
  35. 11 0
      FirebaseRemoteConfig/Sources/RCNConfigSettings.m
  36. 5 2
      FirebaseRemoteConfig/Sources/RCNFetch.m
  37. 2 0
      FirebaseRemoteConfig/Sources/RCNUserDefaultsManager.h
  38. 14 0
      FirebaseRemoteConfig/Sources/RCNUserDefaultsManager.m
  39. 126 0
      FirebaseRemoteConfig/Tests/Unit/RCNRemoteConfigTest.m
  40. 12 0
      FirebaseRemoteConfig/Tests/Unit/RCNUserDefaultsManagerTests.m
  41. 1 1
      FirebaseStorage.podspec
  42. 7 0
      Firestore/CHANGELOG.md
  43. 93 107
      Firestore/Example/Firestore.xcodeproj/project.pbxproj
  44. 7 1
      Firestore/Example/FuzzTests/FuzzingResources/Serializer/Corpus/ConvertTextToBinary.sh
  45. 3 1
      Firestore/Example/GoogleTest.podspec
  46. 2 3
      Firestore/Example/Podfile
  47. 7 3
      Firestore/Example/ProtobufCpp.podspec
  48. 8 5
      Firestore/Example/Tests/Integration/API/FIRQueryTests.mm
  49. 0 44
      Firestore/Example/Tests/Local/FSTLRUGarbageCollectorTests.h
  50. 0 770
      Firestore/Example/Tests/Local/FSTLRUGarbageCollectorTests.mm
  51. 0 56
      Firestore/Example/Tests/Local/FSTLevelDBLRUGarbageCollectorTests.mm
  52. 0 453
      Firestore/Example/Tests/Local/FSTLevelDBMigrationsTests.mm
  53. 0 311
      Firestore/Example/Tests/Local/FSTLevelDBTransactionTests.mm
  54. 0 48
      Firestore/Example/Tests/Local/FSTMemoryLRUGarbageCollectorTests.mm
  55. 10 168
      Firestore/Protos/CMakeLists.txt
  56. 11 36
      Firestore/Protos/build_protos.py
  57. 331 325
      Firestore/Protos/cpp/firestore/local/maybe_document.pb.cc
  58. 344 247
      Firestore/Protos/cpp/firestore/local/maybe_document.pb.h
  59. 320 284
      Firestore/Protos/cpp/firestore/local/mutation.pb.cc
  60. 261 192
      Firestore/Protos/cpp/firestore/local/mutation.pb.h
  61. 359 304
      Firestore/Protos/cpp/firestore/local/target.pb.cc
  62. 286 214
      Firestore/Protos/cpp/firestore/local/target.pb.h
  63. 41 61
      Firestore/Protos/cpp/google/api/annotations.pb.cc
  64. 35 27
      Firestore/Protos/cpp/google/api/annotations.pb.h
  65. 360 313
      Firestore/Protos/cpp/google/api/http.pb.cc
  66. 392 288
      Firestore/Protos/cpp/google/api/http.pb.h
  67. 311 322
      Firestore/Protos/cpp/google/firestore/v1/common.pb.cc
  68. 396 243
      Firestore/Protos/cpp/google/firestore/v1/common.pb.h
  69. 327 347
      Firestore/Protos/cpp/google/firestore/v1/document.pb.cc
  70. 429 279
      Firestore/Protos/cpp/google/firestore/v1/document.pb.h
  71. 415 616
      Firestore/Protos/cpp/google/firestore/v1/firestore.pb.cc
  72. 372 332
      Firestore/Protos/cpp/google/firestore/v1/firestore.pb.h
  73. 356 415
      Firestore/Protos/cpp/google/firestore/v1/query.pb.cc
  74. 426 280
      Firestore/Protos/cpp/google/firestore/v1/query.pb.h
  75. 343 363
      Firestore/Protos/cpp/google/firestore/v1/write.pb.cc
  76. 395 271
      Firestore/Protos/cpp/google/firestore/v1/write.pb.h
  77. 191 186
      Firestore/Protos/cpp/google/rpc/status.pb.cc
  78. 149 111
      Firestore/Protos/cpp/google/rpc/status.pb.h
  79. 151 162
      Firestore/Protos/cpp/google/type/latlng.pb.cc
  80. 102 60
      Firestore/Protos/cpp/google/type/latlng.pb.h
  81. 13 0
      Firestore/Protos/lib/__init__.py
  82. 400 0
      Firestore/Protos/lib/pretty_printing.py
  83. 59 0
      Firestore/Protos/nanopb/firestore/local/maybe_document.nanopb.cc
  84. 8 0
      Firestore/Protos/nanopb/firestore/local/maybe_document.nanopb.h
  85. 45 0
      Firestore/Protos/nanopb/firestore/local/mutation.nanopb.cc
  86. 6 0
      Firestore/Protos/nanopb/firestore/local/mutation.nanopb.h
  87. 49 0
      Firestore/Protos/nanopb/firestore/local/target.nanopb.cc
  88. 6 0
      Firestore/Protos/nanopb/firestore/local/target.nanopb.h
  89. 8 0
      Firestore/Protos/nanopb/google/api/annotations.nanopb.cc
  90. 2 0
      Firestore/Protos/nanopb/google/api/annotations.nanopb.h
  91. 83 0
      Firestore/Protos/nanopb/google/api/http.nanopb.cc
  92. 8 0
      Firestore/Protos/nanopb/google/api/http.nanopb.h
  93. 107 0
      Firestore/Protos/nanopb/google/firestore/v1/common.nanopb.cc
  94. 12 0
      Firestore/Protos/nanopb/google/firestore/v1/common.nanopb.h
  95. 141 0
      Firestore/Protos/nanopb/google/firestore/v1/document.nanopb.cc
  96. 14 0
      Firestore/Protos/nanopb/google/firestore/v1/document.nanopb.h
  97. 584 0
      Firestore/Protos/nanopb/google/firestore/v1/firestore.nanopb.cc
  98. 58 0
      Firestore/Protos/nanopb/google/firestore/v1/firestore.nanopb.h
  99. 252 0
      Firestore/Protos/nanopb/google/firestore/v1/query.nanopb.cc
  100. 29 0
      Firestore/Protos/nanopb/google/firestore/v1/query.nanopb.h

+ 3 - 1
CMakeLists.txt

@@ -178,7 +178,9 @@ endif()
 if(CXX_CLANG)
   target_compile_options(
     libprotobuf
-    PRIVATE -Wno-invalid-offsetof
+    PRIVATE
+      -Wno-inconsistent-missing-override
+      -Wno-invalid-offsetof
   )
 endif()
 

+ 7 - 0
CoreOnly/Tests/FirebasePodTest/Podfile

@@ -24,6 +24,13 @@ target 'FirebasePodTest' do
   pod 'FirebaseRemoteConfig', :path => '../../../'
   pod 'FirebaseStorage', :path => '../../../'
 
+  # Get dependent pods from the repo also
+  pod 'FirebaseCoreDiagnostics', :path => '../../../'
+  pod 'FirebaseCoreDiagnosticsInterop', :path => '../../../'
+  pod 'GoogleDataTransport', :path => '../../../'
+  pod 'GoogleDataTransportCCTSupport', :path => '../../../'
+  pod 'GoogleUtilities', :path => '../../../'
+
   pod 'FirebaseAnalytics' # Analytics is not open source
   pod 'FirebasePerformance' # Performance is not open source
 end

+ 61 - 0
Example/Core/Tests/FIRHeartbeatInfoTest.m

@@ -0,0 +1,61 @@
+// Copyright 2019 Google
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#import <FirebaseCore/FIRHeartbeatInfo.h>
+#import <GoogleUtilities/GULHeartbeatDateStorage.h>
+#import <XCTest/XCTest.h>
+
+@interface FIRHeartbeatInfoTest : XCTestCase
+
+@property(nonatomic, strong) GULHeartbeatDateStorage *dataStorage;
+
+@property(nonatomic, strong) NSMutableDictionary *dictionary;
+
+@end
+
+@implementation FIRHeartbeatInfoTest
+
+- (void)setUp {
+  NSString *const kHeartbeatStorageFile = @"HEARTBEAT_INFO_STORAGE";
+  self.dataStorage = [[GULHeartbeatDateStorage alloc] initWithFileName:kHeartbeatStorageFile];
+  NSDate *pastTime = [NSDate dateWithTimeIntervalSinceNow:-996400];
+  [self.dataStorage setHearbeatDate:pastTime forTag:@"fire-iid"];
+  [self.dataStorage setHearbeatDate:pastTime forTag:@"GLOBAL"];
+}
+
+- (void)testCombinedHeartbeat {
+  FIRHeartbeatInfoCode heartbeatCode = [FIRHeartbeatInfo heartbeatCodeForTag:@"fire-iid"];
+  XCTAssertEqual(heartbeatCode, FIRHeartbeatInfoCodeCombined);
+}
+
+- (void)testSdkOnlyHeartbeat {
+  [self.dataStorage setHearbeatDate:[NSDate date] forTag:@"GLOBAL"];
+  FIRHeartbeatInfoCode heartbeatCode = [FIRHeartbeatInfo heartbeatCodeForTag:@"fire-iid"];
+  XCTAssertEqual(heartbeatCode, FIRHeartbeatInfoCodeSDK);
+}
+
+- (void)testGlobalOnlyHeartbeat {
+  [self.dataStorage setHearbeatDate:[NSDate date] forTag:@"fire-iid"];
+  FIRHeartbeatInfoCode heartbeatCode = [FIRHeartbeatInfo heartbeatCodeForTag:@"fire-iid"];
+  XCTAssertEqual(heartbeatCode, FIRHeartbeatInfoCodeGlobal);
+}
+
+- (void)testNoHeartbeat {
+  [self.dataStorage setHearbeatDate:[NSDate date] forTag:@"fire-iid"];
+  [self.dataStorage setHearbeatDate:[NSDate date] forTag:@"GLOBAL"];
+  FIRHeartbeatInfoCode heartbeatCode = [FIRHeartbeatInfo heartbeatCodeForTag:@"fire-iid"];
+  XCTAssertEqual(heartbeatCode, FIRHeartbeatInfoCodeNone);
+}
+
+@end

+ 32 - 29
Example/CoreDiagnostics/Tests/FIRCoreDiagnosticsTest.m

@@ -26,6 +26,7 @@
 #import <GoogleDataTransport/GDTCORTransport.h>
 #import <GoogleDataTransportCCTSupport/GDTCCTPrioritizer.h>
 #import <GoogleUtilities/GULAppEnvironmentUtil.h>
+#import <GoogleUtilities/GULHeartbeatDateStorage.h>
 #import <GoogleUtilities/GULUserDefaults.h>
 #import <OCMock/OCMock.h>
 #import <nanopb/pb_decode.h>
@@ -33,14 +34,13 @@
 
 #import "FIRCDLibrary/Protogen/nanopb/firebasecore.nanopb.h"
 
-#import "FIRCDLibrary/FIRCoreDiagnosticsDateFileStorage.h"
-
 extern NSString *const kFIRAppDiagnosticsNotification;
 extern NSString *const kFIRLastCheckinDateKey;
 
 static NSString *const kGoogleAppID = @"1:123:ios:123abc";
 static NSString *const kBundleID = @"com.google.FirebaseSDKTests";
 static NSString *const kLibraryVersionID = @"1.2.3";
+static NSString *const kFIRCoreDiagnosticsHeartbeatTag = @"FIRCoreDiagnostics";
 
 #pragma mark - Testing interfaces
 
@@ -48,17 +48,16 @@ static NSString *const kLibraryVersionID = @"1.2.3";
 // Initialization.
 + (instancetype)sharedInstance;
 - (instancetype)initWithTransport:(GDTCORTransport *)transport
-             heartbeatDateStorage:(FIRCoreDiagnosticsDateFileStorage *)heartbeatDateStorage;
+             heartbeatDateStorage:(GULHeartbeatDateStorage *)heartbeatDateStorage;
 
 // Properties.
 @property(nonatomic, readonly) dispatch_queue_t diagnosticsQueue;
 @property(nonatomic, readonly) GDTCORTransport *transport;
-@property(nonatomic, readonly) FIRCoreDiagnosticsDateFileStorage *heartbeatDateStorage;
+@property(nonatomic, readonly) GULHeartbeatDateStorage *heartbeatDateStorage;
 
 // Install string helpers.
 + (NSString *)installString;
 + (BOOL)writeString:(NSString *)string toURL:(NSURL *)filePathURL;
-+ (NSURL *)filePathURLWithName:(NSString *)fileName;
 + (NSString *)stringAtURL:(NSURL *)filePathURL;
 
 // Metadata helpers.
@@ -140,7 +139,7 @@ extern void FIRPopulateProtoWithInfoPlistValues(
   OCMStub([self.mockTransport eventForTransport])
       .andReturn([[GDTCOREvent alloc] initWithMappingID:@"111" target:2]);
 
-  self.mockDateStorage = OCMClassMock([FIRCoreDiagnosticsDateFileStorage class]);
+  self.mockDateStorage = OCMClassMock([GULHeartbeatDateStorage class]);
   self.diagnostics = [[FIRCoreDiagnostics alloc] initWithTransport:self.mockTransport
                                               heartbeatDateStorage:self.mockDateStorage];
 }
@@ -244,18 +243,20 @@ extern void FIRPopulateProtoWithInfoPlistValues(
 
   // Verify start of the day
   NSDate *startOfTheDay = [calendar dateFromComponents:dateComponents];
-  OCMExpect([self.mockDateStorage date]).andReturn(startOfTheDay);
-  OCMReject([self.mockDateStorage setDate:[self OCMArgToCheckDateEqualTo:[OCMArg any]]
-                                    error:[OCMArg anyObjectRef]]);
+  OCMExpect([self.mockDateStorage heartbeatDateForTag:kFIRCoreDiagnosticsHeartbeatTag])
+      .andReturn(startOfTheDay);
+  OCMReject([self.mockDateStorage setHearbeatDate:[self OCMArgToCheckDateEqualTo:[OCMArg any]]
+                                           forTag:kFIRCoreDiagnosticsHeartbeatTag]);
 
   [self assertEventSentWithHeartbeat:NO];
 
   // Verify middle of the day
   dateComponents.hour = 12;
   NSDate *middleOfTheDay = [calendar dateFromComponents:dateComponents];
-  OCMExpect([self.mockDateStorage date]).andReturn(middleOfTheDay);
-  OCMReject([self.mockDateStorage setDate:[self OCMArgToCheckDateEqualTo:[OCMArg any]]
-                                    error:[OCMArg anyObjectRef]]);
+  OCMExpect([self.mockDateStorage heartbeatDateForTag:kFIRCoreDiagnosticsHeartbeatTag])
+      .andReturn(middleOfTheDay);
+  OCMReject([self.mockDateStorage setHearbeatDate:[self OCMArgToCheckDateEqualTo:[OCMArg any]]
+                                           forTag:kFIRCoreDiagnosticsHeartbeatTag]);
 
   [self assertEventSentWithHeartbeat:NO];
 
@@ -264,17 +265,18 @@ extern void FIRPopulateProtoWithInfoPlistValues(
   dateComponents.day += 1;
   NSDate *startOfNextDay = [calendar dateFromComponents:dateComponents];
   NSDate *endOfTheDay = [startOfNextDay dateByAddingTimeInterval:-1];
-  OCMExpect([self.mockDateStorage date]).andReturn(endOfTheDay);
-  OCMReject([self.mockDateStorage setDate:[self OCMArgToCheckDateEqualTo:[OCMArg any]]
-                                    error:[OCMArg anyObjectRef]]);
-
+  OCMExpect([self.mockDateStorage heartbeatDateForTag:kFIRCoreDiagnosticsHeartbeatTag])
+      .andReturn(endOfTheDay);
+  OCMReject([self.mockDateStorage setHearbeatDate:[self OCMArgToCheckDateEqualTo:[OCMArg any]]
+                                           forTag:kFIRCoreDiagnosticsHeartbeatTag]);
   [self assertEventSentWithHeartbeat:NO];
 }
 
 - (void)testHeartbeatSentNoPreviousCheckin {
-  OCMExpect([self.mockDateStorage date]).andReturn(nil);
-  OCMExpect([self.mockDateStorage setDate:[self OCMArgToCheckDateEqualTo:[NSDate date]]
-                                    error:[OCMArg anyObjectRef]]);
+  OCMExpect([self.mockDateStorage heartbeatDateForTag:kFIRCoreDiagnosticsHeartbeatTag])
+      .andReturn(nil);
+  OCMExpect([self.mockDateStorage setHearbeatDate:[self OCMArgToCheckDateEqualTo:[NSDate date]]
+                                           forTag:kFIRCoreDiagnosticsHeartbeatTag]);
 
   [self assertEventSentWithHeartbeat:YES];
 }
@@ -283,9 +285,10 @@ extern void FIRPopulateProtoWithInfoPlistValues(
   NSDate *startOfToday = [[NSCalendar currentCalendar] startOfDayForDate:[NSDate date]];
   NSDate *endOfYesterday = [startOfToday dateByAddingTimeInterval:-1];
 
-  OCMExpect([self.mockDateStorage date]).andReturn(endOfYesterday);
-  OCMExpect([self.mockDateStorage setDate:[self OCMArgToCheckDateEqualTo:[NSDate date]]
-                                    error:[OCMArg anyObjectRef]]);
+  OCMExpect([self.mockDateStorage heartbeatDateForTag:kFIRCoreDiagnosticsHeartbeatTag])
+      .andReturn(endOfYesterday);
+  OCMExpect([self.mockDateStorage setHearbeatDate:[self OCMArgToCheckDateEqualTo:[NSDate date]]
+                                           forTag:kFIRCoreDiagnosticsHeartbeatTag]);
 
   [self assertEventSentWithHeartbeat:YES];
 }
@@ -295,16 +298,16 @@ extern void FIRPopulateProtoWithInfoPlistValues(
 - (void)testSharedInstanceDateStorageProperlyInitialized {
   FIRCoreDiagnostics *sharedInstance = [FIRCoreDiagnostics sharedInstance];
   XCTAssertNotNil(sharedInstance.heartbeatDateStorage);
-  XCTAssert([sharedInstance.heartbeatDateStorage
-      isKindOfClass:[FIRCoreDiagnosticsDateFileStorage class]]);
+  XCTAssert([sharedInstance.heartbeatDateStorage isKindOfClass:[GULHeartbeatDateStorage class]]);
 
   NSDate *date = [NSDate date];
 
-  NSError *error;
-  XCTAssertTrue([sharedInstance.heartbeatDateStorage setDate:date error:&error], @"Error %@",
-                error);
-
-  XCTAssertEqualObjects([sharedInstance.heartbeatDateStorage date], date);
+  XCTAssertTrue([sharedInstance.heartbeatDateStorage
+      setHearbeatDate:date
+               forTag:kFIRCoreDiagnosticsHeartbeatTag]);
+  XCTAssertEqualObjects(
+      [sharedInstance.heartbeatDateStorage heartbeatDateForTag:kFIRCoreDiagnosticsHeartbeatTag],
+      date);
 }
 
 #pragma mark - Helpers

+ 1 - 1
Example/Podfile

@@ -22,7 +22,7 @@ target 'Core_Example_iOS' do
   # The next line is the forcing function for the Firebase pod. The Firebase
   # version's subspecs should depend on the component versions in the
   # corresponding podspec's in this repo.
-  pod 'Firebase/CoreOnly', '6.12.0'
+  pod 'Firebase/CoreOnly', '6.13.0'
 
   target 'Core_Tests_iOS' do
     inherit! :search_paths

+ 9 - 9
Firebase.podspec

@@ -1,6 +1,6 @@
 Pod::Spec.new do |s|
   s.name             = 'Firebase'
-  s.version          = '6.12.0'
+  s.version          = '6.13.0'
   s.summary          = 'Firebase for iOS (plus community support for macOS and tvOS)'
 
   s.description      = <<-DESC
@@ -31,12 +31,12 @@ Simplify your iOS development, grow your user base, and monetize more effectivel
   s.default_subspec = 'Core'
 
   s.subspec 'Core' do |ss|
-    ss.ios.dependency 'FirebaseAnalytics', '6.1.5'
+    ss.ios.dependency 'FirebaseAnalytics', '6.1.6'
     ss.dependency 'Firebase/CoreOnly'
   end
 
   s.subspec 'CoreOnly' do |ss|
-    ss.dependency 'FirebaseCore', '6.3.3'
+    ss.dependency 'FirebaseCore', '6.4.0'
     ss.source_files = 'CoreOnly/Sources/Firebase.h'
     ss.preserve_paths = 'CoreOnly/Sources/module.modulemap'
     ss.user_target_xcconfig = {
@@ -60,7 +60,7 @@ Simplify your iOS development, grow your user base, and monetize more effectivel
 
   s.subspec 'Auth' do |ss|
     ss.dependency 'Firebase/CoreOnly'
-    ss.dependency 'FirebaseAuth', '~> 6.3.1'
+    ss.dependency 'FirebaseAuth', '~> 6.4.0'
   end
 
   s.subspec 'Database' do |ss|
@@ -75,7 +75,7 @@ Simplify your iOS development, grow your user base, and monetize more effectivel
 
   s.subspec 'Firestore' do |ss|
     ss.dependency 'Firebase/CoreOnly'
-    ss.dependency 'FirebaseFirestore', '~> 1.7.0'
+    ss.dependency 'FirebaseFirestore', '~> 1.8.0'
   end
 
   s.subspec 'Functions' do |ss|
@@ -95,22 +95,22 @@ Simplify your iOS development, grow your user base, and monetize more effectivel
 
   s.subspec 'Messaging' do |ss|
     ss.dependency 'Firebase/CoreOnly'
-    ss.dependency 'FirebaseMessaging', '~> 4.1.8'
+    ss.dependency 'FirebaseMessaging', '~> 4.1.9'
   end
 
   s.subspec 'Performance' do |ss|
     ss.dependency 'Firebase/CoreOnly'
-    ss.ios.dependency 'FirebasePerformance', '~> 3.1.6'
+    ss.ios.dependency 'FirebasePerformance', '~> 3.1.7'
   end
 
   s.subspec 'RemoteConfig' do |ss|
     ss.dependency 'Firebase/CoreOnly'
-    ss.dependency 'FirebaseRemoteConfig', '~> 4.4.4'
+    ss.dependency 'FirebaseRemoteConfig', '~> 4.4.5'
   end
 
   s.subspec 'Storage' do |ss|
     ss.dependency 'Firebase/CoreOnly'
-    ss.dependency 'FirebaseStorage', '~> 3.4.1'
+    ss.dependency 'FirebaseStorage', '~> 3.4.2'
   end
 
   s.subspec 'MLCommon' do |ss|

+ 3 - 0
Firebase/Auth/CHANGELOG.md

@@ -1,3 +1,6 @@
+# v6.4.0
+- [feature] Added support for Sign-in with Apple. (#4183)
+
 # v6.3.1
 - [fixed] Removed usage of a deprecated property on iOS 13. (#4066)
 

+ 15 - 2
Firebase/Auth/Source/AuthProvider/OAuth/FIROAuthCredential.m

@@ -26,6 +26,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface FIROAuthCredential ()
 
+@property(nonatomic, nullable) NSString *rawNonce;
+
 - (nullable instancetype)initWithProvider:(NSString *)provider NS_UNAVAILABLE;
 
 @end
@@ -40,12 +42,14 @@ NS_ASSUME_NONNULL_BEGIN
 
 - (instancetype)initWithProviderID:(NSString *)providerID
                            IDToken:(nullable NSString *)IDToken
+                          rawNonce:(nullable NSString *)rawNonce
                        accessToken:(nullable NSString *)accessToken
                             secret:(nullable NSString *)secret
                       pendingToken:(nullable NSString *)pendingToken {
   self = [super initWithProvider:providerID];
   if (self) {
     _IDToken = IDToken;
+    _rawNonce = rawNonce;
     _accessToken = accessToken;
     _pendingToken = pendingToken;
     _secret = secret;
@@ -56,8 +60,12 @@ NS_ASSUME_NONNULL_BEGIN
 - (instancetype)initWithProviderID:(NSString *)providerID
                          sessionID:(NSString *)sessionID
             OAuthResponseURLString:(NSString *)OAuthResponseURLString {
-  self =
-      [self initWithProviderID:providerID IDToken:nil accessToken:nil secret:nil pendingToken:nil];
+  self = [self initWithProviderID:providerID
+                          IDToken:nil
+                         rawNonce:nil
+                      accessToken:nil
+                           secret:nil
+                     pendingToken:nil];
   if (self) {
     _OAuthResponseURLString = OAuthResponseURLString;
     _sessionID = sessionID;
@@ -71,6 +79,7 @@ NS_ASSUME_NONNULL_BEGIN
       response.oauthSecretToken.length) {
     return [self initWithProviderID:response.providerID
                             IDToken:response.oauthIDToken
+                           rawNonce:nil
                         accessToken:response.oauthAccessToken
                              secret:response.oauthSecretToken
                        pendingToken:response.pendingToken];
@@ -80,6 +89,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 - (void)prepareVerifyAssertionRequest:(FIRVerifyAssertionRequest *)request {
   request.providerIDToken = _IDToken;
+  request.providerRawNonce = _rawNonce;
   request.providerAccessToken = _accessToken;
   request.requestURI = _OAuthResponseURLString;
   request.sessionID = _sessionID;
@@ -95,11 +105,13 @@ NS_ASSUME_NONNULL_BEGIN
 
 - (nullable instancetype)initWithCoder:(NSCoder *)aDecoder {
   NSString *IDToken = [aDecoder decodeObjectOfClass:[NSString class] forKey:@"IDToken"];
+  NSString *rawNonce = [aDecoder decodeObjectOfClass:[NSString class] forKey:@"rawNonce"];
   NSString *accessToken = [aDecoder decodeObjectOfClass:[NSString class] forKey:@"accessToken"];
   NSString *pendingToken = [aDecoder decodeObjectOfClass:[NSString class] forKey:@"pendingToken"];
   NSString *secret = [aDecoder decodeObjectOfClass:[NSString class] forKey:@"secret"];
   self = [self initWithProviderID:self.provider
                           IDToken:IDToken
+                         rawNonce:rawNonce
                       accessToken:accessToken
                            secret:secret
                      pendingToken:pendingToken];
@@ -108,6 +120,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 - (void)encodeWithCoder:(NSCoder *)aCoder {
   [aCoder encodeObject:self.IDToken forKey:@"IDToken"];
+  [aCoder encodeObject:self.IDToken forKey:@"rawNonce"];
   [aCoder encodeObject:self.accessToken forKey:@"accessToken"];
   [aCoder encodeObject:self.pendingToken forKey:@"pendingToken"];
   [aCoder encodeObject:self.secret forKey:@"secret"];

+ 2 - 0
Firebase/Auth/Source/AuthProvider/OAuth/FIROAuthCredential_Internal.h

@@ -46,12 +46,14 @@ NS_ASSUME_NONNULL_BEGIN
     @brief Designated initializer.
     @param providerID The provider ID associated with the credential being created.
     @param IDToken The ID Token associated with the credential being created.
+    @param rawNonce The raw nonce associated with the Auth credential being created.
     @param accessToken The access token associated with the credential being created.
     @param secret The secret associated with the credential being created.
     @param pendingToken The pending token associated with the credential being created.
  */
 - (instancetype)initWithProviderID:(NSString *)providerID
                            IDToken:(nullable NSString *)IDToken
+                          rawNonce:(nullable NSString *)rawNonce
                        accessToken:(nullable NSString *)accessToken
                             secret:(nullable NSString *)secret
                       pendingToken:(nullable NSString *)pendingToken NS_DESIGNATED_INITIALIZER;

+ 25 - 0
Firebase/Auth/Source/AuthProvider/OAuth/FIROAuthProvider.m

@@ -71,6 +71,7 @@ static NSString *const kAuthTypeSignInWithRedirect = @"signInWithRedirect";
                                     accessToken:(nullable NSString *)accessToken {
   return [[FIROAuthCredential alloc] initWithProviderID:providerID
                                                 IDToken:IDToken
+                                               rawNonce:nil
                                             accessToken:accessToken
                                                  secret:nil
                                            pendingToken:nil];
@@ -80,11 +81,35 @@ static NSString *const kAuthTypeSignInWithRedirect = @"signInWithRedirect";
                                      accessToken:(NSString *)accessToken {
   return [[FIROAuthCredential alloc] initWithProviderID:providerID
                                                 IDToken:nil
+                                               rawNonce:nil
                                             accessToken:accessToken
                                                  secret:nil
                                            pendingToken:nil];
 }
 
++ (FIROAuthCredential *)credentialWithProviderID:(NSString *)providerID
+                                         IDToken:(NSString *)IDToken
+                                        rawNonce:(nullable NSString *)rawNonce
+                                     accessToken:(nullable NSString *)accessToken {
+  return [[FIROAuthCredential alloc] initWithProviderID:providerID
+                                                IDToken:IDToken
+                                               rawNonce:rawNonce
+                                            accessToken:accessToken
+                                                 secret:nil
+                                           pendingToken:nil];
+}
+
++ (FIROAuthCredential *)credentialWithProviderID:(NSString *)providerID
+                                         IDToken:(NSString *)IDToken
+                                        rawNonce:(nullable NSString *)rawNonce {
+  return [[FIROAuthCredential alloc] initWithProviderID:providerID
+                                                IDToken:IDToken
+                                               rawNonce:rawNonce
+                                            accessToken:nil
+                                                 secret:nil
+                                           pendingToken:nil];
+}
+
 + (instancetype)providerWithProviderID:(NSString *)providerID {
   return [[self alloc]initWithProviderID:providerID auth:[FIRAuth auth]];
 }

+ 9 - 0
Firebase/Auth/Source/Backend/FIRAuthBackend.m

@@ -342,6 +342,11 @@ static NSString *const kInvalidSessionInfoErrorMessage = @"INVALID_SESSION_INFO"
  */
 static NSString *const kSessionExpiredErrorMessage = @"SESSION_EXPIRED";
 
+/** @var kMissingOrInvalidNonceErrorMessage
+    @brief This is the error message the server will respond with if the nonce is missing or invalid.
+ */
+static NSString *const kMissingOrInvalidNonceErrorMessage = @"MISSING_OR_INVALID_NONCE";
+
 /** @var kMissingAppTokenErrorMessage
     @brief This is the error message the server will respond with if the APNS token is missing in a
         verifyClient request.
@@ -1176,6 +1181,10 @@ static id<FIRAuthBackendImplementation> gBackendImplementation;
     return [FIRAuthErrorUtils captchaCheckFailedErrorWithMessage:serverErrorMessage];
   }
 
+  if ([shortErrorMessage isEqualToString:kMissingOrInvalidNonceErrorMessage]) {
+    return [FIRAuthErrorUtils missingOrInvalidNonceErrorWithMessage:serverDetailErrorMessage];
+  }
+
   // In this case we handle an error that might be specified in the underlying errors dictionary,
   // the error message in determined based on the @c reason key in the dictionary.
   if (errorDictionary[kErrorsKey]) {

+ 5 - 0
Firebase/Auth/Source/Backend/RPC/FIRVerifyAssertionRequest.h

@@ -66,6 +66,11 @@ NS_ASSUME_NONNULL_BEGIN
  */
 @property(nonatomic, copy, nullable) NSString *providerIDToken;
 
+/** @property providerRawNonce
+    @brief An raw nonce from the IDP.
+ */
+@property(nonatomic, copy, nullable) NSString *providerRawNonce;
+
 /** @property returnIDPCredential
     @brief Whether the response should return the IDP credential directly.
  */

+ 10 - 0
Firebase/Auth/Source/Backend/RPC/FIRVerifyAssertionRequest.m

@@ -33,6 +33,11 @@ static NSString *const kProviderIDKey = @"providerId";
  */
 static NSString *const kProviderIDTokenKey = @"id_token";
 
+/** @var kProviderNonceKey
+    @brief The key for the "nonce" value in the request.
+ */
+static NSString *const kProviderNonceKey = @"nonce";
+
 /** @var kProviderAccessTokenKey
     @brief The key for the "access_token" value in the request.
  */
@@ -115,6 +120,11 @@ static NSString *const kSessionIDKey = @"sessionId";
                                                       value:_providerIDToken]];
   }
 
+  if (_providerRawNonce) {
+    [queryItems addObject:[NSURLQueryItem queryItemWithName:kProviderNonceKey
+                                                      value:_providerRawNonce]];
+  }
+
   if (_providerAccessToken) {
     [queryItems addObject:[NSURLQueryItem queryItemWithName:kProviderAccessTokenKey
                                                       value:_providerAccessToken]];

+ 4 - 0
Firebase/Auth/Source/Public/FIRAuthErrors.h

@@ -343,6 +343,10 @@ typedef NS_ENUM(NSInteger, FIRAuthErrorCode) {
      */
     FIRAuthErrorCodeGameKitNotLinked = 17076,
 
+    /** Indicates that the nonce is missing or invalid.
+     */
+    FIRAuthErrorCodeMissingOrInvalidNonce = 17094,
+
     /** Indicates an error for when the client identifier is missing.
      */
     FIRAuthErrorCodeMissingClientIdentifier = 17993,

+ 29 - 0
Firebase/Auth/Source/Public/FIROAuthProvider.h

@@ -85,6 +85,35 @@ NS_SWIFT_NAME(OAuthProvider)
 + (FIROAuthCredential *)credentialWithProviderID:(NSString *)providerID
                                      accessToken:(NSString *)accessToken;
 
+/** @fn credentialWithProviderID:IDToken:rawNonce:accessToken:
+    @brief Creates an `FIRAuthCredential` for that OAuth 2 provider identified by providerID, ID
+        token, raw nonce and access token.
+
+    @param providerID The provider ID associated with the Auth credential being created.
+    @param IDToken The IDToken associated with the Auth credential being created.
+    @param rawNonce The raw nonce associated with the Auth credential being created.
+    @param accessToken The accessstoken associated with the Auth credential be created, if
+        available.
+    @return A FIRAuthCredential for the specified provider ID, ID token and access token.
+ */
++ (FIROAuthCredential *)credentialWithProviderID:(NSString *)providerID
+                                         IDToken:(NSString *)IDToken
+                                        rawNonce:(nullable NSString *)rawNonce
+                                     accessToken:(nullable NSString *)accessToken;
+
+/** @fn credentialWithProviderID:IDToken:rawNonce:
+    @brief Creates an `FIRAuthCredential` for that OAuth 2 provider identified by providerID using
+      an ID token and raw nonce.
+
+    @param providerID The provider ID associated with the Auth credential being created.
+    @param IDToken The IDToken associated with the Auth credential being created.
+    @param rawNonce The raw nonce associated with the Auth credential being created.
+    @return A FIRAuthCredential.
+ */
++ (FIROAuthCredential *)credentialWithProviderID:(NSString *)providerID
+                                         IDToken:(NSString *)IDToken
+                                        rawNonce:(nullable NSString *)rawNonce;
+
 /** @fn init
     @brief This class is not meant to be initialized.
  */

+ 7 - 0
Firebase/Auth/Source/Utilities/FIRAuthErrorUtils.h

@@ -556,6 +556,13 @@ NS_ASSUME_NONNULL_BEGIN
  */
 + (NSError *)keychainErrorWithFunction:(NSString *)keychainFunction status:(OSStatus)status;
 
+/** @fn missingOrInvalidNonceErrorWithMessage:
+    @brief Constructs an @c NSError with the code and message provided.
+    @param message Error message from the backend, if any.
+    @return The nullable NSError instance associated with the given error message, if one is found.
+*/
++ (NSError *)missingOrInvalidNonceErrorWithMessage:(nullable NSString *)message;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 14 - 0
Firebase/Auth/Source/Utilities/FIRAuthErrorUtils.m

@@ -463,6 +463,12 @@ static NSString *const kFIRAuthErrorMessageDynamicLinkNotActivated =
 static NSString *const kFIRAuthErrorMessageRejectedCredential =
     @"The request contains malformed or mismatching credentials.";
 
+/** @var kFIRAuthErrorMessageMissingOrInvalidNonce
+    @brief Error message constant describing @c FIRAuthErrorCodeMissingOrInvalidNonce errors.
+ */
+static NSString *const kFIRAuthErrorMessageMissingOrInvalidNonce =
+    @"The request contains malformed or mismatched credentials.";
+
 /** @var FIRAuthErrorDescription
     @brief The error descrioption, based on the error code.
     @remarks No default case so that we get a compiler warning if a new value was added to the enum.
@@ -599,6 +605,8 @@ static NSString *FIRAuthErrorDescription(FIRAuthErrorCode code) {
       return kFIRAuthErrorMessageDynamicLinkNotActivated;
     case FIRAuthErrorCodeRejectedCredential:
       return kFIRAuthErrorMessageRejectedCredential;
+    case FIRAuthErrorCodeMissingOrInvalidNonce:
+      return kFIRAuthErrorMessageMissingOrInvalidNonce;
   }
 }
 
@@ -738,6 +746,8 @@ static NSString *const FIRAuthErrorCodeString(FIRAuthErrorCode code) {
       return @"ERROR_DYNAMIC_LINK_NOT_ACTIVATED";
     case FIRAuthErrorCodeRejectedCredential:
       return @"ERROR_REJECTED_CREDENTIAL";
+    case FIRAuthErrorCodeMissingOrInvalidNonce:
+      return @"ERROR_MISSING_OR_INVALID_NONCE";
   }
 }
 
@@ -1179,6 +1189,10 @@ static NSString *const FIRAuthErrorCodeString(FIRAuthErrorCode code) {
   return [self errorWithCode:FIRAuthInternalErrorCodeInvalidDynamicLinkDomain message:message];
 }
 
++ (NSError *)missingOrInvalidNonceErrorWithMessage:(nullable NSString *)message {
+  return [self errorWithCode:FIRAuthInternalErrorCodeMissingOrInvalidNonce message:message];
+}
+
 + (NSError *)keychainErrorWithFunction:(NSString *)keychainFunction status:(OSStatus)status {
   NSString *failureReason = [NSString stringWithFormat:@"%@ (%li)", keychainFunction, (long)status];
   return [self errorWithCode:FIRAuthInternalErrorCodeKeychainError userInfo:@{

+ 5 - 0
Firebase/Auth/Source/Utilities/FIRAuthInternalErrors.h

@@ -393,6 +393,11 @@ typedef NS_ENUM(NSInteger, FIRAuthInternalErrorCode) {
   FIRAuthInternalErrorCodeGameKitNotLinked =
       FIRAuthPublicErrorCodeFlag | FIRAuthErrorCodeGameKitNotLinked,
 
+  /** Indicates that the nonce is missing or invalid.
+   */
+  FIRAuthInternalErrorCodeMissingOrInvalidNonce =
+      FIRAuthPublicErrorCodeFlag | FIRAuthErrorCodeMissingOrInvalidNonce,
+
   /** Indicates that a non-null user was expected as an argmument to the operation but a null
         user was provided.
    */

+ 4 - 0
Firebase/Core/CHANGELOG.md

@@ -1,3 +1,7 @@
+# v6.4.0 -- M60
+- [changed] Administrative minor version update to prepare for an upcoming Firebase pod
+  open source.
+
 # v6.3.3 -- M59
 - [changed] Carthage and zip file distributions are now built with Xcode 11.0.
   The Carthage and zip file distributions no longer support Xcode 10.3 and below.

+ 61 - 0
Firebase/Core/FIRHeartbeatInfo.m

@@ -0,0 +1,61 @@
+// Copyright 2019 Google
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#import "FIRHeartbeatInfo.h"
+#import <GoogleUtilities/GULHeartbeatDateStorage.h>
+#import <GoogleUtilities/GULLogger.h>
+
+const static long secondsInDay = 864000;
+@implementation FIRHeartbeatInfo : NSObject
+
+/** Updates the storage with the heartbeat information corresponding to this tag.
+ * @param heartbeatTag Tag which could either be sdk specific tag or the global tag.
+ * @return Boolean representing whether the heartbeat needs to be sent for this tag or not.
+ */
++ (BOOL)updateIfNeededHeartbeatDateForTag:(NSString *)heartbeatTag {
+  @synchronized(self) {
+    NSString *const kHeartbeatStorageFile = @"HEARTBEAT_INFO_STORAGE";
+    GULHeartbeatDateStorage *dataStorage =
+        [[GULHeartbeatDateStorage alloc] initWithFileName:kHeartbeatStorageFile];
+    NSDate *heartbeatTime = [dataStorage heartbeatDateForTag:heartbeatTag];
+    NSDate *currentDate = [NSDate date];
+    if (heartbeatTime != nil) {
+      NSTimeInterval secondsBetween = [currentDate timeIntervalSinceDate:heartbeatTime];
+      if (secondsBetween < secondsInDay) {
+        return false;
+      }
+    }
+    return [dataStorage setHearbeatDate:currentDate forTag:heartbeatTag];
+  }
+}
+
++ (FIRHeartbeatInfoCode)heartbeatCodeForTag:(NSString *)heartbeatTag {
+  NSString *globalTag = @"GLOBAL";
+  BOOL isSdkHeartbeatNeeded = [FIRHeartbeatInfo updateIfNeededHeartbeatDateForTag:heartbeatTag];
+  BOOL isGlobalHeartbeatNeeded = [FIRHeartbeatInfo updateIfNeededHeartbeatDateForTag:globalTag];
+  if (!isSdkHeartbeatNeeded && !isGlobalHeartbeatNeeded) {
+    // Both sdk and global heartbeat not needed.
+    return FIRHeartbeatInfoCodeNone;
+  } else if (isSdkHeartbeatNeeded && !isGlobalHeartbeatNeeded) {
+    // Only SDK heartbeat needed.
+    return FIRHeartbeatInfoCodeSDK;
+  } else if (!isSdkHeartbeatNeeded && isGlobalHeartbeatNeeded) {
+    // Only global heartbeat needed.
+    return FIRHeartbeatInfoCodeGlobal;
+  } else {
+    // Both sdk and global heartbeat are needed.
+    return FIRHeartbeatInfoCodeCombined;
+  }
+}
+@end

+ 39 - 0
Firebase/Core/Private/FIRHeartbeatInfo.h

@@ -0,0 +1,39 @@
+// Copyright 2019 Google
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface FIRHeartbeatInfo : NSObject
+
+// Enum representing the different heartbeat codes.
+typedef NS_ENUM(NSInteger, FIRHeartbeatInfoCode) {
+  FIRHeartbeatInfoCodeNone = 0,
+  FIRHeartbeatInfoCodeSDK = 1,
+  FIRHeartbeatInfoCodeGlobal = 2,
+  FIRHeartbeatInfoCodeCombined = 3,
+};
+
+/**
+ * Get heartbeat code requred for the sdk.
+ * @param heartbeatTag String representing the sdk heartbeat tag.
+ * @return Heartbeat code indicating whether or not an sdk/global heartbeat
+ * needs to be sent
+ */
++ (FIRHeartbeatInfoCode)heartbeatCodeForTag:(NSString *)heartbeatTag;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 10 - 45
Firebase/CoreDiagnostics/FIRCDLibrary/FIRCoreDiagnostics.m

@@ -23,6 +23,7 @@
 #import <GoogleDataTransport/GDTCORTransport.h>
 
 #import <GoogleUtilities/GULAppEnvironmentUtil.h>
+#import <GoogleUtilities/GULHeartbeatDateStorage.h>
 #import <GoogleUtilities/GULLogger.h>
 
 #import <FirebaseCoreDiagnosticsInterop/FIRCoreDiagnosticsData.h>
@@ -34,8 +35,6 @@
 
 #import "FIRCDLibrary/Protogen/nanopb/firebasecore.nanopb.h"
 
-#import "FIRCDLibrary/FIRCoreDiagnosticsDateFileStorage.h"
-
 /** The logger service string to use when printing to the console. */
 static GULLoggerService kFIRCoreDiagnostics = @"[FirebaseCoreDiagnostics/FIRCoreDiagnostics]";
 
@@ -85,6 +84,7 @@ static NSString *const kFIRAppDiagnosticsConfigurationTypeKey =
 static NSString *const kFIRAppDiagnosticsFIRAppKey = @"FIRAppDiagnosticsFIRAppKey";
 static NSString *const kFIRAppDiagnosticsSDKNameKey = @"FIRAppDiagnosticsSDKNameKey";
 static NSString *const kFIRAppDiagnosticsSDKVersionKey = @"FIRAppDiagnosticsSDKVersionKey";
+static NSString *const kFIRCoreDiagnosticsHeartbeatTag = @"FIRCoreDiagnostics";
 
 /**
  * The file name to the recent heartbeat date.
@@ -153,7 +153,7 @@ NS_ASSUME_NONNULL_BEGIN
 @property(nonatomic, readonly) GDTCORTransport *transport;
 
 /** The storage to store the date of the last sent heartbeat. */
-@property(nonatomic, readonly) FIRCoreDiagnosticsDateFileStorage *heartbeatDateStorage;
+@property(nonatomic, readonly) GULHeartbeatDateStorage *heartbeatDateStorage;
 
 @end
 
@@ -173,10 +173,10 @@ NS_ASSUME_NONNULL_END
 - (instancetype)init {
   GDTCORTransport *transport = [[GDTCORTransport alloc] initWithMappingID:@"137"
                                                              transformers:nil
-                                                                   target:kGDTCORTargetCCT];
+                                                                   target:kGDTCORTargetFLL];
 
-  FIRCoreDiagnosticsDateFileStorage *dateStorage = [[FIRCoreDiagnosticsDateFileStorage alloc]
-      initWithFileURL:[[self class] filePathURLWithName:kFIRCoreDiagnosticsHeartbeatDateFileName]];
+  GULHeartbeatDateStorage *dateStorage =
+      [[GULHeartbeatDateStorage alloc] initWithFileName:kFIRCoreDiagnosticsHeartbeatDateFileName];
 
   return [self initWithTransport:transport heartbeatDateStorage:dateStorage];
 }
@@ -188,7 +188,7 @@ NS_ASSUME_NONNULL_END
  * @return Returns the initialized `FIRCoreDiagnostics` instance.
  */
 - (instancetype)initWithTransport:(GDTCORTransport *)transport
-             heartbeatDateStorage:(FIRCoreDiagnosticsDateFileStorage *)heartbeatDateStorage {
+             heartbeatDateStorage:(GULHeartbeatDateStorage *)heartbeatDateStorage {
   self = [super init];
   if (self) {
     _diagnosticsQueue =
@@ -199,37 +199,6 @@ NS_ASSUME_NONNULL_END
   return self;
 }
 
-#pragma mark - File path helpers
-
-/** Returns the URL path of the file with name fileName under the Application Support folder for
- * local logging. Creates the Application Support folder if the folder doesn't exist.
- *
- * @return the URL path of the file with the name fileName in Application Support.
- */
-+ (NSURL *)filePathURLWithName:(NSString *)fileName {
-  @synchronized(self) {
-    NSArray<NSString *> *paths =
-        NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
-    NSArray<NSString *> *components = @[ paths.lastObject, @"Google/FIRApp" ];
-    NSString *directoryString = [NSString pathWithComponents:components];
-    NSURL *directoryURL = [NSURL fileURLWithPath:directoryString];
-
-    NSError *error;
-    if (![directoryURL checkResourceIsReachableAndReturnError:&error]) {
-      // If fail creating the Application Support directory, return nil.
-      if (![[NSFileManager defaultManager] createDirectoryAtURL:directoryURL
-                                    withIntermediateDirectories:YES
-                                                     attributes:nil
-                                                          error:&error]) {
-        GULLogWarning(kFIRCoreDiagnostics, YES, @"I-COR100001",
-                      @"Unable to create internal state storage: %@", error);
-        return nil;
-      }
-    }
-    return [directoryURL URLByAppendingPathComponent:fileName];
-  }
-}
-
 #pragma mark - Metadata helpers
 
 /** Returns the model of iOS device. Sample platform strings are @"iPhone7,1" for iPhone 6 Plus,
@@ -648,7 +617,8 @@ void FIRPopulateProtoWithInfoPlistValues(logs_proto_mobilesdk_ios_ICoreConfigura
 - (void)setHeartbeatFlagIfNeededToConfig:(logs_proto_mobilesdk_ios_ICoreConfiguration *)config {
   // Check if need to send a heartbeat.
   NSDate *currentDate = [NSDate date];
-  NSDate *lastCheckin = [self.heartbeatDateStorage date];
+  NSDate *lastCheckin =
+      [self.heartbeatDateStorage heartbeatDateForTag:kFIRCoreDiagnosticsHeartbeatTag];
   if (lastCheckin) {
     // Ensure the previous checkin was on a different date in the past.
     if ([self isDate:currentDate inSameDayOrBeforeThan:lastCheckin]) {
@@ -657,12 +627,7 @@ void FIRPopulateProtoWithInfoPlistValues(logs_proto_mobilesdk_ios_ICoreConfigura
   }
 
   // Update heartbeat sent date.
-  NSError *error;
-  if (![self.heartbeatDateStorage setDate:currentDate error:&error]) {
-    GULLogError(kFIRCoreDiagnostics, NO, @"I-COR100004", @"Unable to persist internal state: %@",
-                error);
-  }
-
+  [self.heartbeatDateStorage setHearbeatDate:currentDate forTag:kFIRCoreDiagnosticsHeartbeatTag];
   // Set the flag.
   config->sdk_name = logs_proto_mobilesdk_ios_ICoreConfiguration_ServiceType_ICORE;
   config->has_sdk_name = 1;

+ 0 - 64
Firebase/CoreDiagnostics/FIRCDLibrary/FIRCoreDiagnosticsDateFileStorage.m

@@ -1,64 +0,0 @@
-/*
- * Copyright 2019 Google
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#import "FIRCDLibrary/FIRCoreDiagnosticsDateFileStorage.h"
-
-@interface FIRCoreDiagnosticsDateFileStorage ()
-@property(nonatomic, readonly) NSURL *fileURL;
-@end
-
-@implementation FIRCoreDiagnosticsDateFileStorage
-
-- (instancetype)initWithFileURL:(NSURL *)fileURL {
-  if (fileURL == nil) {
-    return nil;
-  }
-
-  self = [super init];
-  if (self) {
-    _fileURL = fileURL;
-  }
-
-  return self;
-}
-
-- (BOOL)setDate:(nullable NSDate *)date error:(NSError **)outError {
-  NSString *stringToSave = @"";
-
-  if (date != nil) {
-    NSTimeInterval timestamp = [date timeIntervalSinceReferenceDate];
-    stringToSave = [NSString stringWithFormat:@"%f", timestamp];
-  }
-
-  return [stringToSave writeToURL:self.fileURL
-                       atomically:YES
-                         encoding:NSUTF8StringEncoding
-                            error:outError];
-}
-
-- (nullable NSDate *)date {
-  NSString *timestampString = [NSString stringWithContentsOfURL:self.fileURL
-                                                       encoding:NSUTF8StringEncoding
-                                                          error:nil];
-  if (timestampString.length == 0) {
-    return nil;
-  }
-
-  NSTimeInterval timestamp = timestampString.doubleValue;
-  return [NSDate dateWithTimeIntervalSinceReferenceDate:timestamp];
-}
-
-@end

+ 3 - 0
Firebase/Messaging/CHANGELOG.md

@@ -1,3 +1,6 @@
+# 2019-11-19 -- v4.1.9
+- [changed] Moved message queue delete operation to a serial queue to avoid race conditions in unit tests. (#4236)
+
 # 2019-11-05 -- v4.1.8
 - [changed] Moved reliable message queue database operation off main thread. (#4053)
 

+ 3 - 0
Firebase/Storage/CHANGELOG.md

@@ -1,3 +1,6 @@
+# 3.4.2
+- [fixed] Internal changes to addres -Wunused-property-ivar violation (#4281).
+
 # 3.4.1
 - [fixed] Fix crash in FIRStorageUploadTask (#3750).
 

+ 6 - 2
Firebase/Storage/FIRStorage.m

@@ -170,7 +170,7 @@ static GTMSessionFetcherRetryBlock _retryWhenOffline;
   FIRStorage *storage = [[[self class] allocWithZone:zone] initWithApp:_app
                                                                 bucket:_storageBucket
                                                                   auth:_auth];
-  storage.callbackQueue = _callbackQueue;
+  storage.callbackQueue = self.callbackQueue;
   return storage;
 }
 
@@ -195,7 +195,7 @@ static GTMSessionFetcherRetryBlock _retryWhenOffline;
 }
 
 - (NSUInteger)hash {
-  NSUInteger hash = [_app hash] ^ [_callbackQueue hash];
+  NSUInteger hash = [_app hash] ^ [self.callbackQueue hash];
   return hash;
 }
 
@@ -236,6 +236,10 @@ static GTMSessionFetcherRetryBlock _retryWhenOffline;
   return reference;
 }
 
+- (dispatch_queue_t)callbackQueue {
+  return _fetcherServiceForApp.callbackQueue;
+}
+
 - (void)setCallbackQueue:(dispatch_queue_t)callbackQueue {
   _fetcherServiceForApp.callbackQueue = callbackQueue;
 }

+ 1 - 1
FirebaseAuth.podspec

@@ -1,6 +1,6 @@
 Pod::Spec.new do |s|
   s.name             = 'FirebaseAuth'
-  s.version          = '6.3.1'
+  s.version          = '6.4.0'
   s.summary          = 'The official iOS client for Firebase Authentication (plus community support for macOS and tvOS)'
 
   s.description      = <<-DESC

+ 4 - 4
FirebaseCore.podspec

@@ -1,6 +1,6 @@
 Pod::Spec.new do |s|
   s.name             = 'FirebaseCore'
-  s.version          = '6.3.3'
+  s.version          = '6.4.0'
   s.summary          = 'Firebase Core for iOS (plus community support for macOS and tvOS)'
 
   s.description      = <<-DESC
@@ -31,15 +31,15 @@ Firebase Core includes FIRApp and FIROptions which provide central configuration
   s.ios.framework = 'UIKit'
   s.osx.framework = 'AppKit'
   s.tvos.framework = 'UIKit'
-  s.dependency 'GoogleUtilities/Environment', '~> 6.2'
-  s.dependency 'GoogleUtilities/Logger', '~> 6.2'
+  s.dependency 'GoogleUtilities/Environment', '~> 6.4'
+  s.dependency 'GoogleUtilities/Logger', '~> 6.4'
   s.dependency 'FirebaseCoreDiagnosticsInterop', '~> 1.0'
   s.dependency 'FirebaseCoreDiagnostics', '~> 1.0'
 
   s.pod_target_xcconfig = {
     'GCC_C_LANGUAGE_STANDARD' => 'c99',
     'GCC_PREPROCESSOR_DEFINITIONS' =>
-      'FIRCore_VERSION=' + s.version.to_s + ' Firebase_VERSION=6.12.0',
+      'FIRCore_VERSION=' + s.version.to_s + ' Firebase_VERSION=6.13.0',
     'OTHER_CFLAGS' => '-fno-autolink'
   }
   s.test_spec 'unit' do |unit_tests|

+ 1 - 3
FirebaseFirestore.podspec

@@ -1,6 +1,6 @@
 Pod::Spec.new do |s|
   s.name             = 'FirebaseFirestore'
-  s.version          = '1.7.0'
+  s.version          = '1.8.0'
   s.summary          = 'Google Cloud Firestore for iOS'
 
   s.description      = <<-DESC
@@ -73,7 +73,6 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling,
 
   s.dependency 'gRPC-C++', '0.0.9'
   s.dependency 'leveldb-library', '~> 1.22'
-  s.dependency 'Protobuf', '~> 3.9', '>= 3.9.2'
   s.dependency 'nanopb', '~> 0.3.901'
 
   s.ios.frameworks = 'MobileCoreServices', 'SystemConfiguration'
@@ -86,7 +85,6 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling,
     'GCC_C_LANGUAGE_STANDARD' => 'c99',
     'GCC_PREPROCESSOR_DEFINITIONS' =>
       "FIRFirestore_VERSION=#{s.version} " +
-      'GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1 ' +
       # The nanopb pod sets these defs, so we must too. (We *do* require 16bit
       # (or larger) fields, so we'd have to set at least PB_FIELD_16BIT
       # anyways.)

+ 1 - 1
FirebaseMessaging.podspec

@@ -1,6 +1,6 @@
 Pod::Spec.new do |s|
   s.name             = 'FirebaseMessaging'
-  s.version          = '4.1.8'
+  s.version          = '4.1.9'
   s.summary          = 'Firebase Messaging for iOS'
 
   s.description      = <<-DESC

+ 1 - 1
FirebaseRemoteConfig.podspec

@@ -1,6 +1,6 @@
 Pod::Spec.new do |s|
   s.name             = 'FirebaseRemoteConfig'
-  s.version          = '4.4.4'
+  s.version          = '4.4.5'
   s.summary          = 'Firebase RemoteConfig for iOS'
 
   s.description      = <<-DESC

+ 3 - 0
FirebaseRemoteConfig/CHANGELOG.md

@@ -1,3 +1,6 @@
+# v4.4.5
+- [changed] Remote Config no longer re-activates the current config on fetch if it receives no changes from the backend. (#4260)
+
 # v4.4.4
 - Minor internal project structure changes.
 

+ 4 - 4
FirebaseRemoteConfig/Sources/FIRRemoteConfig.m

@@ -291,10 +291,10 @@ static NSMutableDictionary<NSString *, NSMutableDictionary<NSString *, FIRRemote
       FIRLogError(kFIRLoggerRemoteConfig, @"I-RCN000068", @"Internal error activating config.");
       return;
     }
-    // If Fetched Config is no fresher than Active Config.
-    if (strongSelf->_settings.lastFetchTimeInterval == 0 ||
-        strongSelf->_settings.lastFetchTimeInterval <=
-            strongSelf->_settings.lastApplyTimeInterval) {
+    // Check if the last fetched config has already been activated. Fetches with no data change are
+    // ignored.
+    if (strongSelf->_settings.lastETagUpdateTime == 0 ||
+        strongSelf->_settings.lastETagUpdateTime <= strongSelf->_settings.lastApplyTimeInterval) {
       FIRLogWarning(kFIRLoggerRemoteConfig, @"I-RCN000069",
                     @"Most recently fetched config is already activated.");
       NSError *error = [NSError

+ 2 - 0
FirebaseRemoteConfig/Sources/Private/RCNConfigSettings.h

@@ -76,6 +76,8 @@
 @property(nonatomic, readwrite, assign) NSTimeInterval lastSetDefaultsTimeInterval;
 /// The latest eTag value stored from the last successful response.
 @property(nonatomic, readwrite, assign) NSString *lastETag;
+/// The timestamp of the last eTag update.
+@property(nonatomic, readwrite, assign) NSTimeInterval lastETagUpdateTime;
 
 #pragma mark Throttling properties
 

+ 11 - 0
FirebaseRemoteConfig/Sources/RCNConfigSettings.m

@@ -67,6 +67,8 @@ static const int kRCNExponentialBackoffMaximumInterval = 60 * 60 * 4;  // 4 hour
   NSString *_googleAppID;
   /// The user defaults manager scoped to this RC instance of FIRApp and namespace.
   RCNUserDefaultsManager *_userDefaultsManager;
+  /// The timestamp of last eTag update.
+  NSTimeInterval _lastETagUpdateTime;
 }
 @end
 
@@ -111,13 +113,22 @@ static const int kRCNExponentialBackoffMaximumInterval = 60 * 60 * 4;  // 4 hour
 }
 
 - (void)setLastETag:(NSString *)lastETag {
+  [self setLastETagUpdateTime:[[NSDate date] timeIntervalSince1970]];
   [_userDefaultsManager setLastETag:lastETag];
 }
 
+- (void)setLastETagUpdateTime:(NSTimeInterval)lastETagUpdateTime {
+  [_userDefaultsManager setLastETagUpdateTime:lastETagUpdateTime];
+}
+
 - (NSTimeInterval)lastFetchTimeInterval {
   return _userDefaultsManager.lastFetchTime;
 }
 
+- (NSTimeInterval)lastETagUpdateTime {
+  return _userDefaultsManager.lastETagUpdateTime;
+}
+
 // TODO: Update logic for app extensions as required.
 - (void)updateLastFetchTimeInterval:(NSTimeInterval)lastFetchTimeInterval {
   _userDefaultsManager.lastFetchTime = lastFetchTimeInterval;

+ 5 - 2
FirebaseRemoteConfig/Sources/RCNFetch.m

@@ -476,8 +476,11 @@ static RCNConfigFetcherTestBlock gGlobalTestBlock;
                     @"Empty response with no fetched config.");
       }
 
-      // We had a successful fetch. Update the current eTag in settings.
-      self->_settings.lastETag = ((NSHTTPURLResponse *)response).allHeaderFields[kETagHeaderName];
+      // We had a successful fetch. Update the current eTag in settings if different.
+      NSString *latestETag = ((NSHTTPURLResponse *)response).allHeaderFields[kETagHeaderName];
+      if (!self->_settings.lastETag || !([self->_settings.lastETag isEqualToString:latestETag])) {
+        self->_settings.lastETag = latestETag;
+      }
 
       [self->_settings updateMetadataWithFetchSuccessStatus:YES];
       return [strongSelf reportCompletionOnHandler:completionHandler

+ 2 - 0
FirebaseRemoteConfig/Sources/RCNUserDefaultsManager.h

@@ -22,6 +22,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 /// The last eTag received from the backend.
 @property(nonatomic, assign) NSString *lastETag;
+/// The time of the last eTag update.
+@property(nonatomic, assign) NSTimeInterval lastETagUpdateTime;
 /// The time of the last successful fetch.
 @property(nonatomic, assign) NSTimeInterval lastFetchTime;
 /// The time of the last successful fetch.

+ 14 - 0
FirebaseRemoteConfig/Sources/RCNUserDefaultsManager.m

@@ -21,6 +21,7 @@
 static NSString *const kRCNGroupPrefix = @"group";
 static NSString *const kRCNGroupSuffix = @"firebase";
 static NSString *const kRCNUserDefaultsKeyNamelastETag = @"lastETag";
+static NSString *const kRCNUserDefaultsKeyNamelastETagUpdateTime = @"lastETagUpdateTime";
 static NSString *const kRCNUserDefaultsKeyNameLastSuccessfulFetchTime = @"lastSuccessfulFetchTime";
 static NSString *const kRCNUserDefaultsKeyNamelastFetchStatus = @"lastFetchStatus";
 static NSString *const kRCNUserDefaultsKeyNameIsClientThrottled =
@@ -105,6 +106,19 @@ static NSString *const kRCNUserDefaultsKeyNamecurrentThrottlingRetryInterval =
   }
 }
 
+- (NSTimeInterval)lastETagUpdateTime {
+  NSNumber *lastETagUpdateTime =
+      [[self instanceUserDefaults] objectForKey:kRCNUserDefaultsKeyNamelastETagUpdateTime];
+  return lastETagUpdateTime.doubleValue;
+}
+
+- (void)setLastETagUpdateTime:(NSTimeInterval)lastETagUpdateTime {
+  if (lastETagUpdateTime) {
+    [self setInstanceUserDefaultsValue:@(lastETagUpdateTime)
+                                forKey:kRCNUserDefaultsKeyNamelastETagUpdateTime];
+  }
+}
+
 - (NSTimeInterval)lastFetchTime {
   NSNumber *lastFetchTime =
       [[self instanceUserDefaults] objectForKey:kRCNUserDefaultsKeyNameLastSuccessfulFetchTime];

+ 126 - 0
FirebaseRemoteConfig/Tests/Unit/RCNRemoteConfigTest.m

@@ -560,6 +560,132 @@ typedef NS_ENUM(NSInteger, RCNTestRCInstance) {
                                }];
 }
 
+// Activate should return false if a fetch response returns 200 with NO_CHANGE as the response body.
+- (void)testActivateOnFetchNoChangeStatus {
+  // Override the setup values to return back an error status.
+  RCNConfigContent *configContent = [[RCNConfigContent alloc] initWithDBManager:_DBManager];
+  // Populate the default, second app, second namespace instances.
+  for (int i = 0; i < RCNTestRCNumTotalInstances; i++) {
+    NSString *currentAppName = nil;
+    FIROptions *currentOptions = nil;
+    NSString *currentNamespace = nil;
+    switch (i) {
+      case RCNTestRCInstanceSecondNamespace:
+        currentAppName = RCNTestsDefaultFIRAppName;
+        currentOptions = [self firstAppOptions];
+        currentNamespace = RCNTestsPerfNamespace;
+        break;
+      case RCNTestRCInstanceSecondApp:
+        currentAppName = RCNTestsSecondFIRAppName;
+        currentOptions = [self secondAppOptions];
+        currentNamespace = FIRNamespaceGoogleMobilePlatform;
+        break;
+      case RCNTestRCInstanceDefault:
+      default:
+        currentAppName = RCNTestsDefaultFIRAppName;
+        currentOptions = [self firstAppOptions];
+        currentNamespace = RCNTestsFIRNamespace;
+        break;
+    }
+    NSString *fullyQualifiedNamespace =
+        [NSString stringWithFormat:@"%@:%@", currentNamespace, currentAppName];
+    RCNUserDefaultsManager *userDefaultsManager =
+        [[RCNUserDefaultsManager alloc] initWithAppName:currentAppName
+                                               bundleID:[NSBundle mainBundle].bundleIdentifier
+                                              namespace:fullyQualifiedNamespace];
+    userDefaultsManager.lastFetchTime = 10;
+
+    FIRRemoteConfig *config =
+        OCMPartialMock([[FIRRemoteConfig alloc] initWithAppName:currentAppName
+                                                     FIROptions:currentOptions
+                                                      namespace:currentNamespace
+                                                      DBManager:_DBManager
+                                                  configContent:configContent
+                                                      analytics:nil]);
+
+    _configInstances[i] = config;
+    RCNConfigSettings *settings =
+        [[RCNConfigSettings alloc] initWithDatabaseManager:_DBManager
+                                                 namespace:fullyQualifiedNamespace
+                                           firebaseAppName:currentAppName
+                                               googleAppID:currentOptions.googleAppID];
+    // Start the test with the assumption that we have some data that was fetched and activated.
+    settings.lastETag = @"etag1";
+    settings.lastETagUpdateTime = 100;
+    settings.lastApplyTimeInterval = 101;
+
+    dispatch_queue_t queue =
+        dispatch_queue_create([[NSString stringWithFormat:@"testNoStatusFetchQueue: %d", i]
+                                  cStringUsingEncoding:NSUTF8StringEncoding],
+                              DISPATCH_QUEUE_SERIAL);
+    _configFetch[i] = OCMPartialMock([[RCNConfigFetch alloc] initWithContent:configContent
+                                                                   DBManager:_DBManager
+                                                                    settings:settings
+                                                                   analytics:nil
+                                                                  experiment:nil
+                                                                       queue:queue
+                                                                   namespace:fullyQualifiedNamespace
+                                                                     options:currentOptions]);
+
+    OCMStub([_configFetch[i] fetchAllConfigsWithExpirationDuration:43200
+                                                 completionHandler:OCMOCK_ANY])
+        .andDo(^(NSInvocation *invocation) {
+          void (^handler)(FIRRemoteConfigFetchStatus status, NSError *_Nullable error) = nil;
+
+          [invocation getArgument:&handler atIndex:3];
+          [_configFetch[i] fetchWithUserProperties:[[NSDictionary alloc] init]
+                                 completionHandler:handler];
+        });
+
+    _response[i] = @{@"state" : @"NO_CHANGE"};
+
+    _responseData[i] = [NSJSONSerialization dataWithJSONObject:_response[i] options:0 error:nil];
+
+    _URLResponse[i] =
+        [[NSHTTPURLResponse alloc] initWithURL:[NSURL URLWithString:@"https://firebase.com"]
+                                    statusCode:200
+                                   HTTPVersion:nil
+                                  headerFields:@{@"etag" : @"etag1"}];
+
+    id completionBlock =
+        [OCMArg invokeBlockWithArgs:_responseData[i], _URLResponse[i], [NSNull null], nil];
+
+    OCMExpect([_configFetch[i] URLSessionDataTaskWithContent:[OCMArg any]
+                                           completionHandler:completionBlock])
+        .andReturn(nil);
+    [_configInstances[i] updateWithNewInstancesForConfigFetch:_configFetch[i]
+                                                configContent:configContent
+                                               configSettings:settings
+                                             configExperiment:nil];
+  }
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+  // Make the fetch calls for all instances.
+  NSMutableArray<XCTestExpectation *> *expectations =
+      [[NSMutableArray alloc] initWithCapacity:RCNTestRCNumTotalInstances];
+
+  for (int i = 0; i < RCNTestRCNumTotalInstances; i++) {
+    expectations[i] = [self
+        expectationWithDescription:
+            [NSString stringWithFormat:@"Test enumerating configs successfully - instance %d", i]];
+    XCTAssertEqual(_configInstances[i].lastFetchStatus, FIRRemoteConfigFetchStatusNoFetchYet);
+
+    // Make sure activate returns false in fetch completion.
+    FIRRemoteConfigFetchCompletion fetchCompletion =
+        ^void(FIRRemoteConfigFetchStatus status, NSError *error) {
+          XCTAssertEqual(_configInstances[i].lastFetchStatus, FIRRemoteConfigFetchStatusSuccess);
+          XCTAssertFalse([_configInstances[i] activateFetched]);
+          XCTAssertNil(error);
+          [expectations[i] fulfill];
+        };
+    [_configInstances[i] fetchWithExpirationDuration:43200 completionHandler:fetchCompletion];
+  }
+  [self waitForExpectationsWithTimeout:_expectationTimeout
+                               handler:^(NSError *error) {
+                                 XCTAssertNil(error);
+                               }];
+}
+
 - (void)testConfigValueForKey {
   NSMutableArray<XCTestExpectation *> *expectations =
       [[NSMutableArray alloc] initWithCapacity:RCNTestRCNumTotalInstances];

+ 12 - 0
FirebaseRemoteConfig/Tests/Unit/RCNUserDefaultsManagerTests.m

@@ -58,6 +58,18 @@ static NSTimeInterval RCNUserDefaultsSampleTimeStamp = 0;
   XCTAssertEqual([manager lastFetchTime], RCNUserDefaultsSampleTimeStamp - 1000);
 }
 
+- (void)testUserDefaultsLastETagUpdateTimeWriteAndRead {
+  RCNUserDefaultsManager* manager =
+      [[RCNUserDefaultsManager alloc] initWithAppName:@"TESTING"
+                                             bundleID:[NSBundle mainBundle].bundleIdentifier
+                                            namespace:@"testNamespace1"];
+  [manager setLastETagUpdateTime:RCNUserDefaultsSampleTimeStamp];
+  XCTAssertEqual([manager lastETagUpdateTime], RCNUserDefaultsSampleTimeStamp);
+
+  [manager setLastETagUpdateTime:RCNUserDefaultsSampleTimeStamp - 1000];
+  XCTAssertEqual([manager lastETagUpdateTime], RCNUserDefaultsSampleTimeStamp - 1000);
+}
+
 - (void)testUserDefaultsLastFetchStatusWriteAndRead {
   RCNUserDefaultsManager* manager =
       [[RCNUserDefaultsManager alloc] initWithAppName:@"TESTING"

+ 1 - 1
FirebaseStorage.podspec

@@ -1,6 +1,6 @@
 Pod::Spec.new do |s|
   s.name             = 'FirebaseStorage'
-  s.version          = '3.4.1'
+  s.version          = '3.4.2'
   s.summary          = 'Firebase Storage for iOS (plus community support for macOS and tvOS)'
 
   s.description      = <<-DESC

+ 7 - 0
Firestore/CHANGELOG.md

@@ -1,5 +1,12 @@
 # Unreleased
 
+# v1.8.0
+- [changed] Removed Firestore's dependency on the `Protobuf` CocoaPod. If
+  you're manually tracking dependencies, you may be able to remove it from your
+  build (note, however, that other Firebase components may still require it).
+- [changed] Added a dependency on the `abseil` CocoaPod. If you're manually
+  tracking dependencies, you need to add it to your build.
+
 # v1.7.0
 - [feature] Added `whereField(_:in:)` and `whereField(_:arrayContainsAny:)` query
   operators. `whereField(_:in:)` finds documents where a specified field’s value

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 93 - 107
Firestore/Example/Firestore.xcodeproj/project.pbxproj


+ 7 - 1
Firestore/Example/FuzzTests/FuzzingResources/Serializer/Corpus/ConvertTextToBinary.sh

@@ -21,6 +21,12 @@
 # XCode build target Firestore_FuzzTests_iOS that executes this script. XCode
 # defines these environment variables and makes them available to the script.
 
+if ! [ -x "$(command -v protoc)" ]; then
+  echo "This scripts needs the protoc command to be on the PATH."
+  echo "Please install protobuf (e.g., \`brew install protobuf\` on Mac)."
+  exit 1
+fi
+
 # Directory that contains the text protos to convert to binary protos.
 text_protos_dir="${SCRIPT_INPUT_FILE_0}"
 
@@ -51,7 +57,7 @@ for text_proto_file in "${text_protos_dir}"/*; do
   # Run the conversion.
   echo "Converting file: ${file_name} (type: ${message_type})"
   echo "${file_content}" \
-    | "${SRCROOT}/Pods/!ProtoCompiler/protoc" \
+    | protoc \
     -I"${SRCROOT}/../../Firestore/Protos/protos" \
     --encode=google.firestore.v1."${message_type}" \
     google/firestore/v1/document.proto > "${binary_protos_dir}/${file_name}"

+ 3 - 1
Firestore/Example/GoogleTest.podspec

@@ -17,7 +17,7 @@
 
 Pod::Spec.new do |s|
   s.name             = 'GoogleTest'
-  s.version          = '1.8.1'
+  s.version          = '1.10.0'
   s.summary          = 'Google Test'
 
   s.description      = <<-DESC
@@ -86,6 +86,8 @@ Google's C++ test framework.
       '"${PODS_ROOT}/GoogleTest/googletest"'
   }
 
+  s.compiler_flags = '$(inherited) -Wno-comma'
+
   s.prepare_command = <<-'CMD'
     # Remove includes of files in internal/custom
     sed -i.bak -e '/include.*internal\/custom/ d' \

+ 2 - 3
Firestore/Example/Podfile

@@ -57,6 +57,7 @@ end
 def configure_local_pods()
   # Firestore is always local; that's what's under development here.
   pod 'FirebaseFirestore', :path => '../../'
+  pod 'GoogleUtilities', :path => '../..'
 
   # FirebaseCore must always be a local pod so that CI builds that make changes
   # to its podspec can still function. See Firestore-*-xcodebuild in
@@ -66,7 +67,6 @@ def configure_local_pods()
   # Pull in local sources conditionally.
   maybe_local_pod 'FirebaseAuth'
   maybe_local_pod 'FirebaseAuthInterop'
-  maybe_local_pod 'GoogleUtilities'
 
   if xcode_major_version() >= 9
     # Firestore still compiles with Xcode 8 to help verify general conformance
@@ -118,7 +118,7 @@ if is_platform(:ios)
     # The next line is the forcing function for the Firebase pod. The Firebase
     # version's subspecs should depend on the component versions in their
     # corresponding podspecs.
-    pod 'Firebase/CoreOnly', '6.12.0'
+    pod 'Firebase/CoreOnly', '6.13.0'
 
     configure_local_pods()
 
@@ -158,7 +158,6 @@ if is_platform(:ios)
       platform :ios, '9.0'
 
       pod 'LibFuzzer', :podspec => 'LibFuzzer.podspec', :inhibit_warnings => true
-      pod '!ProtoCompiler'
     end
   end
 end

+ 7 - 3
Firestore/Example/ProtobufCpp.podspec

@@ -17,7 +17,7 @@
 
 Pod::Spec.new do |s|
   s.name             = 'ProtobufCpp'
-  s.version          = '3.5.2'
+  s.version          = '3.9.2'
   s.summary          = 'Protocol Buffers v.3 runtime library for C++.'
   s.homepage         = 'https://github.com/google/protobuf'
   s.license          = '3-Clause BSD License'
@@ -33,7 +33,7 @@ Pod::Spec.new do |s|
   s.osx.deployment_target = '10.11'
   s.tvos.deployment_target = '10.0'
 
-  s.source_files = 'src/**/*.{h,cc}'
+  s.source_files = 'src/**/*.{h,cc,inc}'
   s.exclude_files = # skip test files. (Yes, the test files are intermixed with
                     # the source. No there doesn't seem to be a common/simple
                     # pattern we could use to exclude them; 'test' appears in
@@ -71,7 +71,11 @@ Pod::Spec.new do |s|
   # Disable warnings that upstream does not concern itself with
   s.compiler_flags = '$(inherited) ' +
     '-Wno-comma ' +
-    '-Wno-shorten-64-to-32'
+    '-Wno-inconsistent-missing-override ' +
+    '-Wno-invalid-offsetof ' +
+    '-Wno-shorten-64-to-32 ' +
+    '-Wno-unreachable-code ' +
+    '-Wno-unused-parameter'
 
   s.requires_arc = false
   s.library = 'c++'

+ 8 - 5
Firestore/Example/Tests/Integration/API/FIRQueryTests.mm

@@ -330,14 +330,17 @@
     @"c" : @{@"zip" : @98103},
     @"d" : @{@"zip" : @[ @98101 ]},
     @"e" : @{@"zip" : @[ @"98101", @{@"zip" : @98101} ]},
-    @"f" : @{@"zip" : @{@"code" : @500}}
+    @"f" : @{@"zip" : @{@"code" : @500}},
+    @"g" : @{@"zip" : @[ @98101, @98102 ]}
   };
   FIRCollectionReference *collection = [self collectionRefWithDocuments:testDocs];
 
-  // Search for zips matching [98101, 98103].
-  FIRQuerySnapshot *snapshot =
-      [self readDocumentSetForRef:[collection queryWhereField:@"zip" in:@[ @98101, @98103 ]]];
-  XCTAssertEqualObjects(FIRQuerySnapshotGetData(snapshot), (@[ testDocs[@"a"], testDocs[@"c"] ]));
+  // Search for zips matching 98101, 98103, and [98101, 98102].
+  FIRQuerySnapshot *snapshot = [self
+      readDocumentSetForRef:[collection queryWhereField:@"zip"
+                                                     in:@[ @98101, @98103, @[ @98101, @98102 ] ]]];
+  XCTAssertEqualObjects(FIRQuerySnapshotGetData(snapshot),
+                        (@[ testDocs[@"a"], testDocs[@"c"], testDocs[@"g"] ]));
 
   // With objects
   snapshot = [self readDocumentSetForRef:[collection queryWhereField:@"zip"

+ 0 - 44
Firestore/Example/Tests/Local/FSTLRUGarbageCollectorTests.h

@@ -1,44 +0,0 @@
-/*
- * Copyright 2018 Google
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#import <XCTest/XCTest.h>
-
-#include <memory>
-
-namespace firebase {
-namespace firestore {
-namespace local {
-
-class LruParams;
-class Persistence;
-
-}  // namespace local
-}  // namespace firestore
-}  // namespace firebase
-
-namespace local = firebase::firestore::local;
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface FSTLRUGarbageCollectorTests : XCTestCase
-
-- (std::unique_ptr<local::Persistence>)newPersistenceWithLruParams:(local::LruParams)lruParams;
-
-- (local::Persistence *)persistence;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 770
Firestore/Example/Tests/Local/FSTLRUGarbageCollectorTests.mm

@@ -1,770 +0,0 @@
-/*
- * Copyright 2018 Google
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#import "Firestore/Example/Tests/Local/FSTLRUGarbageCollectorTests.h"
-
-#import <XCTest/XCTest.h>
-
-#include <unordered_map>
-#include <unordered_set>
-#include <utility>
-#include <vector>
-
-#import "Firestore/Example/Tests/Util/FSTHelpers.h"
-#import "Firestore/Source/Util/FSTClasses.h"
-
-#include "Firestore/core/include/firebase/firestore/timestamp.h"
-#include "Firestore/core/src/firebase/firestore/auth/user.h"
-#include "Firestore/core/src/firebase/firestore/core/query.h"
-#include "Firestore/core/src/firebase/firestore/local/lru_garbage_collector.h"
-#include "Firestore/core/src/firebase/firestore/local/mutation_queue.h"
-#include "Firestore/core/src/firebase/firestore/local/persistence.h"
-#include "Firestore/core/src/firebase/firestore/local/query_cache.h"
-#include "Firestore/core/src/firebase/firestore/local/query_data.h"
-#include "Firestore/core/src/firebase/firestore/local/reference_set.h"
-#include "Firestore/core/src/firebase/firestore/local/remote_document_cache.h"
-#include "Firestore/core/src/firebase/firestore/model/document_key_set.h"
-#include "Firestore/core/src/firebase/firestore/model/mutation.h"
-#include "Firestore/core/src/firebase/firestore/model/precondition.h"
-#include "Firestore/core/src/firebase/firestore/model/set_mutation.h"
-#include "Firestore/core/src/firebase/firestore/model/types.h"
-#include "Firestore/core/test/firebase/firestore/testutil/testutil.h"
-#include "absl/strings/str_cat.h"
-
-namespace core = firebase::firestore::core;
-namespace testutil = firebase::firestore::testutil;
-using firebase::Timestamp;
-using firebase::firestore::auth::User;
-using firebase::firestore::local::LruDelegate;
-using firebase::firestore::local::LruGarbageCollector;
-using firebase::firestore::local::LruParams;
-using firebase::firestore::local::LruResults;
-using firebase::firestore::local::MutationQueue;
-using firebase::firestore::local::Persistence;
-using firebase::firestore::local::QueryCache;
-using firebase::firestore::local::QueryData;
-using firebase::firestore::local::QueryPurpose;
-using firebase::firestore::local::ReferenceSet;
-using firebase::firestore::local::RemoteDocumentCache;
-using firebase::firestore::model::Document;
-using firebase::firestore::model::DocumentKey;
-using firebase::firestore::model::DocumentKeyHash;
-using firebase::firestore::model::DocumentKeySet;
-using firebase::firestore::model::DocumentState;
-using firebase::firestore::model::ListenSequenceNumber;
-using firebase::firestore::model::Mutation;
-using firebase::firestore::model::ObjectValue;
-using firebase::firestore::model::Precondition;
-using firebase::firestore::model::SetMutation;
-using firebase::firestore::model::TargetId;
-
-using testutil::Key;
-using testutil::Query;
-using testutil::Version;
-
-NS_ASSUME_NONNULL_BEGIN
-
-@implementation FSTLRUGarbageCollectorTests {
-  TargetId _previousTargetID;
-  int _previousDocNum;
-  ObjectValue _testValue;
-  ObjectValue _bigObjectValue;
-  std::unique_ptr<Persistence> _persistence;
-  QueryCache *_queryCache;
-  RemoteDocumentCache *_documentCache;
-  MutationQueue *_mutationQueue;
-  LruDelegate *_lruDelegate;
-  LruGarbageCollector *_gc;
-  ListenSequenceNumber _initialSequenceNumber;
-  User _user;
-  ReferenceSet _additionalReferences;
-}
-
-- (void)setUp {
-  [super setUp];
-
-  _previousTargetID = 500;
-  _previousDocNum = 10;
-  _testValue = FSTTestObjectValue(@{@"baz" : @YES, @"ok" : @"fine"});
-  NSString *bigString = [@"" stringByPaddingToLength:4096 withString:@"a" startingAtIndex:0];
-  _bigObjectValue = FSTTestObjectValue(@{@"BigProperty" : bigString});
-  _user = User("user");
-}
-
-- (BOOL)isTestBaseClass {
-  return ([self class] == [FSTLRUGarbageCollectorTests class]);
-}
-
-- (Persistence *)persistence {
-  return _persistence.get();
-}
-
-- (void)newTestResourcesWithLruParams:(LruParams)lruParams {
-  HARD_ASSERT(_persistence == nil, "Persistence already created");
-  _persistence = [self newPersistenceWithLruParams:lruParams];
-  _persistence->reference_delegate()->AddInMemoryPins(&_additionalReferences);
-  _queryCache = _persistence->query_cache();
-  _documentCache = _persistence->remote_document_cache();
-  _mutationQueue = _persistence->GetMutationQueueForUser(_user);
-  _lruDelegate = static_cast<LruDelegate *>(_persistence->reference_delegate());
-  _initialSequenceNumber = _persistence->Run("start querycache", [&] {
-    _mutationQueue->Start();
-    _gc = _lruDelegate->garbage_collector();
-    return _persistence->current_sequence_number();
-  });
-}
-
-- (void)newTestResources {
-  [self newTestResourcesWithLruParams:LruParams::Default()];
-}
-
-- (std::unique_ptr<Persistence>)newPersistenceWithLruParams:(LruParams)lruParams {
-  @throw FSTAbstractMethodException();  // NOLINT
-}
-
-- (BOOL)sentinelExists:(const DocumentKey &)key {
-  @throw FSTAbstractMethodException();  // NOLINT
-}
-
-- (void)expectSentinelRemoved:(const DocumentKey &)key {
-  XCTAssertFalse([self sentinelExists:key]);
-}
-
-#pragma mark - helpers
-
-- (ListenSequenceNumber)sequenceNumberForQueryCount:(int)queryCount {
-  return _persistence->Run("gc", [&] { return _gc->SequenceNumberForQueryCount(queryCount); });
-}
-
-- (int)queryCountForPercentile:(int)percentile {
-  return _persistence->Run("query count", [&] { return _gc->QueryCountForPercentile(percentile); });
-}
-
-- (int)removeQueriesThroughSequenceNumber:(ListenSequenceNumber)sequenceNumber
-                              liveQueries:
-                                  (const std::unordered_map<TargetId, QueryData> &)liveQueries {
-  return _persistence->Run("gc", [&] { return _gc->RemoveTargets(sequenceNumber, liveQueries); });
-}
-
-// Removes documents that are not part of a target or a mutation and have a sequence number
-// less than or equal to the given sequence number.
-- (int)removeOrphanedDocumentsThroughSequenceNumber:(ListenSequenceNumber)sequenceNumber {
-  return _persistence->Run("gc", [&] { return _gc->RemoveOrphanedDocuments(sequenceNumber); });
-}
-
-- (QueryData)nextTestQuery {
-  TargetId targetID = ++_previousTargetID;
-  ListenSequenceNumber listenSequenceNumber = _persistence->current_sequence_number();
-  core::Query query = Query(absl::StrCat("path", targetID));
-  return QueryData(std::move(query), targetID, listenSequenceNumber, QueryPurpose::Listen);
-}
-
-- (QueryData)addNextQueryInTransaction {
-  QueryData queryData = [self nextTestQuery];
-  _queryCache->AddTarget(queryData);
-  return queryData;
-}
-
-- (void)updateTargetInTransaction:(const QueryData &)queryData {
-  QueryData updated = queryData.WithSequenceNumber(_persistence->current_sequence_number());
-  _queryCache->UpdateTarget(updated);
-}
-
-- (QueryData)addNextQuery {
-  return _persistence->Run("adding query", [&] { return [self addNextQueryInTransaction]; });
-}
-
-// Simulates a document being mutated and then having that mutation ack'd.
-// Since the document is not in a mutation queue any more, there is
-// potentially nothing keeping it live. We mark it with the current sequence number
-// so it can be collected later.
-- (DocumentKey)markADocumentEligibleForGC {
-  DocumentKey key = [self nextTestDocKey];
-  [self markDocumentEligibleForGC:key];
-  return key;
-}
-
-- (void)markDocumentEligibleForGC:(const DocumentKey &)docKey {
-  _persistence->Run("Removing mutation reference",
-                    [&] { [self markDocumentEligibleForGCInTransaction:docKey]; });
-}
-
-- (DocumentKey)markADocumentEligibleForGCInTransaction {
-  DocumentKey key = [self nextTestDocKey];
-  [self markDocumentEligibleForGCInTransaction:key];
-  return key;
-}
-
-- (void)markDocumentEligibleForGCInTransaction:(const DocumentKey &)docKey {
-  _persistence->reference_delegate()->RemoveMutationReference(docKey);
-}
-
-- (void)addDocument:(const DocumentKey &)docKey toTarget:(TargetId)targetId {
-  _queryCache->AddMatchingKeys(DocumentKeySet{docKey}, targetId);
-}
-
-- (void)removeDocument:(const DocumentKey &)docKey fromTarget:(TargetId)targetId {
-  _queryCache->RemoveMatchingKeys(DocumentKeySet{docKey}, targetId);
-}
-
-/**
- * Used to insert a document into the remote document cache. Use of this method should
- * be paired with some explanation for why it is in the cache, for instance:
- * - added to a target
- * - now has or previously had a pending mutation
- */
-- (Document)cacheADocumentInTransaction {
-  Document doc = [self nextTestDocument];
-  _documentCache->Add(doc);
-  return doc;
-}
-
-- (SetMutation)mutationForDocument:(const DocumentKey &)docKey {
-  return SetMutation(docKey, _testValue, Precondition::None());
-}
-
-- (DocumentKey)nextTestDocKey {
-  return Key("docs/doc_" + std::to_string(++_previousDocNum));
-}
-
-- (Document)nextTestDocumentWithValue:(ObjectValue)value {
-  DocumentKey key = [self nextTestDocKey];
-  FSTTestSnapshotVersion version = 2;
-  return Document(std::move(value), std::move(key), Version(version), DocumentState::kSynced);
-}
-
-- (Document)nextTestDocument {
-  return [self nextTestDocumentWithValue:_testValue];
-}
-
-#pragma mark - tests
-
-- (void)testPickSequenceNumberPercentile {
-  if ([self isTestBaseClass]) return;
-
-  const int numTestCases = 5;
-  struct Case {
-    // number of queries to cache
-    int queries;
-    // number expected to be calculated as 10%
-    int expected;
-  };
-  struct Case testCases[numTestCases] = {{0, 0}, {10, 1}, {9, 0}, {50, 5}, {49, 4}};
-
-  for (int i = 0; i < numTestCases; i++) {
-    // Fill the query cache.
-    int numQueries = testCases[i].queries;
-    int expectedTenthPercentile = testCases[i].expected;
-    [self newTestResources];
-    for (int j = 0; j < numQueries; j++) {
-      [self addNextQuery];
-    }
-    int tenth = [self queryCountForPercentile:10];
-    XCTAssertEqual(expectedTenthPercentile, tenth, @"Total query count: %i", numQueries);
-    _persistence->Shutdown();
-    _persistence.reset();
-  }
-}
-
-- (void)testSequenceNumberNoQueries {
-  if ([self isTestBaseClass]) return;
-
-  // No queries... should get invalid sequence number (-1)
-  [self newTestResources];
-  XCTAssertEqual(local::kListenSequenceNumberInvalid, [self sequenceNumberForQueryCount:0]);
-  _persistence->Shutdown();
-}
-
-- (void)testSequenceNumberForFiftyQueries {
-  if ([self isTestBaseClass]) return;
-  // Add 50 queries sequentially, aim to collect 10 of them.
-  // The sequence number to collect should be 10 past the initial sequence number.
-  [self newTestResources];
-  for (int i = 0; i < 50; i++) {
-    [self addNextQuery];
-  }
-  XCTAssertEqual(_initialSequenceNumber + 10, [self sequenceNumberForQueryCount:10]);
-  _persistence->Shutdown();
-}
-
-- (void)testSequenceNumberForMultipleQueriesInATransaction {
-  if ([self isTestBaseClass]) return;
-
-  // 50 queries, 9 with one transaction, incrementing from there. Should get second sequence number.
-  [self newTestResources];
-  _persistence->Run("9 queries in a batch", [&] {
-    for (int i = 0; i < 9; i++) {
-      [self addNextQueryInTransaction];
-    }
-  });
-  for (int i = 9; i < 50; i++) {
-    [self addNextQuery];
-  }
-  XCTAssertEqual(2 + _initialSequenceNumber, [self sequenceNumberForQueryCount:10]);
-  _persistence->Shutdown();
-}
-
-// Ensure that even if all of the queries are added in a single transaction, we still
-// pick a sequence number and GC. In this case, the initial transaction contains all of the
-// targets that will get GC'd, since they account for more than the first 10 targets.
-- (void)testAllCollectedQueriesInSingleTransaction {
-  if ([self isTestBaseClass]) return;
-
-  // 50 queries, 11 with one transaction, incrementing from there. Should get first sequence number.
-  [self newTestResources];
-  _persistence->Run("11 queries in a transaction", [&] {
-    for (int i = 0; i < 11; i++) {
-      [self addNextQueryInTransaction];
-    }
-  });
-  for (int i = 11; i < 50; i++) {
-    [self addNextQuery];
-  }
-  // We expect to GC the targets from the first transaction, since they account for
-  // at least the first 10 of the targets.
-  XCTAssertEqual(1 + _initialSequenceNumber, [self sequenceNumberForQueryCount:10]);
-  _persistence->Shutdown();
-}
-
-- (void)testSequenceNumbersWithMutationAndSequentialQueries {
-  if ([self isTestBaseClass]) return;
-
-  // Remove a mutated doc reference, marking it as eligible for GC.
-  // Then add 50 queries. Should get 10 past initial (9 queries).
-  [self newTestResources];
-  [self markADocumentEligibleForGC];
-  for (int i = 0; i < 50; i++) {
-    [self addNextQuery];
-  }
-  XCTAssertEqual(10 + _initialSequenceNumber, [self sequenceNumberForQueryCount:10]);
-  _persistence->Shutdown();
-}
-
-- (void)testSequenceNumbersWithMutationsInQueries {
-  if ([self isTestBaseClass]) return;
-
-  // Add mutated docs, then add one of them to a query target so it doesn't get GC'd.
-  // Expect 3 past the initial value: the mutations not part of a query, and two queries
-  [self newTestResources];
-  Document docInQuery = [self nextTestDocument];
-  _persistence->Run("mark mutations", [&] {
-    // Adding 9 doc keys in a transaction. If we remove one of them, we'll have room for two actual
-    // queries.
-    [self markDocumentEligibleForGCInTransaction:docInQuery.key()];
-    for (int i = 0; i < 8; i++) {
-      [self markADocumentEligibleForGCInTransaction];
-    }
-  });
-  for (int i = 0; i < 49; i++) {
-    [self addNextQuery];
-  }
-  _persistence->Run("query with mutation", [&] {
-    QueryData queryData = [self addNextQueryInTransaction];
-    // This should keep the document from getting GC'd, since it is no longer orphaned.
-    [self addDocument:docInQuery.key() toTarget:queryData.target_id()];
-  });
-
-  // This should catch the remaining 8 documents, plus the first two queries we added.
-  XCTAssertEqual(3 + _initialSequenceNumber, [self sequenceNumberForQueryCount:10]);
-  _persistence->Shutdown();
-}
-
-- (void)testRemoveQueriesUpThroughSequenceNumber {
-  if ([self isTestBaseClass]) return;
-
-  [self newTestResources];
-  std::unordered_map<TargetId, QueryData> liveQueries;
-  for (int i = 0; i < 100; i++) {
-    QueryData queryData = [self addNextQuery];
-    // Mark odd queries as live so we can test filtering out live queries.
-    if (queryData.target_id() % 2 == 1) {
-      liveQueries[queryData.target_id()] = queryData;
-    }
-  }
-  // GC up through 20th query, which is 20%.
-  // Expect to have GC'd 10 targets, since every other target is live
-  int removed = [self removeQueriesThroughSequenceNumber:20 + _initialSequenceNumber
-                                             liveQueries:liveQueries];
-  XCTAssertEqual(10, removed);
-  // Make sure we removed the even targets with targetID <= 20.
-  _persistence->Run("verify remaining targets are > 20 or odd", [&] {
-    _queryCache->EnumerateTargets([&](const QueryData &queryData) {
-      XCTAssertTrue(queryData.target_id() > 20 || queryData.target_id() % 2 == 1);
-    });
-  });
-  _persistence->Shutdown();
-}
-
-- (void)testRemoveOrphanedDocuments {
-  if ([self isTestBaseClass]) return;
-
-  [self newTestResources];
-  // Track documents we expect to be retained so we can verify post-GC.
-  // This will contain documents associated with targets that survive GC, as well
-  // as any documents with pending mutations.
-  std::unordered_set<DocumentKey, DocumentKeyHash> expectedRetained;
-  // we add two mutations later, for now track them in an array.
-  std::vector<Mutation> mutations;
-
-  // Add a target and add two documents to it. The documents are expected to be
-  // retained, since their membership in the target keeps them alive.
-  _persistence->Run("add a target and add two documents to it", [&] {
-    // Add two documents to first target, queue a mutation on the second document
-    QueryData queryData = [self addNextQueryInTransaction];
-    Document doc1 = [self cacheADocumentInTransaction];
-    [self addDocument:doc1.key() toTarget:queryData.target_id()];
-    expectedRetained.insert(doc1.key());
-
-    Document doc2 = [self cacheADocumentInTransaction];
-    [self addDocument:doc2.key() toTarget:queryData.target_id()];
-    expectedRetained.insert(doc2.key());
-    mutations.push_back([self mutationForDocument:doc2.key()]);
-  });
-
-  // Add a second query and register a third document on it
-  _persistence->Run("second query", [&] {
-    QueryData queryData = [self addNextQueryInTransaction];
-    Document doc3 = [self cacheADocumentInTransaction];
-    expectedRetained.insert(doc3.key());
-    [self addDocument:doc3.key() toTarget:queryData.target_id()];
-  });
-
-  // cache another document and prepare a mutation on it.
-  _persistence->Run("queue a mutation", [&] {
-    Document doc4 = [self cacheADocumentInTransaction];
-    mutations.push_back([self mutationForDocument:doc4.key()]);
-    expectedRetained.insert(doc4.key());
-  });
-
-  // Insert the mutations. These operations don't have a sequence number, they just
-  // serve to keep the mutated documents from being GC'd while the mutations are outstanding.
-  _persistence->Run("actually register the mutations", [&] {
-    Timestamp writeTime = Timestamp::Now();
-    _mutationQueue->AddMutationBatch(writeTime, {}, std::move(mutations));
-  });
-
-  // Mark 5 documents eligible for GC. This simulates documents that were mutated then ack'd.
-  // Since they were ack'd, they are no longer in a mutation queue, and there is nothing keeping
-  // them alive.
-  std::unordered_set<DocumentKey, DocumentKeyHash> toBeRemoved;
-  _persistence->Run("add orphaned docs (previously mutated, then ack'd)", [&] {
-    for (int i = 0; i < 5; i++) {
-      Document doc = [self cacheADocumentInTransaction];
-      toBeRemoved.insert(doc.key());
-      [self markDocumentEligibleForGCInTransaction:doc.key()];
-    }
-  });
-
-  // We expect only the orphaned documents, those not in a mutation or a target, to be
-  // removed.
-  // use a large sequence number to remove as much as possible
-  int removed = [self removeOrphanedDocumentsThroughSequenceNumber:1000];
-  XCTAssertEqual(toBeRemoved.size(), removed);
-  _persistence->Run("verify", [&] {
-    for (const DocumentKey &key : toBeRemoved) {
-      XCTAssertEqual(_documentCache->Get(key), absl::nullopt);
-      XCTAssertFalse(_queryCache->Contains(key));
-    }
-    for (const DocumentKey &key : expectedRetained) {
-      XCTAssertNotEqual(_documentCache->Get(key), absl::nullopt, @"Missing document %s",
-                        key.ToString().c_str());
-    }
-  });
-  _persistence->Shutdown();
-}
-
-// TODO(gsoltis): write a test that includes limbo documents
-
-- (void)testRemoveTargetsThenGC {
-  if ([self isTestBaseClass]) return;
-
-  // Create 3 targets, add docs to all of them
-  // Leave oldest target alone, it is still live
-  // Remove newest target
-  // Blind write 2 documents
-  // Add one of the blind write docs to oldest target (preserves it)
-  // Remove some documents from middle target (bumps sequence number)
-  // Add some documents from newest target to oldest target (preserves them)
-  // Update a doc from middle target
-  // Remove middle target
-  // Do a blind write
-  // GC up to but not including the removal of the middle target
-  //
-  // Expect:
-  // All docs in oldest target are still around
-  // One blind write is gone, the first one not added to oldest target
-  // Documents removed from middle target are gone, except ones added to oldest target
-  // Documents from newest target are gone, except
-
-  [self newTestResources];
-
-  // Through the various steps, track which documents we expect to be removed vs
-  // documents we expect to be retained.
-  std::unordered_set<DocumentKey, DocumentKeyHash> expectedRetained;
-  std::unordered_set<DocumentKey, DocumentKeyHash> expectedRemoved;
-
-  // Add oldest target, 5 documents, and add those documents to the target.
-  // This target will not be removed, so all documents that are part of it will
-  // be retained.
-  QueryData oldestTarget = _persistence->Run("Add oldest target and docs", [&] {
-    QueryData queryData = [self addNextQueryInTransaction];
-    for (int i = 0; i < 5; i++) {
-      Document doc = [self cacheADocumentInTransaction];
-      expectedRetained.insert(doc.key());
-      [self addDocument:doc.key() toTarget:queryData.target_id()];
-    }
-    return queryData;
-  });
-
-  // Add middle target and docs. Some docs will be removed from this target later,
-  // which we track here.
-  DocumentKeySet middleDocsToRemove;
-  // This will be the document in this target that gets an update later
-  DocumentKey middleDocToUpdate;
-  QueryData middleTarget = _persistence->Run("Add middle target and docs", [&] {
-    QueryData middleTarget = [self addNextQueryInTransaction];
-    // these docs will be removed from this target later, triggering a bump
-    // to their sequence numbers. Since they will not be a part of the target, we
-    // expect them to be removed.
-    for (int i = 0; i < 2; i++) {
-      Document doc = [self cacheADocumentInTransaction];
-      expectedRemoved.insert(doc.key());
-      [self addDocument:doc.key() toTarget:middleTarget.target_id()];
-      middleDocsToRemove = middleDocsToRemove.insert(doc.key());
-    }
-    // these docs stay in this target and only this target. There presence in this
-    // target prevents them from being GC'd, so they are also expected to be retained.
-    for (int i = 2; i < 4; i++) {
-      Document doc = [self cacheADocumentInTransaction];
-      expectedRetained.insert(doc.key());
-      [self addDocument:doc.key() toTarget:middleTarget.target_id()];
-    }
-    // This doc stays in this target, but gets updated.
-    {
-      Document doc = [self cacheADocumentInTransaction];
-      expectedRetained.insert(doc.key());
-      [self addDocument:doc.key() toTarget:middleTarget.target_id()];
-      middleDocToUpdate = doc.key();
-    }
-    return middleTarget;
-  });
-
-  // Add the newest target and add 5 documents to it. Some of those documents will
-  // additionally be added to the oldest target, which will cause those documents to
-  // be retained. The remaining documents are expected to be removed, since this target
-  // will be removed.
-  DocumentKeySet newestDocsToAddToOldest;
-  _persistence->Run("Add newest target and docs", [&] {
-    QueryData newestTarget = [self addNextQueryInTransaction];
-    // These documents are only in this target. They are expected to be removed
-    // because this target will also be removed.
-    for (int i = 0; i < 3; i++) {
-      Document doc = [self cacheADocumentInTransaction];
-      expectedRemoved.insert(doc.key());
-      [self addDocument:doc.key() toTarget:newestTarget.target_id()];
-    }
-    // docs to add to the oldest target in addition to this target. They will be retained
-    for (int i = 3; i < 5; i++) {
-      Document doc = [self cacheADocumentInTransaction];
-      expectedRetained.insert(doc.key());
-      [self addDocument:doc.key() toTarget:newestTarget.target_id()];
-      newestDocsToAddToOldest = newestDocsToAddToOldest.insert(doc.key());
-    }
-  });
-
-  // 2 doc writes, add one of them to the oldest target.
-  _persistence->Run("2 doc writes, add one of them to the oldest target", [&] {
-    // write two docs and have them ack'd by the server. can skip mutation queue
-    // and set them in document cache. Add potentially orphaned first, also add one
-    // doc to a target.
-    Document doc1 = [self cacheADocumentInTransaction];
-    [self markDocumentEligibleForGCInTransaction:doc1.key()];
-    [self updateTargetInTransaction:oldestTarget];
-    [self addDocument:doc1.key() toTarget:oldestTarget.target_id()];
-    // doc1 should be retained by being added to oldestTarget.
-    expectedRetained.insert(doc1.key());
-
-    Document doc2 = [self cacheADocumentInTransaction];
-    [self markDocumentEligibleForGCInTransaction:doc2.key()];
-    // nothing is keeping doc2 around, it should be removed
-    expectedRemoved.insert(doc2.key());
-  });
-
-  // Remove some documents from the middle target.
-  _persistence->Run("Remove some documents from the middle target", [&] {
-    [self updateTargetInTransaction:middleTarget];
-    for (const DocumentKey &docKey : middleDocsToRemove) {
-      [self removeDocument:docKey fromTarget:middleTarget.target_id()];
-    }
-  });
-
-  // Add a couple docs from the newest target to the oldest (preserves them past the point where
-  // newest was removed)
-  // upperBound is the sequence number right before middleTarget is updated, then removed.
-  ListenSequenceNumber upperBound =
-      _persistence->Run("Add a couple docs from the newest target to the oldest", [&] {
-        [self updateTargetInTransaction:oldestTarget];
-        for (const DocumentKey &docKey : newestDocsToAddToOldest) {
-          [self addDocument:docKey toTarget:oldestTarget.target_id()];
-        }
-        return _persistence->current_sequence_number();
-      });
-
-  // Update a doc in the middle target
-  _persistence->Run("Update a doc in the middle target", [&] {
-    FSTTestSnapshotVersion version = 3;
-    Document doc(ObjectValue(_testValue), middleDocToUpdate, Version(version),
-                 DocumentState::kSynced);
-    _documentCache->Add(doc);
-    [self updateTargetInTransaction:middleTarget];
-  });
-
-  // middleTarget removed here, no update needed
-
-  // Write a doc and get an ack, not part of a target.
-  _persistence->Run("Write a doc and get an ack, not part of a target", [&] {
-    Document doc = [self cacheADocumentInTransaction];
-    // Mark it as eligible for GC, but this is after our upper bound for what we will collect.
-    [self markDocumentEligibleForGCInTransaction:doc.key()];
-    // This should be retained, it's too new to get removed.
-    expectedRetained.insert(doc.key());
-  });
-
-  // Finally, do the garbage collection, up to but not including the removal of middleTarget
-  std::unordered_map<TargetId, QueryData> liveQueries{{oldestTarget.target_id(), oldestTarget}};
-
-  int queriesRemoved = [self removeQueriesThroughSequenceNumber:upperBound liveQueries:liveQueries];
-  XCTAssertEqual(1, queriesRemoved, @"Expected to remove newest target");
-  int docsRemoved = [self removeOrphanedDocumentsThroughSequenceNumber:upperBound];
-  XCTAssertEqual(expectedRemoved.size(), docsRemoved);
-  _persistence->Run("verify results", [&] {
-    for (const DocumentKey &key : expectedRemoved) {
-      XCTAssertEqual(_documentCache->Get(key), absl::nullopt,
-                     @"Did not expect to find %s in document cache", key.ToString().c_str());
-      XCTAssertFalse(_queryCache->Contains(key), @"Did not expect to find %s in queryCache",
-                     key.ToString().c_str());
-      [self expectSentinelRemoved:key];
-    }
-    for (const DocumentKey &key : expectedRetained) {
-      XCTAssertNotEqual(_documentCache->Get(key), absl::nullopt,
-                        @"Expected to find %s in document cache", key.ToString().c_str());
-    }
-  });
-
-  _persistence->Shutdown();
-}
-
-- (void)testGetsSize {
-  if ([self isTestBaseClass]) return;
-
-  [self newTestResources];
-
-  size_t initialSize = _gc->CalculateByteSize();
-
-  _persistence->Run("fill cache", [&] {
-    // Simulate a bunch of ack'd mutations
-    for (int i = 0; i < 50; i++) {
-      Document doc = [self cacheADocumentInTransaction];
-      [self markDocumentEligibleForGCInTransaction:doc.key()];
-    }
-  });
-
-  size_t finalSize = _gc->CalculateByteSize();
-  XCTAssertGreaterThan(finalSize, initialSize);
-
-  _persistence->Shutdown();
-}
-
-- (void)testDisabled {
-  if ([self isTestBaseClass]) return;
-
-  LruParams params = LruParams::Disabled();
-  [self newTestResourcesWithLruParams:params];
-
-  _persistence->Run("fill cache", [&] {
-    // Simulate a bunch of ack'd mutations
-    for (int i = 0; i < 500; i++) {
-      Document doc = [self cacheADocumentInTransaction];
-      [self markDocumentEligibleForGCInTransaction:doc.key()];
-    }
-  });
-
-  LruResults results = _persistence->Run("GC", [&] { return _gc->Collect({}); });
-  XCTAssertFalse(results.did_run);
-
-  _persistence->Shutdown();
-}
-
-- (void)testCacheTooSmall {
-  if ([self isTestBaseClass]) return;
-
-  LruParams params = LruParams::Default();
-  [self newTestResourcesWithLruParams:params];
-
-  _persistence->Run("fill cache", [&] {
-    // Simulate a bunch of ack'd mutations
-    for (int i = 0; i < 50; i++) {
-      Document doc = [self cacheADocumentInTransaction];
-      [self markDocumentEligibleForGCInTransaction:doc.key()];
-    }
-  });
-
-  int cacheSize = (int)_gc->CalculateByteSize();
-  // Verify that we don't have enough in our cache to warrant collection
-  XCTAssertLessThan(cacheSize, params.min_bytes_threshold);
-
-  // Try collection and verify that it didn't run
-  LruResults results = _persistence->Run("GC", [&] { return _gc->Collect({}); });
-  XCTAssertFalse(results.did_run);
-
-  _persistence->Shutdown();
-}
-
-- (void)testGCRan {
-  if ([self isTestBaseClass]) return;
-
-  LruParams params = LruParams::Default();
-  // Set a low threshold so we will definitely run
-  params.min_bytes_threshold = 100;
-  [self newTestResourcesWithLruParams:params];
-
-  // Add 100 targets and 10 documents to each
-  for (int i = 0; i < 100; i++) {
-    // Use separate transactions so that each target and associated documents get their own
-    // sequence number.
-    _persistence->Run("Add a target and some documents", [&] {
-      QueryData queryData = [self addNextQueryInTransaction];
-      for (int j = 0; j < 10; j++) {
-        Document doc = [self cacheADocumentInTransaction];
-        [self addDocument:doc.key() toTarget:queryData.target_id()];
-      }
-    });
-  }
-
-  // Mark nothing as live, so everything is eligible.
-  LruResults results = _persistence->Run("GC", [&] { return _gc->Collect({}); });
-
-  // By default, we collect 10% of the sequence numbers. Since we added 100 targets,
-  // that should be 10 targets with 10 documents each, for a total of 100 documents.
-  XCTAssertTrue(results.did_run);
-  XCTAssertEqual(10, results.targets_removed);
-  XCTAssertEqual(100, results.documents_removed);
-  _persistence->Shutdown();
-}
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 56
Firestore/Example/Tests/Local/FSTLevelDBLRUGarbageCollectorTests.mm

@@ -1,56 +0,0 @@
-/*
- * Copyright 2018 Google
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <string>
-
-#import "Firestore/Example/Tests/Local/FSTLRUGarbageCollectorTests.h"
-
-#include "Firestore/core/src/firebase/firestore/local/leveldb_key.h"
-#include "Firestore/core/src/firebase/firestore/local/leveldb_persistence.h"
-#include "Firestore/core/src/firebase/firestore/local/lru_garbage_collector.h"
-#include "Firestore/core/src/firebase/firestore/local/persistence.h"
-#include "Firestore/core/src/firebase/firestore/model/document_key.h"
-#include "Firestore/core/test/firebase/firestore/local/persistence_testing.h"
-
-using firebase::firestore::local::LevelDbDocumentTargetKey;
-using firebase::firestore::local::LevelDbPersistence;
-using firebase::firestore::local::LevelDbPersistenceForTesting;
-using firebase::firestore::local::Persistence;
-using firebase::firestore::model::DocumentKey;
-
-using firebase::firestore::local::LruParams;
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface FSTLevelDBLRUGarbageCollectorTests : FSTLRUGarbageCollectorTests
-@end
-
-@implementation FSTLevelDBLRUGarbageCollectorTests
-
-- (std::unique_ptr<Persistence>)newPersistenceWithLruParams:(LruParams)lruParams {
-  return LevelDbPersistenceForTesting(lruParams);
-}
-
-- (BOOL)sentinelExists:(const DocumentKey &)key {
-  auto db = static_cast<local::LevelDbPersistence *>(self.persistence);
-  std::string sentinelKey = LevelDbDocumentTargetKey::SentinelKey(key);
-  std::string unusedValue;
-  return !db->current_transaction()->Get(sentinelKey, &unusedValue).IsNotFound();
-}
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 453
Firestore/Example/Tests/Local/FSTLevelDBMigrationsTests.mm

@@ -1,453 +0,0 @@
-/*
- * Copyright 2018 Google
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#import <XCTest/XCTest.h>
-
-#include <map>
-#include <memory>
-#include <string>
-#include <vector>
-
-#import "Firestore/Protos/objc/firestore/local/Mutation.pbobjc.h"
-#import "Firestore/Protos/objc/firestore/local/Target.pbobjc.h"
-
-#include "Firestore/core/src/firebase/firestore/local/leveldb_key.h"
-#include "Firestore/core/src/firebase/firestore/local/leveldb_migrations.h"
-#include "Firestore/core/src/firebase/firestore/local/leveldb_query_cache.h"
-#include "Firestore/core/src/firebase/firestore/util/ordered_code.h"
-#include "Firestore/core/src/firebase/firestore/util/path.h"
-#include "Firestore/core/test/firebase/firestore/local/persistence_testing.h"
-#include "Firestore/core/test/firebase/firestore/testutil/testutil.h"
-#include "absl/strings/match.h"
-#include "leveldb/db.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-using firebase::firestore::Error;
-using firebase::firestore::firestore_client_TargetGlobal;
-using firebase::firestore::local::LevelDbCollectionParentKey;
-using firebase::firestore::local::LevelDbDir;
-using firebase::firestore::local::LevelDbDocumentMutationKey;
-using firebase::firestore::local::LevelDbDocumentTargetKey;
-using firebase::firestore::local::LevelDbMigrations;
-using firebase::firestore::local::LevelDbMutationKey;
-using firebase::firestore::local::LevelDbMutationQueueKey;
-using firebase::firestore::local::LevelDbQueryCache;
-using firebase::firestore::local::LevelDbQueryTargetKey;
-using firebase::firestore::local::LevelDbRemoteDocumentKey;
-using firebase::firestore::local::LevelDbTargetDocumentKey;
-using firebase::firestore::local::LevelDbTargetGlobalKey;
-using firebase::firestore::local::LevelDbTargetKey;
-using firebase::firestore::local::LevelDbTransaction;
-using firebase::firestore::model::BatchId;
-using firebase::firestore::model::DocumentKey;
-using firebase::firestore::model::ListenSequenceNumber;
-using firebase::firestore::model::TargetId;
-using firebase::firestore::nanopb::Message;
-using firebase::firestore::testutil::Key;
-using firebase::firestore::util::OrderedCode;
-using firebase::firestore::util::Path;
-using leveldb::DB;
-using leveldb::Options;
-using leveldb::Status;
-
-using SchemaVersion = LevelDbMigrations::SchemaVersion;
-
-@interface FSTLevelDBMigrationsTests : XCTestCase
-@end
-
-@implementation FSTLevelDBMigrationsTests {
-  std::unique_ptr<DB> _db;
-}
-
-- (void)setUp {
-  Options options;
-  options.error_if_exists = true;
-  options.create_if_missing = true;
-
-  Path dir = LevelDbDir();
-  DB *db;
-  Status status = DB::Open(options, dir.ToUtf8String(), &db);
-  XCTAssert(status.ok(), @"Failed to create db: %s", status.ToString().c_str());
-  _db.reset(db);
-}
-
-- (void)tearDown {
-  _db.reset();
-}
-
-- (void)testAddsTargetGlobal {
-  auto metadata = LevelDbQueryCache::TryReadMetadata(_db.get());
-  XCTAssert(!metadata, @"Not expecting metadata yet, we should have an empty db");
-  LevelDbMigrations::RunMigrations(_db.get());
-
-  metadata = LevelDbQueryCache::TryReadMetadata(_db.get());
-  XCTAssert(metadata, @"Migrations should have added the metadata");
-}
-
-- (void)testSetsVersionNumber {
-  SchemaVersion initial = LevelDbMigrations::ReadSchemaVersion(_db.get());
-  XCTAssertEqual(0, initial, "No version should be equivalent to 0");
-
-  // Pick an arbitrary high migration number and migrate to it.
-  LevelDbMigrations::RunMigrations(_db.get());
-
-  SchemaVersion actual = LevelDbMigrations::ReadSchemaVersion(_db.get());
-  XCTAssertGreaterThan(actual, 0, @"Expected to migrate to a schema version > 0");
-}
-
-#define ASSERT_NOT_FOUND(transaction, key)                \
-  do {                                                    \
-    std::string unused_result;                            \
-    Status status = transaction.Get(key, &unused_result); \
-    XCTAssertTrue(status.IsNotFound());                   \
-  } while (0)
-
-#define ASSERT_FOUND(transaction, key)                    \
-  do {                                                    \
-    std::string unused_result;                            \
-    Status status = transaction.Get(key, &unused_result); \
-    XCTAssertTrue(status.ok());                           \
-  } while (0)
-
-- (void)testDropsTheQueryCache {
-  std::string userID{"user"};
-  BatchId batchID = 1;
-  TargetId targetID = 2;
-
-  DocumentKey key1 = Key("documents/1");
-  DocumentKey key2 = Key("documents/2");
-
-  std::string targetKeys[] = {
-      LevelDbTargetKey::Key(targetID),
-      LevelDbTargetDocumentKey::Key(targetID, key1),
-      LevelDbTargetDocumentKey::Key(targetID, key2),
-      LevelDbDocumentTargetKey::Key(key1, targetID),
-      LevelDbDocumentTargetKey::Key(key2, targetID),
-      LevelDbQueryTargetKey::Key("foo.bar.baz", targetID),
-  };
-
-  // Keys that should not be modified by the dropping the query cache
-  std::string preservedKeys[] = {
-      [self dummyKeyForTable:"targetA"],
-      LevelDbMutationQueueKey::Key(userID),
-      LevelDbMutationKey::Key(userID, batchID),
-  };
-
-  LevelDbMigrations::RunMigrations(_db.get(), 2);
-  {
-    // Setup some targets to be counted in the migration.
-    LevelDbTransaction transaction(_db.get(), "testDropsTheQueryCache setup");
-    for (const std::string &key : targetKeys) {
-      transaction.Put(key, "target");
-    }
-    for (const std::string &key : preservedKeys) {
-      transaction.Put(key, "preserved");
-    }
-    transaction.Commit();
-  }
-
-  LevelDbMigrations::RunMigrations(_db.get(), 3);
-  {
-    LevelDbTransaction transaction(_db.get(), "testDropsTheQueryCache");
-    for (const std::string &key : targetKeys) {
-      ASSERT_NOT_FOUND(transaction, key);
-    }
-    for (const std::string &key : preservedKeys) {
-      ASSERT_FOUND(transaction, key);
-    }
-
-    auto metadata = LevelDbQueryCache::TryReadMetadata(_db.get());
-    XCTAssert(metadata, @"Metadata should have been added");
-    XCTAssertEqual(metadata.value()->target_count, 0);
-  }
-}
-
-- (void)testDropsTheQueryCacheWithThousandsOfEntries {
-  LevelDbMigrations::RunMigrations(_db.get(), 2);
-  {
-    // Setup some targets to be destroyed.
-    LevelDbTransaction transaction(_db.get(), "testDropsTheQueryCacheWithThousandsOfEntries setup");
-    for (int i = 0; i < 10000; ++i) {
-      transaction.Put(LevelDbTargetKey::Key(i), "");
-    }
-    transaction.Commit();
-  }
-
-  LevelDbMigrations::RunMigrations(_db.get(), 3);
-  {
-    LevelDbTransaction transaction(_db.get(), "Verify");
-    std::string prefix = LevelDbTargetKey::KeyPrefix();
-
-    auto it = transaction.NewIterator();
-    std::vector<std::string> found_keys;
-    for (it->Seek(prefix); it->Valid() && absl::StartsWith(it->key(), prefix); it->Next()) {
-      found_keys.push_back(std::string{it->key()});
-    }
-
-    XCTAssertEqual(found_keys, std::vector<std::string>{});
-  }
-}
-
-- (void)testAddsSentinelRows {
-  ListenSequenceNumber old_sequence_number = 1;
-  ListenSequenceNumber new_sequence_number = 2;
-  std::string encoded_old_sequence_number =
-      LevelDbDocumentTargetKey::EncodeSentinelValue(old_sequence_number);
-  LevelDbMigrations::RunMigrations(_db.get(), 3);
-  {
-    std::string empty_buffer;
-    LevelDbTransaction transaction(_db.get(), "Setup");
-
-    // Set up target global
-    auto metadata = LevelDbQueryCache::ReadMetadata(_db.get());
-    // Expect that documents missing a row will get the new number
-    metadata->highest_listen_sequence_number = new_sequence_number;
-    transaction.Put(LevelDbTargetGlobalKey::Key(), metadata);
-
-    // Set up some documents (we only need the keys)
-    // For the odd ones, add sentinel rows.
-    for (int i = 0; i < 10; i++) {
-      DocumentKey key = DocumentKey::FromSegments({"docs", std::to_string(i)});
-      transaction.Put(LevelDbRemoteDocumentKey::Key(key), empty_buffer);
-      if (i % 2 == 1) {
-        std::string sentinel_key = LevelDbDocumentTargetKey::SentinelKey(key);
-        transaction.Put(sentinel_key, encoded_old_sequence_number);
-      }
-    }
-
-    transaction.Commit();
-  }
-
-  LevelDbMigrations::RunMigrations(_db.get(), 4);
-  {
-    LevelDbTransaction transaction(_db.get(), "Verify");
-    auto it = transaction.NewIterator();
-    std::string documents_prefix = LevelDbRemoteDocumentKey::KeyPrefix();
-    it->Seek(documents_prefix);
-    int count = 0;
-    LevelDbRemoteDocumentKey document_key;
-    std::string buffer;
-    for (; it->Valid() && absl::StartsWith(it->key(), documents_prefix); it->Next()) {
-      count++;
-      XCTAssertTrue(document_key.Decode(it->key()));
-      const DocumentKey &key = document_key.document_key();
-      std::string sentinel_key = LevelDbDocumentTargetKey::SentinelKey(key);
-      XCTAssertTrue(transaction.Get(sentinel_key, &buffer).ok());
-      int doc_number = atoi(key.path().last_segment().c_str());
-      // If the document number is odd, we expect the original old sequence number that we wrote.
-      // If it's even, we expect that the migration added the new sequence number from the target
-      // global
-      ListenSequenceNumber expected_sequence_number =
-          doc_number % 2 == 1 ? old_sequence_number : new_sequence_number;
-      ListenSequenceNumber sequence_number = LevelDbDocumentTargetKey::DecodeSentinelValue(buffer);
-      XCTAssertEqual(expected_sequence_number, sequence_number);
-    }
-    XCTAssertEqual(10, count);
-  }
-}
-
-- (void)testRemovesMutationBatches {
-  std::string emptyBuffer;
-  DocumentKey testWriteFoo = DocumentKey::FromPathString("docs/foo");
-  DocumentKey testWriteBar = DocumentKey::FromPathString("docs/bar");
-  DocumentKey testWriteBaz = DocumentKey::FromPathString("docs/baz");
-  DocumentKey testWritePending = DocumentKey::FromPathString("docs/pending");
-  // Do everything up until the mutation batch migration.
-  LevelDbMigrations::RunMigrations(_db.get(), 3);
-  // Set up data
-  {
-    LevelDbTransaction transaction(_db.get(), "Setup Foo");
-    // User 'foo' has two acknowledged mutations and one that is pending.
-    FSTPBMutationQueue *fooQueue = [[FSTPBMutationQueue alloc] init];
-    fooQueue.lastAcknowledgedBatchId = 2;
-    std::string fooKey = LevelDbMutationQueueKey::Key("foo");
-    transaction.Put(fooKey, fooQueue);
-
-    FSTPBWriteBatch *fooBatch1 = [[FSTPBWriteBatch alloc] init];
-    fooBatch1.batchId = 1;
-    std::string fooBatchKey1 = LevelDbMutationKey::Key("foo", 1);
-    transaction.Put(fooBatchKey1, fooBatch1);
-    transaction.Put(LevelDbDocumentMutationKey::Key("foo", testWriteFoo, 1), emptyBuffer);
-
-    FSTPBWriteBatch *fooBatch2 = [[FSTPBWriteBatch alloc] init];
-    fooBatch2.batchId = 2;
-    std::string fooBatchKey2 = LevelDbMutationKey::Key("foo", 2);
-    transaction.Put(fooBatchKey2, fooBatch2);
-    transaction.Put(LevelDbDocumentMutationKey::Key("foo", testWriteFoo, 2), emptyBuffer);
-
-    FSTPBWriteBatch *fooBatch3 = [[FSTPBWriteBatch alloc] init];
-    fooBatch3.batchId = 5;
-    std::string fooBatchKey3 = LevelDbMutationKey::Key("foo", 5);
-    transaction.Put(fooBatchKey3, fooBatch3);
-    transaction.Put(LevelDbDocumentMutationKey::Key("foo", testWritePending, 5), emptyBuffer);
-
-    transaction.Commit();
-  }
-
-  {
-    LevelDbTransaction transaction(_db.get(), "Setup Bar");
-    // User 'bar' has one acknowledged mutation and one that is pending
-    FSTPBMutationQueue *barQueue = [[FSTPBMutationQueue alloc] init];
-    barQueue.lastAcknowledgedBatchId = 3;
-    std::string barKey = LevelDbMutationQueueKey::Key("bar");
-    transaction.Put(barKey, barQueue);
-
-    FSTPBWriteBatch *barBatch1 = [[FSTPBWriteBatch alloc] init];
-    barBatch1.batchId = 3;
-    std::string barBatchKey1 = LevelDbMutationKey::Key("bar", 3);
-    transaction.Put(barBatchKey1, barBatch1);
-    transaction.Put(LevelDbDocumentMutationKey::Key("bar", testWriteBar, 3), emptyBuffer);
-    transaction.Put(LevelDbDocumentMutationKey::Key("bar", testWriteBaz, 3), emptyBuffer);
-
-    FSTPBWriteBatch *barBatch2 = [[FSTPBWriteBatch alloc] init];
-    barBatch2.batchId = 4;
-    std::string barBatchKey2 = LevelDbMutationKey::Key("bar", 4);
-    transaction.Put(barBatchKey2, barBatch2);
-    transaction.Put(LevelDbDocumentMutationKey::Key("bar", testWritePending, 4), emptyBuffer);
-
-    transaction.Commit();
-  }
-
-  {
-    LevelDbTransaction transaction(_db.get(), "Setup Empty");
-    // User 'empty' has no mutations
-    FSTPBMutationQueue *emptyQueue = [[FSTPBMutationQueue alloc] init];
-    emptyQueue.lastAcknowledgedBatchId = -1;
-    std::string emptyKey = LevelDbMutationQueueKey::Key("empty");
-    transaction.Put(emptyKey, emptyQueue);
-    transaction.Commit();
-  }
-
-  LevelDbMigrations::RunMigrations(_db.get(), 5);
-
-  {
-    // Verify
-    std::string buffer;
-    LevelDbTransaction transaction(_db.get(), "Verify");
-    // verify that we deleted the correct batches
-    XCTAssertTrue(transaction.Get(LevelDbMutationKey::Key("foo", 1), &buffer).IsNotFound());
-    XCTAssertTrue(transaction.Get(LevelDbMutationKey::Key("foo", 2), &buffer).IsNotFound());
-    XCTAssertTrue(transaction.Get(LevelDbMutationKey::Key("foo", 5), &buffer).ok());
-
-    XCTAssertTrue(transaction.Get(LevelDbMutationKey::Key("bar", 3), &buffer).IsNotFound());
-    XCTAssertTrue(transaction.Get(LevelDbMutationKey::Key("bar", 4), &buffer).ok());
-
-    // verify document associations have been removed
-    XCTAssertTrue(transaction.Get(LevelDbDocumentMutationKey::Key("foo", testWriteFoo, 1), &buffer)
-                      .IsNotFound());
-    XCTAssertTrue(transaction.Get(LevelDbDocumentMutationKey::Key("foo", testWriteFoo, 2), &buffer)
-                      .IsNotFound());
-    XCTAssertTrue(
-        transaction.Get(LevelDbDocumentMutationKey::Key("foo", testWritePending, 5), &buffer).ok());
-
-    XCTAssertTrue(transaction.Get(LevelDbDocumentMutationKey::Key("bar", testWriteBar, 3), &buffer)
-                      .IsNotFound());
-    XCTAssertTrue(transaction.Get(LevelDbDocumentMutationKey::Key("bar", testWriteBaz, 3), &buffer)
-                      .IsNotFound());
-    XCTAssertTrue(
-        transaction.Get(LevelDbDocumentMutationKey::Key("bar", testWritePending, 4), &buffer).ok());
-  }
-}
-
-- (void)testCreateCollectionParentsIndex {
-  // This test creates a database with schema version 5 that has a few
-  // mutations and a few remote documents and then ensures that appropriate
-  // entries are written to the collectionParentIndex.
-  std::vector<std::string> write_paths{"cg1/x", "cg1/y", "cg1/x/cg1/x", "cg2/x", "cg1/x/cg2/x"};
-  std::vector<std::string> remote_doc_paths{"cg1/z", "cg1/y/cg1/x", "cg2/x/cg3/x",
-                                            "blah/x/blah/x/cg3/x"};
-  std::map<std::string, std::vector<std::string>> expected_parents{
-      {"cg1", {"", "cg1/x", "cg1/y"}}, {"cg2", {"", "cg1/x"}}, {"cg3", {"blah/x/blah/x", "cg2/x"}}};
-
-  std::string empty_buffer;
-  LevelDbMigrations::RunMigrations(_db.get(), 5);
-  {
-    LevelDbTransaction transaction(_db.get(), "Write Mutations and Remote Documents");
-    // Write mutations.
-    for (auto write_path : write_paths) {
-      // We "cheat" and only write the DbDocumentMutation index entries, since
-      // that's all the migration uses.
-      DocumentKey key = DocumentKey::FromPathString(write_path);
-      transaction.Put(LevelDbDocumentMutationKey::Key("dummy-uid", key, /*dummy batchId=*/123),
-                      empty_buffer);
-    }
-
-    // Write remote document entries.
-    for (auto remote_doc_path : remote_doc_paths) {
-      DocumentKey key = DocumentKey::FromPathString(remote_doc_path);
-      transaction.Put(LevelDbRemoteDocumentKey::Key(key), empty_buffer);
-    }
-
-    transaction.Commit();
-  }
-
-  // Migrate to v6 and verify index entries.
-  LevelDbMigrations::RunMigrations(_db.get(), 6);
-  {
-    LevelDbTransaction transaction(_db.get(), "Verify");
-
-    std::map<std::string, std::vector<std::string>> actual_parents;
-    auto index_iterator = transaction.NewIterator();
-    std::string index_prefix = LevelDbCollectionParentKey::KeyPrefix();
-    LevelDbCollectionParentKey row_key;
-    for (index_iterator->Seek(index_prefix); index_iterator->Valid(); index_iterator->Next()) {
-      if (!absl::StartsWith(index_iterator->key(), index_prefix) ||
-          !row_key.Decode(index_iterator->key()))
-        break;
-
-      std::vector<std::string> &parents = actual_parents[row_key.collection_id()];
-      parents.push_back(row_key.parent().CanonicalString());
-    }
-
-    XCTAssertEqual(actual_parents, expected_parents);
-  }
-}
-
-- (void)testCanDowngrade {
-  // First, run all of the migrations
-  LevelDbMigrations::RunMigrations(_db.get());
-
-  LevelDbMigrations::SchemaVersion latestVersion = LevelDbMigrations::ReadSchemaVersion(_db.get());
-
-  // Downgrade to an early version.
-  LevelDbMigrations::SchemaVersion downgradeVersion = 1;
-  LevelDbMigrations::RunMigrations(_db.get(), downgradeVersion);
-  LevelDbMigrations::SchemaVersion postDowngradeVersion =
-      LevelDbMigrations::ReadSchemaVersion(_db.get());
-  XCTAssertEqual(downgradeVersion, postDowngradeVersion);
-
-  // Verify that we can upgrade again to the latest version.
-  LevelDbMigrations::RunMigrations(_db.get());
-  LevelDbMigrations::SchemaVersion finalVersion = LevelDbMigrations::ReadSchemaVersion(_db.get());
-  XCTAssertEqual(finalVersion, latestVersion);
-}
-
-/**
- * Creates the name of a dummy entry to make sure the iteration is correctly bounded.
- */
-- (std::string)dummyKeyForTable:(const char *)tableName {
-  std::string dummyKey;
-  // Magic number that indicates a table name follows. Needed to mimic the prefix to the target
-  // table.
-  OrderedCode::WriteSignedNumIncreasing(&dummyKey, 5);
-  OrderedCode::WriteString(&dummyKey, tableName);
-  return dummyKey;
-}
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 311
Firestore/Example/Tests/Local/FSTLevelDBTransactionTests.mm

@@ -1,311 +0,0 @@
-/*
- * Copyright 2018 Google
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#import <XCTest/XCTest.h>
-
-#include <memory>
-#include <string>
-
-// This is out of order to satisfy the linter, which doesn't realize this is
-// the header corresponding to this test.
-// TODO(wilhuff): move this to the top once the test filename matches
-#include "Firestore/core/src/firebase/firestore/local/leveldb_transaction.h"
-
-#import "Firestore/Protos/objc/firestore/local/Mutation.pbobjc.h"
-#import "Firestore/Protos/objc/firestore/local/Target.pbobjc.h"
-
-#include "Firestore/core/src/firebase/firestore/local/leveldb_key.h"
-#include "Firestore/core/src/firebase/firestore/util/path.h"
-#include "Firestore/core/test/firebase/firestore/local/persistence_testing.h"
-#include "absl/strings/string_view.h"
-#include "leveldb/db.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-using firebase::firestore::local::LevelDbDir;
-using firebase::firestore::local::LevelDbMutationKey;
-using firebase::firestore::local::LevelDbTransaction;
-using firebase::firestore::util::Path;
-using leveldb::DB;
-using leveldb::Options;
-using leveldb::ReadOptions;
-using leveldb::Status;
-using leveldb::WriteOptions;
-
-@interface FSTLevelDBTransactionTests : XCTestCase
-@end
-
-@implementation FSTLevelDBTransactionTests {
-  std::unique_ptr<DB> _db;
-}
-
-- (void)setUp {
-  Options options;
-  options.error_if_exists = true;
-  options.create_if_missing = true;
-
-  Path dir = LevelDbDir();
-  DB *db;
-  Status status = DB::Open(options, dir.ToUtf8String(), &db);
-  XCTAssert(status.ok(), @"Failed to create db: %s", status.ToString().c_str());
-  _db.reset(db);
-}
-
-- (void)tearDown {
-  _db.reset();
-}
-
-- (void)testCreateTransaction {
-  LevelDbTransaction transaction(_db.get(), "testCreateTransaction");
-  std::string key = "key1";
-
-  transaction.Put(key, "value");
-  auto iter = transaction.NewIterator();
-  iter->Seek(key);
-  XCTAssertEqual(key, iter->key());
-  iter->Next();
-  XCTAssertFalse(iter->Valid());
-}
-
-- (void)testCanReadCommittedAndMutations {
-  const std::string committed_key1 = "c_key1";
-  const std::string committed_value1 = "c_value1";
-  const WriteOptions &writeOptions = LevelDbTransaction::DefaultWriteOptions();
-  // add two things committed, mutate one, add another mutation
-  // verify you can get the original committed, the mutation, and the addition
-  Status status = _db->Put(writeOptions, committed_key1, committed_value1);
-  XCTAssertTrue(status.ok());
-
-  const std::string committed_key2 = "c_key2";
-  const std::string committed_value2 = "c_value2";
-  status = _db->Put(writeOptions, committed_key2, committed_value2);
-  XCTAssertTrue(status.ok());
-
-  LevelDbTransaction transaction(_db.get(), "testCanReadCommittedAndMutations");
-  const std::string mutation_key1 = "m_key1";
-  const std::string mutation_value1 = "m_value1";
-  transaction.Put(mutation_key1, mutation_value1);
-
-  const std::string mutation_key2 = committed_key2;
-  const std::string mutation_value2 = "m_value2";
-  transaction.Put(mutation_key2, mutation_value2);
-
-  std::string value;
-  status = transaction.Get(committed_key1, &value);
-  XCTAssertTrue(status.ok());
-  XCTAssertEqual(value, committed_value1);
-
-  status = transaction.Get(mutation_key1, &value);
-  XCTAssertTrue(status.ok());
-  XCTAssertEqual(value, mutation_value1);
-
-  status = transaction.Get(committed_key2, &value);
-  XCTAssertTrue(status.ok());
-  XCTAssertEqual(value, mutation_value2);
-}
-
-- (void)testDeleteCommitted {
-  // add something committed, delete it, verify you can't read it
-  for (int i = 0; i < 3; ++i) {
-    Status status = _db->Put(LevelDbTransaction::DefaultWriteOptions(), "key_" + std::to_string(i),
-                             "value_" + std::to_string(i));
-    XCTAssertTrue(status.ok());
-  }
-  LevelDbTransaction transaction(_db.get(), "testDeleteCommitted");
-  transaction.Put("key_1", "new_value");
-  std::string value;
-  Status status = transaction.Get("key_1", &value);
-  XCTAssertTrue(status.ok());
-  XCTAssertEqual(value, "new_value");
-
-  transaction.Delete("key_1");
-  status = transaction.Get("key_1", &value);
-  XCTAssertTrue(status.IsNotFound());
-
-  LevelDbTransaction::Iterator iter(&transaction);
-  iter.Seek("");
-  XCTAssertEqual(iter.key(), "key_0");
-  iter.Next();
-  XCTAssertEqual(iter.key(), "key_2");
-  iter.Next();
-  XCTAssertFalse(iter.Valid());
-}
-
-- (void)testMutateDeleted {
-  // delete something, then mutate it, then read it.
-  // Also include an actual deletion
-  for (int i = 0; i < 4; ++i) {
-    Status status = _db->Put(LevelDbTransaction::DefaultWriteOptions(), "key_" + std::to_string(i),
-                             "value_" + std::to_string(i));
-    XCTAssertTrue(status.ok());
-  }
-  std::string value;
-  LevelDbTransaction transaction(_db.get(), "testMutateDeleted");
-  transaction.Delete("key_1");
-  Status status = transaction.Get("key_1", &value);
-  XCTAssertTrue(status.IsNotFound());
-
-  transaction.Put("key_1", "new_value");
-  status = transaction.Get("key_1", &value);
-  XCTAssertTrue(status.ok());
-  XCTAssertEqual(value, "new_value");
-
-  transaction.Delete("key_3");
-
-  LevelDbTransaction::Iterator iter(&transaction);
-  iter.Seek("");
-  XCTAssertEqual(iter.key(), "key_0");
-  iter.Next();
-  XCTAssertEqual(iter.key(), "key_1");
-  XCTAssertEqual(iter.value(), "new_value");
-  iter.Next();
-  XCTAssertEqual(iter.key(), "key_2");
-  iter.Next();
-  XCTAssertFalse(iter.Valid());
-
-  // Commit, then check underlying db.
-  transaction.Commit();
-
-  const ReadOptions &readOptions = LevelDbTransaction::DefaultReadOptions();
-  status = _db->Get(readOptions, "key_0", &value);
-  XCTAssertTrue(status.ok());
-  XCTAssertEqual("value_0", value);
-
-  status = _db->Get(readOptions, "key_1", &value);
-  XCTAssertTrue(status.ok());
-  XCTAssertEqual("new_value", value);
-
-  status = _db->Get(readOptions, "key_2", &value);
-  XCTAssertTrue(status.ok());
-  XCTAssertEqual("value_2", value);
-
-  status = _db->Get(readOptions, "key_3", &value);
-  XCTAssertTrue(status.IsNotFound());
-}
-
-- (void)testProtobufSupport {
-  LevelDbTransaction transaction(_db.get(), "testProtobufSupport");
-
-  FSTPBTarget *target = [FSTPBTarget message];
-  target.targetId = 1;
-  target.lastListenSequenceNumber = 2;
-
-  std::string key("theKey");
-  transaction.Put(key, target);
-
-  std::string value;
-  Status status = transaction.Get("theKey", &value);
-  NSData *result = [[NSData alloc] initWithBytesNoCopy:(void *)value.data()
-                                                length:value.size()
-                                          freeWhenDone:NO];
-  NSError *error;
-  FSTPBTarget *parsed = [FSTPBTarget parseFromData:result error:&error];
-  XCTAssertNil(error);
-  XCTAssertTrue([target isEqual:parsed]);
-}
-
-- (void)testCanIterateAndDelete {
-  LevelDbTransaction transaction(_db.get(), "testCanIterateAndDelete");
-
-  for (int i = 0; i < 4; ++i) {
-    transaction.Put("key_" + std::to_string(i), "value_" + std::to_string(i));
-  }
-
-  auto it = transaction.NewIterator();
-  it->Seek("key_0");
-  for (int i = 0; i < 4; ++i) {
-    XCTAssertTrue(it->Valid());
-    absl::string_view key = it->key();
-    std::string expected = "key_" + std::to_string(i);
-    XCTAssertEqual(expected, key);
-    transaction.Delete(key);
-    it->Next();
-  }
-}
-
-- (void)testCanIterateFromDeletionToCommitted {
-  // Write keys key_0 and key_1
-  for (int i = 0; i < 2; ++i) {
-    Status status = _db->Put(LevelDbTransaction::DefaultWriteOptions(), "key_" + std::to_string(i),
-                             "value_" + std::to_string(i));
-    XCTAssertTrue(status.ok());
-  }
-
-  // Create a transaction, iterate, deleting key_0. Verify we still iterate key_1.
-  LevelDbTransaction transaction(_db.get(), "testCanIterateFromDeletionToCommitted");
-  auto it = transaction.NewIterator();
-  it->Seek("key_0");
-  XCTAssertTrue(it->Valid());
-  XCTAssertEqual("key_0", it->key());
-  transaction.Delete("key_0");
-  it->Next();
-  XCTAssertTrue(it->Valid());
-  XCTAssertEqual("key_1", it->key());
-  it->Next();
-  XCTAssertFalse(it->Valid());
-}
-
-- (void)testDeletingAheadOfAnIterator {
-  // Write keys
-  for (int i = 0; i < 4; ++i) {
-    Status status = _db->Put(LevelDbTransaction::DefaultWriteOptions(), "key_" + std::to_string(i),
-                             "value_" + std::to_string(i));
-    XCTAssertTrue(status.ok());
-  }
-
-  // Create a transaction, iterate to key_1, delete key_2. Verify we still iterate key_3.
-  LevelDbTransaction transaction(_db.get(), "testDeletingAheadOfAnIterator");
-  auto it = transaction.NewIterator();
-  it->Seek("key_0");
-  XCTAssertTrue(it->Valid());
-  XCTAssertEqual("key_0", it->key());
-  it->Next();
-  XCTAssertTrue(it->Valid());
-  XCTAssertEqual("key_1", it->key());
-  transaction.Delete("key_2");
-  it->Next();
-  XCTAssertTrue(it->Valid());
-  XCTAssertEqual("key_3", it->key());
-  XCTAssertTrue(it->Valid());
-  it->Next();
-  XCTAssertFalse(it->Valid());
-}
-
-- (void)testToString {
-  std::string key = LevelDbMutationKey::Key("user1", 42);
-  FSTPBWriteBatch *message = [FSTPBWriteBatch message];
-  message.batchId = 42;
-
-  LevelDbTransaction transaction(_db.get(), "testToString");
-  std::string description = transaction.ToString();
-  XCTAssertEqual(description, "<LevelDbTransaction testToString: 0 changes (0 bytes):>");
-
-  transaction.Put(key, message);
-  description = transaction.ToString();
-  XCTAssertEqual(description, "<LevelDbTransaction testToString: 1 changes (2 bytes):\n"
-                              "  - Put [mutation: user_id=user1 batch_id=42] (2 bytes)>");
-
-  std::string key2 = LevelDbMutationKey::Key("user1", 43);
-  transaction.Delete(key2);
-  description = transaction.ToString();
-  XCTAssertEqual(description, "<LevelDbTransaction testToString: 2 changes (2 bytes):\n"
-                              "  - Delete [mutation: user_id=user1 batch_id=43]\n"
-                              "  - Put [mutation: user_id=user1 batch_id=42] (2 bytes)>");
-}
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 48
Firestore/Example/Tests/Local/FSTMemoryLRUGarbageCollectorTests.mm

@@ -1,48 +0,0 @@
-/*
- * Copyright 2018 Google
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#import "Firestore/Example/Tests/Local/FSTLRUGarbageCollectorTests.h"
-
-#include "Firestore/core/src/firebase/firestore/local/memory_lru_reference_delegate.h"
-#include "Firestore/core/src/firebase/firestore/local/memory_persistence.h"
-#include "Firestore/core/src/firebase/firestore/model/document_key.h"
-#include "Firestore/core/test/firebase/firestore/local/persistence_testing.h"
-
-using firebase::firestore::model::DocumentKey;
-using firebase::firestore::local::LruParams;
-using firebase::firestore::local::MemoryLruReferenceDelegate;
-using firebase::firestore::local::MemoryPersistenceWithLruGcForTesting;
-using firebase::firestore::local::Persistence;
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface FSTMemoryLRUGarbageCollectionTests : FSTLRUGarbageCollectorTests
-@end
-
-@implementation FSTMemoryLRUGarbageCollectionTests
-
-- (std::unique_ptr<Persistence>)newPersistenceWithLruParams:(LruParams)lruParams {
-  return MemoryPersistenceWithLruGcForTesting(lruParams);
-}
-
-- (BOOL)sentinelExists:(const DocumentKey &)key {
-  auto delegate = static_cast<MemoryLruReferenceDelegate *>(self.persistence->reference_delegate());
-  return delegate->IsPinnedAtSequenceNumber(0, key);
-}
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 10 - 168
Firestore/Protos/CMakeLists.txt

@@ -111,43 +111,12 @@ function(snake_case_to_camel_case str var)
   set(${var} ${str} PARENT_SCOPE)
 endfunction()
 
-# Populate PROTOBUF_OBJC_GENERATED_SOURCES with the list of libprotobuf
-# Objective-C sources. These are used by the old Objective-C implementation
-# that we're replacing.
-#
-# Libprotobuf Objective-C also includes the well-known protos so they must be
-# omitted here.
-set(
-  PROTOBUF_OBJC_GENERATED_SOURCES
-)
-foreach(root ${PROTO_FILE_ROOTS})
-  get_filename_component(dir ${root} DIRECTORY)
-  get_filename_component(fname ${root} NAME)
-
-  # protoc converts the filename from snake case to camel case, so we must do
-  # that too.
-  if(${fname} STREQUAL "http")
-    # Hack: Something, somewhere is causing protoc to special case 'http' and
-    # convert it to HTTP (rather than Http) for objc. So we'll special case it
-    # here too.
-    set(fname "HTTP")
-  else()
-    snake_case_to_camel_case(${fname} fname)
-  endif()
-
-  list(
-    APPEND PROTOBUF_OBJC_GENERATED_SOURCES
-    ${OUTPUT_DIR}/objc/${dir}/${fname}.pbobjc.h
-    ${OUTPUT_DIR}/objc/${dir}/${fname}.pbobjc.m
-  )
-endforeach()
-
-
 cc_library(
   firebase_firestore_protos_nanopb
   SOURCES
     ${NANOPB_GENERATED_SOURCES}
   DEPENDS
+    firebase_firestore_nanopb
     protobuf-nanopb-static
 )
 
@@ -168,32 +137,19 @@ cc_library(
   EXCLUDE_FROM_ALL
 )
 
+if(CXX_CLANG OR CXX_GNU)
+  target_compile_options(
+    firebase_firestore_protos_libprotobuf PRIVATE
+    -Wno-unreachable-code
+  )
+endif()
+
+
 target_include_directories(
   firebase_firestore_protos_libprotobuf PUBLIC
   ${FIREBASE_SOURCE_DIR}/Firestore/Protos/cpp
 )
 
-if(APPLE)
-  cc_library(
-    firebase_firestore_protos_objc
-    SOURCES
-      ${PROTOBUF_OBJC_GENERATED_SOURCES}
-    DEPENDS
-      libprotobuf_objc
-    EXCLUDE_FROM_ALL
-  )
-
-  target_include_directories(
-    firebase_firestore_protos_objc PRIVATE
-    ${FIREBASE_SOURCE_DIR}/Firestore/Protos/objc/firestore/local
-    ${FIREBASE_SOURCE_DIR}/Firestore/Protos/objc/google/firestore/v1
-    ${FIREBASE_SOURCE_DIR}/Firestore/Protos/objc/google/api
-    ${FIREBASE_SOURCE_DIR}/Firestore/Protos/objc/google/rpc
-    ${FIREBASE_SOURCE_DIR}/Firestore/Protos/objc/google/type
-  )
-endif()
-
-
 # Generate the python representation of descriptor.proto.
 set(PROTOBUF_DIR ${FIREBASE_BINARY_DIR}/external/src/grpc/third_party/protobuf)
 set(PROTOBUF_PROTO ${PROTOBUF_DIR}/src/google/protobuf/descriptor.proto)
@@ -264,6 +220,7 @@ add_custom_command(
     protoc
     ${CMAKE_CURRENT_SOURCE_DIR}/build_protos.py
     ${CMAKE_CURRENT_SOURCE_DIR}/nanopb_cpp_generator.py
+    ${CMAKE_CURRENT_SOURCE_DIR}/lib/pretty_printing.py
     ${NANOPB_PYTHON}
     ${PROTOBUF_PYTHON}
     ${PROTO_FILES}
@@ -299,28 +256,6 @@ add_custom_target(
     ${PROTOBUF_CPP_GENERATED_SOURCES}
 )
 
-add_custom_command(
-  COMMENT "Generating Objective-C protobuf sources"
-  OUTPUT ${PROTOBUF_OBJC_GENERATED_SOURCES}
-  COMMAND
-    ${CMAKE_CURRENT_SOURCE_DIR}/build_protos.py
-      --objc
-      --protoc=$<TARGET_FILE:protoc>
-      --output_dir=${OUTPUT_DIR}
-      ${PROTO_INCLUDES}
-  VERBATIM
-  DEPENDS
-    protoc
-    ${CMAKE_CURRENT_SOURCE_DIR}/build_protos.py
-    ${PROTO_FILES}
-)
-
-add_custom_target(
-  generate_objc_protos
-  DEPENDS
-    ${PROTOBUF_OBJC_GENERATED_SOURCES}
-)
-
 # Custom target that runs a script to generate the proto sources. This isn't
 # hooked into the build, so must be run manually. (It would be easy enough to
 # hook into the (posix) cmake build, but for consistency with windows and xcode
@@ -331,97 +266,4 @@ add_custom_target(
   DEPENDS
     generate_nanopb_protos
     generate_cpp_protos
-    generate_objc_protos
 )
-
-if(APPLE)
-  set(
-    protobuf_objc_source_dir
-    ${FIREBASE_EXTERNAL_SOURCE_DIR}/grpc/third_party/protobuf/objectivec
-  )
-  objc_framework(
-    Protobuf
-    HEADERS
-      ${protobuf_objc_source_dir}/GPBArray.h
-      ${protobuf_objc_source_dir}/GPBArray_PackagePrivate.h
-      ${protobuf_objc_source_dir}/GPBBootstrap.h
-      ${protobuf_objc_source_dir}/GPBCodedInputStream.h
-      ${protobuf_objc_source_dir}/GPBCodedInputStream_PackagePrivate.h
-      ${protobuf_objc_source_dir}/GPBCodedOutputStream.h
-      ${protobuf_objc_source_dir}/GPBCodedOutputStream_PackagePrivate.h
-      ${protobuf_objc_source_dir}/GPBDescriptor.h
-      ${protobuf_objc_source_dir}/GPBDescriptor_PackagePrivate.h
-      ${protobuf_objc_source_dir}/GPBDictionary.h
-      ${protobuf_objc_source_dir}/GPBDictionary_PackagePrivate.h
-      ${protobuf_objc_source_dir}/GPBExtensionInternals.h
-      ${protobuf_objc_source_dir}/GPBExtensionRegistry.h
-      ${protobuf_objc_source_dir}/GPBMessage.h
-      ${protobuf_objc_source_dir}/GPBMessage_PackagePrivate.h
-      ${protobuf_objc_source_dir}/GPBProtocolBuffers.h
-      ${protobuf_objc_source_dir}/GPBProtocolBuffers_RuntimeSupport.h
-      ${protobuf_objc_source_dir}/GPBRootObject.h
-      ${protobuf_objc_source_dir}/GPBRootObject_PackagePrivate.h
-      ${protobuf_objc_source_dir}/GPBRuntimeTypes.h
-      ${protobuf_objc_source_dir}/GPBUnknownField.h
-      ${protobuf_objc_source_dir}/GPBUnknownFieldSet.h
-      ${protobuf_objc_source_dir}/GPBUnknownFieldSet_PackagePrivate.h
-      ${protobuf_objc_source_dir}/GPBUnknownField_PackagePrivate.h
-      ${protobuf_objc_source_dir}/GPBUtilities.h
-      ${protobuf_objc_source_dir}/GPBUtilities_PackagePrivate.h
-      ${protobuf_objc_source_dir}/GPBWellKnownTypes.h
-      ${protobuf_objc_source_dir}/GPBWireFormat.h
-      ${protobuf_objc_source_dir}/google/protobuf/Any.pbobjc.h
-      ${protobuf_objc_source_dir}/google/protobuf/Api.pbobjc.h
-      ${protobuf_objc_source_dir}/google/protobuf/Duration.pbobjc.h
-      ${protobuf_objc_source_dir}/google/protobuf/Empty.pbobjc.h
-      ${protobuf_objc_source_dir}/google/protobuf/FieldMask.pbobjc.h
-      ${protobuf_objc_source_dir}/google/protobuf/SourceContext.pbobjc.h
-      ${protobuf_objc_source_dir}/google/protobuf/Struct.pbobjc.h
-      ${protobuf_objc_source_dir}/google/protobuf/Timestamp.pbobjc.h
-      ${protobuf_objc_source_dir}/google/protobuf/Type.pbobjc.h
-      ${protobuf_objc_source_dir}/google/protobuf/Wrappers.pbobjc.h
-
-    SOURCES
-      ${protobuf_objc_source_dir}/GPBArray.m
-      ${protobuf_objc_source_dir}/GPBCodedInputStream.m
-      ${protobuf_objc_source_dir}/GPBCodedOutputStream.m
-      ${protobuf_objc_source_dir}/GPBDescriptor.m
-      ${protobuf_objc_source_dir}/GPBDictionary.m
-      ${protobuf_objc_source_dir}/GPBExtensionInternals.m
-      ${protobuf_objc_source_dir}/GPBExtensionRegistry.m
-      ${protobuf_objc_source_dir}/GPBMessage.m
-      ${protobuf_objc_source_dir}/GPBProtocolBuffers.m
-      ${protobuf_objc_source_dir}/GPBRootObject.m
-      ${protobuf_objc_source_dir}/GPBUnknownField.m
-      ${protobuf_objc_source_dir}/GPBUnknownFieldSet.m
-      ${protobuf_objc_source_dir}/GPBUtilities.m
-      ${protobuf_objc_source_dir}/GPBWellKnownTypes.m
-      ${protobuf_objc_source_dir}/GPBWireFormat.m
-      ${protobuf_objc_source_dir}/google/protobuf/Any.pbobjc.m
-      ${protobuf_objc_source_dir}/google/protobuf/Api.pbobjc.m
-      ${protobuf_objc_source_dir}/google/protobuf/Duration.pbobjc.m
-      ${protobuf_objc_source_dir}/google/protobuf/Empty.pbobjc.m
-      ${protobuf_objc_source_dir}/google/protobuf/FieldMask.pbobjc.m
-      ${protobuf_objc_source_dir}/google/protobuf/SourceContext.pbobjc.m
-      ${protobuf_objc_source_dir}/google/protobuf/Struct.pbobjc.m
-      ${protobuf_objc_source_dir}/google/protobuf/Timestamp.pbobjc.m
-      ${protobuf_objc_source_dir}/google/protobuf/Type.pbobjc.m
-      ${protobuf_objc_source_dir}/google/protobuf/Wrappers.pbobjc.m
-  )
-  target_include_directories(
-    Protobuf
-    PRIVATE
-      ${protobuf_objc_source_dir}/google/protobuf
-    INTERFACE
-      ${PROJECT_BINARY_DIR}/Headers/Protobuf
-    PUBLIC
-      ${protobuf_objc_source_dir}
-  )
-  target_compile_options(
-    Protobuf PRIVATE
-    -fno-objc-arc
-    -Wno-missing-noescape
-  )
-  add_alias(libprotobuf_objc Protobuf)
-
-endif()

+ 11 - 36
Firestore/Protos/build_protos.py

@@ -122,9 +122,7 @@ class NanopbGenerator(object):
     post_process_files(
         sources,
         add_copyright,
-        nanopb_add_namespaces,
-        nanopb_remove_extern_c,
-        nanopb_rename_delete
+        nanopb_remove_extern_c
     )
 
   def __run_generator(self, out_dir):
@@ -211,7 +209,8 @@ class CppProtobufGenerator(object):
     # TODO(wilhuff): strip trailing whitespace?
     post_process_files(
         sources,
-        add_copyright
+        add_copyright,
+        cpp_rename_in,
     )
 
   def __run_generator(self, out_dir):
@@ -292,32 +291,7 @@ def add_copyright(lines):
   return result
 
 
-def nanopb_add_namespaces(lines):
-  """Adds C++ namespaces to the lines.
-
-  Args:
-    lines: The lines to fix.
-
-  Returns:
-    The lines, fixed.
-  """
-  result = []
-  for line in lines:
-    if '@@protoc_insertion_point(includes)' in line:
-      result.append('namespace firebase {\n')
-      result.append('namespace firestore {\n')
-      result.append('\n')
-
-    if '@@protoc_insertion_point(eof)' in line:
-      result.append('}  // namespace firestore\n')
-      result.append('}  // namespace firebase\n')
-      result.append('\n')
-
-    result.append(line)
-
-  return result
-
-
+# TODO(varconst|wilhuff): move this to `nanopb_cpp_generator.py`.
 def nanopb_remove_extern_c(lines):
   """Removes extern "C" directives from nanopb code.
 
@@ -343,11 +317,12 @@ def nanopb_remove_extern_c(lines):
   return result
 
 
-def nanopb_rename_delete(lines):
-  """Renames a delete symbol to delete_.
+def cpp_rename_in(lines):
+  """Renames an IN symbol to IN_.
 
-  If a proto uses a field named 'delete', nanopb happily uses that in the
-  message definition. Works fine for C; not so much for C++.
+  If a proto uses a enum member named 'IN', protobuf happily uses that in the
+  message definition. This conflicts with the IN parameter annotation macro in
+  windows.h.
 
   Args:
     lines: The lines to fix.
@@ -355,8 +330,8 @@ def nanopb_rename_delete(lines):
   Returns:
     The lines, fixed.
   """
-  delete_keyword = re.compile(r'\bdelete\b')
-  return [delete_keyword.sub('delete_', line) for line in lines]
+  in_macro = re.compile(r'\bIN\b')
+  return [in_macro.sub('IN_', line) for line in lines]
 
 
 def strip_trailing_whitespace(lines):

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 331 - 325
Firestore/Protos/cpp/firestore/local/maybe_document.pb.cc


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 344 - 247
Firestore/Protos/cpp/firestore/local/maybe_document.pb.h


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 320 - 284
Firestore/Protos/cpp/firestore/local/mutation.pb.cc


+ 261 - 192
Firestore/Protos/cpp/firestore/local/mutation.pb.h

@@ -17,30 +17,33 @@
 // Generated by the protocol buffer compiler.  DO NOT EDIT!
 // source: firestore/local/mutation.proto
 
-#ifndef PROTOBUF_firestore_2flocal_2fmutation_2eproto__INCLUDED
-#define PROTOBUF_firestore_2flocal_2fmutation_2eproto__INCLUDED
+#ifndef GOOGLE_PROTOBUF_INCLUDED_firestore_2flocal_2fmutation_2eproto
+#define GOOGLE_PROTOBUF_INCLUDED_firestore_2flocal_2fmutation_2eproto
 
+#include <limits>
 #include <string>
 
-#include <google/protobuf/stubs/common.h>
-
-#if GOOGLE_PROTOBUF_VERSION < 3005000
+#include <google/protobuf/port_def.inc>
+#if PROTOBUF_VERSION < 3009000
 #error This file was generated by a newer version of protoc which is
-#error incompatible with your Protocol Buffer headers.  Please update
+#error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
+#if 3009002 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
-#error incompatible with your Protocol Buffer headers.  Please
+#error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.
 #endif
 
+#include <google/protobuf/port_undef.inc>
 #include <google/protobuf/io/coded_stream.h>
 #include <google/protobuf/arena.h>
 #include <google/protobuf/arenastring.h>
 #include <google/protobuf/generated_message_table_driven.h>
 #include <google/protobuf/generated_message_util.h>
+#include <google/protobuf/inlined_string_field.h>
 #include <google/protobuf/metadata.h>
+#include <google/protobuf/generated_message_reflection.h>
 #include <google/protobuf/message.h>
 #include <google/protobuf/repeated_field.h>  // IWYU pragma: export
 #include <google/protobuf/extension_set.h>  // IWYU pragma: export
@@ -48,27 +51,27 @@
 #include "google/firestore/v1/write.pb.h"
 #include <google/protobuf/timestamp.pb.h>
 // @@protoc_insertion_point(includes)
+#include <google/protobuf/port_def.inc>
+#define PROTOBUF_INTERNAL_EXPORT_firestore_2flocal_2fmutation_2eproto
+PROTOBUF_NAMESPACE_OPEN
+namespace internal {
+class AnyMetadata;
+}  // namespace internal
+PROTOBUF_NAMESPACE_CLOSE
 
-namespace protobuf_firestore_2flocal_2fmutation_2eproto {
 // Internal implementation detail -- do not use these members.
-struct TableStruct {
-  static const ::google::protobuf::internal::ParseTableField entries[];
-  static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
-  static const ::google::protobuf::internal::ParseTable schema[2];
-  static const ::google::protobuf::internal::FieldMetadata field_metadata[];
-  static const ::google::protobuf::internal::SerializationTable serialization_table[];
-  static const ::google::protobuf::uint32 offsets[];
+struct TableStruct_firestore_2flocal_2fmutation_2eproto {
+  static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[]
+    PROTOBUF_SECTION_VARIABLE(protodesc_cold);
+  static const ::PROTOBUF_NAMESPACE_ID::internal::AuxillaryParseTableField aux[]
+    PROTOBUF_SECTION_VARIABLE(protodesc_cold);
+  static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[2]
+    PROTOBUF_SECTION_VARIABLE(protodesc_cold);
+  static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
+  static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
+  static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
 };
-void AddDescriptors();
-void InitDefaultsMutationQueueImpl();
-void InitDefaultsMutationQueue();
-void InitDefaultsWriteBatchImpl();
-void InitDefaultsWriteBatch();
-inline void InitDefaults() {
-  InitDefaultsMutationQueue();
-  InitDefaultsWriteBatch();
-}
-}  // namespace protobuf_firestore_2flocal_2fmutation_2eproto
+extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_firestore_2flocal_2fmutation_2eproto;
 namespace firestore {
 namespace client {
 class MutationQueue;
@@ -79,28 +82,31 @@ class WriteBatchDefaultTypeInternal;
 extern WriteBatchDefaultTypeInternal _WriteBatch_default_instance_;
 }  // namespace client
 }  // namespace firestore
+PROTOBUF_NAMESPACE_OPEN
+template<> ::firestore::client::MutationQueue* Arena::CreateMaybeMessage<::firestore::client::MutationQueue>(Arena*);
+template<> ::firestore::client::WriteBatch* Arena::CreateMaybeMessage<::firestore::client::WriteBatch>(Arena*);
+PROTOBUF_NAMESPACE_CLOSE
 namespace firestore {
 namespace client {
 
 // ===================================================================
 
-class MutationQueue : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:firestore.client.MutationQueue) */ {
+class MutationQueue :
+    public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:firestore.client.MutationQueue) */ {
  public:
   MutationQueue();
   virtual ~MutationQueue();
 
   MutationQueue(const MutationQueue& from);
-
-  inline MutationQueue& operator=(const MutationQueue& from) {
-    CopyFrom(from);
-    return *this;
-  }
-  #if LANG_CXX11
   MutationQueue(MutationQueue&& from) noexcept
     : MutationQueue() {
     *this = ::std::move(from);
   }
 
+  inline MutationQueue& operator=(const MutationQueue& from) {
+    CopyFrom(from);
+    return *this;
+  }
   inline MutationQueue& operator=(MutationQueue&& from) noexcept {
     if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
       if (this != &from) InternalSwap(&from);
@@ -109,8 +115,16 @@ class MutationQueue : public ::google::protobuf::Message /* @@protoc_insertion_p
     }
     return *this;
   }
-  #endif
-  static const ::google::protobuf::Descriptor* descriptor();
+
+  static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
+    return GetDescriptor();
+  }
+  static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
+    return GetMetadataStatic().descriptor;
+  }
+  static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
+    return GetMetadataStatic().reflection;
+  }
   static const MutationQueue& default_instance();
 
   static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
@@ -118,103 +132,125 @@ class MutationQueue : public ::google::protobuf::Message /* @@protoc_insertion_p
     return reinterpret_cast<const MutationQueue*>(
                &_MutationQueue_default_instance_);
   }
-  static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+  static constexpr int kIndexInFileMessages =
     0;
 
-  void Swap(MutationQueue* other);
   friend void swap(MutationQueue& a, MutationQueue& b) {
     a.Swap(&b);
   }
+  inline void Swap(MutationQueue* other) {
+    if (other == this) return;
+    InternalSwap(other);
+  }
 
   // implements Message ----------------------------------------------
 
-  inline MutationQueue* New() const PROTOBUF_FINAL { return New(NULL); }
+  inline MutationQueue* New() const final {
+    return CreateMaybeMessage<MutationQueue>(nullptr);
+  }
 
-  MutationQueue* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
-  void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
-  void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+  MutationQueue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+    return CreateMaybeMessage<MutationQueue>(arena);
+  }
+  void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
+  void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
   void CopyFrom(const MutationQueue& from);
   void MergeFrom(const MutationQueue& from);
-  void Clear() PROTOBUF_FINAL;
-  bool IsInitialized() const PROTOBUF_FINAL;
+  PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
+  bool IsInitialized() const final;
 
-  size_t ByteSizeLong() const PROTOBUF_FINAL;
+  size_t ByteSizeLong() const final;
+  #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
+  const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
+  #else
   bool MergePartialFromCodedStream(
-      ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
+      ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final;
+  #endif  // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
   void SerializeWithCachedSizes(
-      ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
-  ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
-      bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
-  int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
+      ::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream* output) const final;
+  ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray(
+      ::PROTOBUF_NAMESPACE_ID::uint8* target) const final;
+  int GetCachedSize() const final { return _cached_size_.Get(); }
+
   private:
-  void SharedCtor();
-  void SharedDtor();
-  void SetCachedSize(int size) const PROTOBUF_FINAL;
+  inline void SharedCtor();
+  inline void SharedDtor();
+  void SetCachedSize(int size) const final;
   void InternalSwap(MutationQueue* other);
+  friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
+  static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
+    return "firestore.client.MutationQueue";
+  }
   private:
-  inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
-    return NULL;
+  inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const {
+    return nullptr;
   }
   inline void* MaybeArenaPtr() const {
-    return NULL;
+    return nullptr;
   }
   public:
 
-  ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
+  ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
+  private:
+  static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
+    ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_firestore_2flocal_2fmutation_2eproto);
+    return ::descriptor_table_firestore_2flocal_2fmutation_2eproto.file_level_metadata[kIndexInFileMessages];
+  }
+
+  public:
 
   // nested types ----------------------------------------------------
 
   // accessors -------------------------------------------------------
 
+  enum : int {
+    kLastStreamTokenFieldNumber = 2,
+    kLastAcknowledgedBatchIdFieldNumber = 1,
+  };
   // bytes last_stream_token = 2;
   void clear_last_stream_token();
-  static const int kLastStreamTokenFieldNumber = 2;
-  const ::std::string& last_stream_token() const;
-  void set_last_stream_token(const ::std::string& value);
-  #if LANG_CXX11
-  void set_last_stream_token(::std::string&& value);
-  #endif
+  const std::string& last_stream_token() const;
+  void set_last_stream_token(const std::string& value);
+  void set_last_stream_token(std::string&& value);
   void set_last_stream_token(const char* value);
   void set_last_stream_token(const void* value, size_t size);
-  ::std::string* mutable_last_stream_token();
-  ::std::string* release_last_stream_token();
-  void set_allocated_last_stream_token(::std::string* last_stream_token);
+  std::string* mutable_last_stream_token();
+  std::string* release_last_stream_token();
+  void set_allocated_last_stream_token(std::string* last_stream_token);
 
   // int32 last_acknowledged_batch_id = 1;
   void clear_last_acknowledged_batch_id();
-  static const int kLastAcknowledgedBatchIdFieldNumber = 1;
-  ::google::protobuf::int32 last_acknowledged_batch_id() const;
-  void set_last_acknowledged_batch_id(::google::protobuf::int32 value);
+  ::PROTOBUF_NAMESPACE_ID::int32 last_acknowledged_batch_id() const;
+  void set_last_acknowledged_batch_id(::PROTOBUF_NAMESPACE_ID::int32 value);
 
   // @@protoc_insertion_point(class_scope:firestore.client.MutationQueue)
  private:
+  class _Internal;
 
-  ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
-  ::google::protobuf::internal::ArenaStringPtr last_stream_token_;
-  ::google::protobuf::int32 last_acknowledged_batch_id_;
-  mutable int _cached_size_;
-  friend struct ::protobuf_firestore_2flocal_2fmutation_2eproto::TableStruct;
-  friend void ::protobuf_firestore_2flocal_2fmutation_2eproto::InitDefaultsMutationQueueImpl();
+  ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
+  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr last_stream_token_;
+  ::PROTOBUF_NAMESPACE_ID::int32 last_acknowledged_batch_id_;
+  mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+  friend struct ::TableStruct_firestore_2flocal_2fmutation_2eproto;
 };
 // -------------------------------------------------------------------
 
-class WriteBatch : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:firestore.client.WriteBatch) */ {
+class WriteBatch :
+    public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:firestore.client.WriteBatch) */ {
  public:
   WriteBatch();
   virtual ~WriteBatch();
 
   WriteBatch(const WriteBatch& from);
-
-  inline WriteBatch& operator=(const WriteBatch& from) {
-    CopyFrom(from);
-    return *this;
-  }
-  #if LANG_CXX11
   WriteBatch(WriteBatch&& from) noexcept
     : WriteBatch() {
     *this = ::std::move(from);
   }
 
+  inline WriteBatch& operator=(const WriteBatch& from) {
+    CopyFrom(from);
+    return *this;
+  }
   inline WriteBatch& operator=(WriteBatch&& from) noexcept {
     if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
       if (this != &from) InternalSwap(&from);
@@ -223,8 +259,16 @@ class WriteBatch : public ::google::protobuf::Message /* @@protoc_insertion_poin
     }
     return *this;
   }
-  #endif
-  static const ::google::protobuf::Descriptor* descriptor();
+
+  static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
+    return GetDescriptor();
+  }
+  static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
+    return GetMetadataStatic().descriptor;
+  }
+  static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
+    return GetMetadataStatic().reflection;
+  }
   static const WriteBatch& default_instance();
 
   static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
@@ -232,104 +276,129 @@ class WriteBatch : public ::google::protobuf::Message /* @@protoc_insertion_poin
     return reinterpret_cast<const WriteBatch*>(
                &_WriteBatch_default_instance_);
   }
-  static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+  static constexpr int kIndexInFileMessages =
     1;
 
-  void Swap(WriteBatch* other);
   friend void swap(WriteBatch& a, WriteBatch& b) {
     a.Swap(&b);
   }
+  inline void Swap(WriteBatch* other) {
+    if (other == this) return;
+    InternalSwap(other);
+  }
 
   // implements Message ----------------------------------------------
 
-  inline WriteBatch* New() const PROTOBUF_FINAL { return New(NULL); }
+  inline WriteBatch* New() const final {
+    return CreateMaybeMessage<WriteBatch>(nullptr);
+  }
 
-  WriteBatch* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
-  void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
-  void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+  WriteBatch* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+    return CreateMaybeMessage<WriteBatch>(arena);
+  }
+  void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
+  void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
   void CopyFrom(const WriteBatch& from);
   void MergeFrom(const WriteBatch& from);
-  void Clear() PROTOBUF_FINAL;
-  bool IsInitialized() const PROTOBUF_FINAL;
+  PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
+  bool IsInitialized() const final;
 
-  size_t ByteSizeLong() const PROTOBUF_FINAL;
+  size_t ByteSizeLong() const final;
+  #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
+  const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
+  #else
   bool MergePartialFromCodedStream(
-      ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
+      ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final;
+  #endif  // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
   void SerializeWithCachedSizes(
-      ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
-  ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
-      bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
-  int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
+      ::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream* output) const final;
+  ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray(
+      ::PROTOBUF_NAMESPACE_ID::uint8* target) const final;
+  int GetCachedSize() const final { return _cached_size_.Get(); }
+
   private:
-  void SharedCtor();
-  void SharedDtor();
-  void SetCachedSize(int size) const PROTOBUF_FINAL;
+  inline void SharedCtor();
+  inline void SharedDtor();
+  void SetCachedSize(int size) const final;
   void InternalSwap(WriteBatch* other);
+  friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
+  static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
+    return "firestore.client.WriteBatch";
+  }
   private:
-  inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
-    return NULL;
+  inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const {
+    return nullptr;
   }
   inline void* MaybeArenaPtr() const {
-    return NULL;
+    return nullptr;
   }
   public:
 
-  ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
+  ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
+  private:
+  static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
+    ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_firestore_2flocal_2fmutation_2eproto);
+    return ::descriptor_table_firestore_2flocal_2fmutation_2eproto.file_level_metadata[kIndexInFileMessages];
+  }
+
+  public:
 
   // nested types ----------------------------------------------------
 
   // accessors -------------------------------------------------------
 
+  enum : int {
+    kWritesFieldNumber = 2,
+    kBaseWritesFieldNumber = 4,
+    kLocalWriteTimeFieldNumber = 3,
+    kBatchIdFieldNumber = 1,
+  };
   // repeated .google.firestore.v1.Write writes = 2;
   int writes_size() const;
   void clear_writes();
-  static const int kWritesFieldNumber = 2;
-  const ::google::firestore::v1::Write& writes(int index) const;
   ::google::firestore::v1::Write* mutable_writes(int index);
-  ::google::firestore::v1::Write* add_writes();
-  ::google::protobuf::RepeatedPtrField< ::google::firestore::v1::Write >*
+  ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::google::firestore::v1::Write >*
       mutable_writes();
-  const ::google::protobuf::RepeatedPtrField< ::google::firestore::v1::Write >&
+  const ::google::firestore::v1::Write& writes(int index) const;
+  ::google::firestore::v1::Write* add_writes();
+  const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::google::firestore::v1::Write >&
       writes() const;
 
   // repeated .google.firestore.v1.Write base_writes = 4;
   int base_writes_size() const;
   void clear_base_writes();
-  static const int kBaseWritesFieldNumber = 4;
-  const ::google::firestore::v1::Write& base_writes(int index) const;
   ::google::firestore::v1::Write* mutable_base_writes(int index);
-  ::google::firestore::v1::Write* add_base_writes();
-  ::google::protobuf::RepeatedPtrField< ::google::firestore::v1::Write >*
+  ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::google::firestore::v1::Write >*
       mutable_base_writes();
-  const ::google::protobuf::RepeatedPtrField< ::google::firestore::v1::Write >&
+  const ::google::firestore::v1::Write& base_writes(int index) const;
+  ::google::firestore::v1::Write* add_base_writes();
+  const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::google::firestore::v1::Write >&
       base_writes() const;
 
   // .google.protobuf.Timestamp local_write_time = 3;
   bool has_local_write_time() const;
   void clear_local_write_time();
-  static const int kLocalWriteTimeFieldNumber = 3;
-  const ::google::protobuf::Timestamp& local_write_time() const;
-  ::google::protobuf::Timestamp* release_local_write_time();
-  ::google::protobuf::Timestamp* mutable_local_write_time();
-  void set_allocated_local_write_time(::google::protobuf::Timestamp* local_write_time);
+  const PROTOBUF_NAMESPACE_ID::Timestamp& local_write_time() const;
+  PROTOBUF_NAMESPACE_ID::Timestamp* release_local_write_time();
+  PROTOBUF_NAMESPACE_ID::Timestamp* mutable_local_write_time();
+  void set_allocated_local_write_time(PROTOBUF_NAMESPACE_ID::Timestamp* local_write_time);
 
   // int32 batch_id = 1;
   void clear_batch_id();
-  static const int kBatchIdFieldNumber = 1;
-  ::google::protobuf::int32 batch_id() const;
-  void set_batch_id(::google::protobuf::int32 value);
+  ::PROTOBUF_NAMESPACE_ID::int32 batch_id() const;
+  void set_batch_id(::PROTOBUF_NAMESPACE_ID::int32 value);
 
   // @@protoc_insertion_point(class_scope:firestore.client.WriteBatch)
  private:
-
-  ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
-  ::google::protobuf::RepeatedPtrField< ::google::firestore::v1::Write > writes_;
-  ::google::protobuf::RepeatedPtrField< ::google::firestore::v1::Write > base_writes_;
-  ::google::protobuf::Timestamp* local_write_time_;
-  ::google::protobuf::int32 batch_id_;
-  mutable int _cached_size_;
-  friend struct ::protobuf_firestore_2flocal_2fmutation_2eproto::TableStruct;
-  friend void ::protobuf_firestore_2flocal_2fmutation_2eproto::InitDefaultsWriteBatchImpl();
+  class _Internal;
+
+  ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
+  ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::google::firestore::v1::Write > writes_;
+  ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::google::firestore::v1::Write > base_writes_;
+  PROTOBUF_NAMESPACE_ID::Timestamp* local_write_time_;
+  ::PROTOBUF_NAMESPACE_ID::int32 batch_id_;
+  mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+  friend struct ::TableStruct_firestore_2flocal_2fmutation_2eproto;
 };
 // ===================================================================
 
@@ -346,11 +415,11 @@ class WriteBatch : public ::google::protobuf::Message /* @@protoc_insertion_poin
 inline void MutationQueue::clear_last_acknowledged_batch_id() {
   last_acknowledged_batch_id_ = 0;
 }
-inline ::google::protobuf::int32 MutationQueue::last_acknowledged_batch_id() const {
+inline ::PROTOBUF_NAMESPACE_ID::int32 MutationQueue::last_acknowledged_batch_id() const {
   // @@protoc_insertion_point(field_get:firestore.client.MutationQueue.last_acknowledged_batch_id)
   return last_acknowledged_batch_id_;
 }
-inline void MutationQueue::set_last_acknowledged_batch_id(::google::protobuf::int32 value) {
+inline void MutationQueue::set_last_acknowledged_batch_id(::PROTOBUF_NAMESPACE_ID::int32 value) {
   
   last_acknowledged_batch_id_ = value;
   // @@protoc_insertion_point(field_set:firestore.client.MutationQueue.last_acknowledged_batch_id)
@@ -358,54 +427,52 @@ inline void MutationQueue::set_last_acknowledged_batch_id(::google::protobuf::in
 
 // bytes last_stream_token = 2;
 inline void MutationQueue::clear_last_stream_token() {
-  last_stream_token_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  last_stream_token_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
 }
-inline const ::std::string& MutationQueue::last_stream_token() const {
+inline const std::string& MutationQueue::last_stream_token() const {
   // @@protoc_insertion_point(field_get:firestore.client.MutationQueue.last_stream_token)
   return last_stream_token_.GetNoArena();
 }
-inline void MutationQueue::set_last_stream_token(const ::std::string& value) {
+inline void MutationQueue::set_last_stream_token(const std::string& value) {
   
-  last_stream_token_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+  last_stream_token_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value);
   // @@protoc_insertion_point(field_set:firestore.client.MutationQueue.last_stream_token)
 }
-#if LANG_CXX11
-inline void MutationQueue::set_last_stream_token(::std::string&& value) {
+inline void MutationQueue::set_last_stream_token(std::string&& value) {
   
   last_stream_token_.SetNoArena(
-    &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+    &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
   // @@protoc_insertion_point(field_set_rvalue:firestore.client.MutationQueue.last_stream_token)
 }
-#endif
 inline void MutationQueue::set_last_stream_token(const char* value) {
-  GOOGLE_DCHECK(value != NULL);
+  GOOGLE_DCHECK(value != nullptr);
   
-  last_stream_token_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+  last_stream_token_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
   // @@protoc_insertion_point(field_set_char:firestore.client.MutationQueue.last_stream_token)
 }
 inline void MutationQueue::set_last_stream_token(const void* value, size_t size) {
   
-  last_stream_token_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+  last_stream_token_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
       ::std::string(reinterpret_cast<const char*>(value), size));
   // @@protoc_insertion_point(field_set_pointer:firestore.client.MutationQueue.last_stream_token)
 }
-inline ::std::string* MutationQueue::mutable_last_stream_token() {
+inline std::string* MutationQueue::mutable_last_stream_token() {
   
   // @@protoc_insertion_point(field_mutable:firestore.client.MutationQueue.last_stream_token)
-  return last_stream_token_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  return last_stream_token_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
 }
-inline ::std::string* MutationQueue::release_last_stream_token() {
+inline std::string* MutationQueue::release_last_stream_token() {
   // @@protoc_insertion_point(field_release:firestore.client.MutationQueue.last_stream_token)
   
-  return last_stream_token_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  return last_stream_token_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
 }
-inline void MutationQueue::set_allocated_last_stream_token(::std::string* last_stream_token) {
-  if (last_stream_token != NULL) {
+inline void MutationQueue::set_allocated_last_stream_token(std::string* last_stream_token) {
+  if (last_stream_token != nullptr) {
     
   } else {
     
   }
-  last_stream_token_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), last_stream_token);
+  last_stream_token_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), last_stream_token);
   // @@protoc_insertion_point(field_set_allocated:firestore.client.MutationQueue.last_stream_token)
 }
 
@@ -417,11 +484,11 @@ inline void MutationQueue::set_allocated_last_stream_token(::std::string* last_s
 inline void WriteBatch::clear_batch_id() {
   batch_id_ = 0;
 }
-inline ::google::protobuf::int32 WriteBatch::batch_id() const {
+inline ::PROTOBUF_NAMESPACE_ID::int32 WriteBatch::batch_id() const {
   // @@protoc_insertion_point(field_get:firestore.client.WriteBatch.batch_id)
   return batch_id_;
 }
-inline void WriteBatch::set_batch_id(::google::protobuf::int32 value) {
+inline void WriteBatch::set_batch_id(::PROTOBUF_NAMESPACE_ID::int32 value) {
   
   batch_id_ = value;
   // @@protoc_insertion_point(field_set:firestore.client.WriteBatch.batch_id)
@@ -431,24 +498,24 @@ inline void WriteBatch::set_batch_id(::google::protobuf::int32 value) {
 inline int WriteBatch::writes_size() const {
   return writes_.size();
 }
-inline const ::google::firestore::v1::Write& WriteBatch::writes(int index) const {
-  // @@protoc_insertion_point(field_get:firestore.client.WriteBatch.writes)
-  return writes_.Get(index);
-}
 inline ::google::firestore::v1::Write* WriteBatch::mutable_writes(int index) {
   // @@protoc_insertion_point(field_mutable:firestore.client.WriteBatch.writes)
   return writes_.Mutable(index);
 }
-inline ::google::firestore::v1::Write* WriteBatch::add_writes() {
-  // @@protoc_insertion_point(field_add:firestore.client.WriteBatch.writes)
-  return writes_.Add();
-}
-inline ::google::protobuf::RepeatedPtrField< ::google::firestore::v1::Write >*
+inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::google::firestore::v1::Write >*
 WriteBatch::mutable_writes() {
   // @@protoc_insertion_point(field_mutable_list:firestore.client.WriteBatch.writes)
   return &writes_;
 }
-inline const ::google::protobuf::RepeatedPtrField< ::google::firestore::v1::Write >&
+inline const ::google::firestore::v1::Write& WriteBatch::writes(int index) const {
+  // @@protoc_insertion_point(field_get:firestore.client.WriteBatch.writes)
+  return writes_.Get(index);
+}
+inline ::google::firestore::v1::Write* WriteBatch::add_writes() {
+  // @@protoc_insertion_point(field_add:firestore.client.WriteBatch.writes)
+  return writes_.Add();
+}
+inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::google::firestore::v1::Write >&
 WriteBatch::writes() const {
   // @@protoc_insertion_point(field_list:firestore.client.WriteBatch.writes)
   return writes_;
@@ -456,39 +523,40 @@ WriteBatch::writes() const {
 
 // .google.protobuf.Timestamp local_write_time = 3;
 inline bool WriteBatch::has_local_write_time() const {
-  return this != internal_default_instance() && local_write_time_ != NULL;
+  return this != internal_default_instance() && local_write_time_ != nullptr;
 }
-inline const ::google::protobuf::Timestamp& WriteBatch::local_write_time() const {
-  const ::google::protobuf::Timestamp* p = local_write_time_;
+inline const PROTOBUF_NAMESPACE_ID::Timestamp& WriteBatch::local_write_time() const {
+  const PROTOBUF_NAMESPACE_ID::Timestamp* p = local_write_time_;
   // @@protoc_insertion_point(field_get:firestore.client.WriteBatch.local_write_time)
-  return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::Timestamp*>(
-      &::google::protobuf::_Timestamp_default_instance_);
+  return p != nullptr ? *p : *reinterpret_cast<const PROTOBUF_NAMESPACE_ID::Timestamp*>(
+      &PROTOBUF_NAMESPACE_ID::_Timestamp_default_instance_);
 }
-inline ::google::protobuf::Timestamp* WriteBatch::release_local_write_time() {
+inline PROTOBUF_NAMESPACE_ID::Timestamp* WriteBatch::release_local_write_time() {
   // @@protoc_insertion_point(field_release:firestore.client.WriteBatch.local_write_time)
   
-  ::google::protobuf::Timestamp* temp = local_write_time_;
-  local_write_time_ = NULL;
+  PROTOBUF_NAMESPACE_ID::Timestamp* temp = local_write_time_;
+  local_write_time_ = nullptr;
   return temp;
 }
-inline ::google::protobuf::Timestamp* WriteBatch::mutable_local_write_time() {
+inline PROTOBUF_NAMESPACE_ID::Timestamp* WriteBatch::mutable_local_write_time() {
   
-  if (local_write_time_ == NULL) {
-    local_write_time_ = new ::google::protobuf::Timestamp;
+  if (local_write_time_ == nullptr) {
+    auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Timestamp>(GetArenaNoVirtual());
+    local_write_time_ = p;
   }
   // @@protoc_insertion_point(field_mutable:firestore.client.WriteBatch.local_write_time)
   return local_write_time_;
 }
-inline void WriteBatch::set_allocated_local_write_time(::google::protobuf::Timestamp* local_write_time) {
-  ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
-  if (message_arena == NULL) {
-    delete reinterpret_cast< ::google::protobuf::MessageLite*>(local_write_time_);
+inline void WriteBatch::set_allocated_local_write_time(PROTOBUF_NAMESPACE_ID::Timestamp* local_write_time) {
+  ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual();
+  if (message_arena == nullptr) {
+    delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(local_write_time_);
   }
   if (local_write_time) {
-    ::google::protobuf::Arena* submessage_arena =
-      reinterpret_cast< ::google::protobuf::MessageLite*>(local_write_time)->GetArena();
+    ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
+      reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(local_write_time)->GetArena();
     if (message_arena != submessage_arena) {
-      local_write_time = ::google::protobuf::internal::GetOwnedMessage(
+      local_write_time = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
           message_arena, local_write_time, submessage_arena);
     }
     
@@ -503,24 +571,24 @@ inline void WriteBatch::set_allocated_local_write_time(::google::protobuf::Times
 inline int WriteBatch::base_writes_size() const {
   return base_writes_.size();
 }
-inline const ::google::firestore::v1::Write& WriteBatch::base_writes(int index) const {
-  // @@protoc_insertion_point(field_get:firestore.client.WriteBatch.base_writes)
-  return base_writes_.Get(index);
-}
 inline ::google::firestore::v1::Write* WriteBatch::mutable_base_writes(int index) {
   // @@protoc_insertion_point(field_mutable:firestore.client.WriteBatch.base_writes)
   return base_writes_.Mutable(index);
 }
-inline ::google::firestore::v1::Write* WriteBatch::add_base_writes() {
-  // @@protoc_insertion_point(field_add:firestore.client.WriteBatch.base_writes)
-  return base_writes_.Add();
-}
-inline ::google::protobuf::RepeatedPtrField< ::google::firestore::v1::Write >*
+inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::google::firestore::v1::Write >*
 WriteBatch::mutable_base_writes() {
   // @@protoc_insertion_point(field_mutable_list:firestore.client.WriteBatch.base_writes)
   return &base_writes_;
 }
-inline const ::google::protobuf::RepeatedPtrField< ::google::firestore::v1::Write >&
+inline const ::google::firestore::v1::Write& WriteBatch::base_writes(int index) const {
+  // @@protoc_insertion_point(field_get:firestore.client.WriteBatch.base_writes)
+  return base_writes_.Get(index);
+}
+inline ::google::firestore::v1::Write* WriteBatch::add_base_writes() {
+  // @@protoc_insertion_point(field_add:firestore.client.WriteBatch.base_writes)
+  return base_writes_.Add();
+}
+inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::google::firestore::v1::Write >&
 WriteBatch::base_writes() const {
   // @@protoc_insertion_point(field_list:firestore.client.WriteBatch.base_writes)
   return base_writes_;
@@ -539,4 +607,5 @@ WriteBatch::base_writes() const {
 
 // @@protoc_insertion_point(global_scope)
 
-#endif  // PROTOBUF_firestore_2flocal_2fmutation_2eproto__INCLUDED
+#include <google/protobuf/port_undef.inc>
+#endif  // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_firestore_2flocal_2fmutation_2eproto

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 359 - 304
Firestore/Protos/cpp/firestore/local/target.pb.cc


+ 286 - 214
Firestore/Protos/cpp/firestore/local/target.pb.h

@@ -17,30 +17,33 @@
 // Generated by the protocol buffer compiler.  DO NOT EDIT!
 // source: firestore/local/target.proto
 
-#ifndef PROTOBUF_firestore_2flocal_2ftarget_2eproto__INCLUDED
-#define PROTOBUF_firestore_2flocal_2ftarget_2eproto__INCLUDED
+#ifndef GOOGLE_PROTOBUF_INCLUDED_firestore_2flocal_2ftarget_2eproto
+#define GOOGLE_PROTOBUF_INCLUDED_firestore_2flocal_2ftarget_2eproto
 
+#include <limits>
 #include <string>
 
-#include <google/protobuf/stubs/common.h>
-
-#if GOOGLE_PROTOBUF_VERSION < 3005000
+#include <google/protobuf/port_def.inc>
+#if PROTOBUF_VERSION < 3009000
 #error This file was generated by a newer version of protoc which is
-#error incompatible with your Protocol Buffer headers.  Please update
+#error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
+#if 3009002 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
-#error incompatible with your Protocol Buffer headers.  Please
+#error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.
 #endif
 
+#include <google/protobuf/port_undef.inc>
 #include <google/protobuf/io/coded_stream.h>
 #include <google/protobuf/arena.h>
 #include <google/protobuf/arenastring.h>
 #include <google/protobuf/generated_message_table_driven.h>
 #include <google/protobuf/generated_message_util.h>
+#include <google/protobuf/inlined_string_field.h>
 #include <google/protobuf/metadata.h>
+#include <google/protobuf/generated_message_reflection.h>
 #include <google/protobuf/message.h>
 #include <google/protobuf/repeated_field.h>  // IWYU pragma: export
 #include <google/protobuf/extension_set.h>  // IWYU pragma: export
@@ -48,27 +51,27 @@
 #include "google/firestore/v1/firestore.pb.h"
 #include <google/protobuf/timestamp.pb.h>
 // @@protoc_insertion_point(includes)
+#include <google/protobuf/port_def.inc>
+#define PROTOBUF_INTERNAL_EXPORT_firestore_2flocal_2ftarget_2eproto
+PROTOBUF_NAMESPACE_OPEN
+namespace internal {
+class AnyMetadata;
+}  // namespace internal
+PROTOBUF_NAMESPACE_CLOSE
 
-namespace protobuf_firestore_2flocal_2ftarget_2eproto {
 // Internal implementation detail -- do not use these members.
-struct TableStruct {
-  static const ::google::protobuf::internal::ParseTableField entries[];
-  static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
-  static const ::google::protobuf::internal::ParseTable schema[2];
-  static const ::google::protobuf::internal::FieldMetadata field_metadata[];
-  static const ::google::protobuf::internal::SerializationTable serialization_table[];
-  static const ::google::protobuf::uint32 offsets[];
+struct TableStruct_firestore_2flocal_2ftarget_2eproto {
+  static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[]
+    PROTOBUF_SECTION_VARIABLE(protodesc_cold);
+  static const ::PROTOBUF_NAMESPACE_ID::internal::AuxillaryParseTableField aux[]
+    PROTOBUF_SECTION_VARIABLE(protodesc_cold);
+  static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[2]
+    PROTOBUF_SECTION_VARIABLE(protodesc_cold);
+  static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
+  static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
+  static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
 };
-void AddDescriptors();
-void InitDefaultsTargetImpl();
-void InitDefaultsTarget();
-void InitDefaultsTargetGlobalImpl();
-void InitDefaultsTargetGlobal();
-inline void InitDefaults() {
-  InitDefaultsTarget();
-  InitDefaultsTargetGlobal();
-}
-}  // namespace protobuf_firestore_2flocal_2ftarget_2eproto
+extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_firestore_2flocal_2ftarget_2eproto;
 namespace firestore {
 namespace client {
 class Target;
@@ -79,28 +82,31 @@ class TargetGlobalDefaultTypeInternal;
 extern TargetGlobalDefaultTypeInternal _TargetGlobal_default_instance_;
 }  // namespace client
 }  // namespace firestore
+PROTOBUF_NAMESPACE_OPEN
+template<> ::firestore::client::Target* Arena::CreateMaybeMessage<::firestore::client::Target>(Arena*);
+template<> ::firestore::client::TargetGlobal* Arena::CreateMaybeMessage<::firestore::client::TargetGlobal>(Arena*);
+PROTOBUF_NAMESPACE_CLOSE
 namespace firestore {
 namespace client {
 
 // ===================================================================
 
-class Target : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:firestore.client.Target) */ {
+class Target :
+    public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:firestore.client.Target) */ {
  public:
   Target();
   virtual ~Target();
 
   Target(const Target& from);
-
-  inline Target& operator=(const Target& from) {
-    CopyFrom(from);
-    return *this;
-  }
-  #if LANG_CXX11
   Target(Target&& from) noexcept
     : Target() {
     *this = ::std::move(from);
   }
 
+  inline Target& operator=(const Target& from) {
+    CopyFrom(from);
+    return *this;
+  }
   inline Target& operator=(Target&& from) noexcept {
     if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
       if (this != &from) InternalSwap(&from);
@@ -109,8 +115,16 @@ class Target : public ::google::protobuf::Message /* @@protoc_insertion_point(cl
     }
     return *this;
   }
-  #endif
-  static const ::google::protobuf::Descriptor* descriptor();
+
+  static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
+    return GetDescriptor();
+  }
+  static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
+    return GetMetadataStatic().descriptor;
+  }
+  static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
+    return GetMetadataStatic().reflection;
+  }
   static const Target& default_instance();
 
   enum TargetTypeCase {
@@ -124,93 +138,117 @@ class Target : public ::google::protobuf::Message /* @@protoc_insertion_point(cl
     return reinterpret_cast<const Target*>(
                &_Target_default_instance_);
   }
-  static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+  static constexpr int kIndexInFileMessages =
     0;
 
-  void Swap(Target* other);
   friend void swap(Target& a, Target& b) {
     a.Swap(&b);
   }
+  inline void Swap(Target* other) {
+    if (other == this) return;
+    InternalSwap(other);
+  }
 
   // implements Message ----------------------------------------------
 
-  inline Target* New() const PROTOBUF_FINAL { return New(NULL); }
+  inline Target* New() const final {
+    return CreateMaybeMessage<Target>(nullptr);
+  }
 
-  Target* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
-  void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
-  void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+  Target* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+    return CreateMaybeMessage<Target>(arena);
+  }
+  void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
+  void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
   void CopyFrom(const Target& from);
   void MergeFrom(const Target& from);
-  void Clear() PROTOBUF_FINAL;
-  bool IsInitialized() const PROTOBUF_FINAL;
+  PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
+  bool IsInitialized() const final;
 
-  size_t ByteSizeLong() const PROTOBUF_FINAL;
+  size_t ByteSizeLong() const final;
+  #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
+  const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
+  #else
   bool MergePartialFromCodedStream(
-      ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
+      ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final;
+  #endif  // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
   void SerializeWithCachedSizes(
-      ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
-  ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
-      bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
-  int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
+      ::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream* output) const final;
+  ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray(
+      ::PROTOBUF_NAMESPACE_ID::uint8* target) const final;
+  int GetCachedSize() const final { return _cached_size_.Get(); }
+
   private:
-  void SharedCtor();
-  void SharedDtor();
-  void SetCachedSize(int size) const PROTOBUF_FINAL;
+  inline void SharedCtor();
+  inline void SharedDtor();
+  void SetCachedSize(int size) const final;
   void InternalSwap(Target* other);
+  friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
+  static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
+    return "firestore.client.Target";
+  }
   private:
-  inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
-    return NULL;
+  inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const {
+    return nullptr;
   }
   inline void* MaybeArenaPtr() const {
-    return NULL;
+    return nullptr;
   }
   public:
 
-  ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
+  ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
+  private:
+  static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
+    ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_firestore_2flocal_2ftarget_2eproto);
+    return ::descriptor_table_firestore_2flocal_2ftarget_2eproto.file_level_metadata[kIndexInFileMessages];
+  }
+
+  public:
 
   // nested types ----------------------------------------------------
 
   // accessors -------------------------------------------------------
 
+  enum : int {
+    kResumeTokenFieldNumber = 3,
+    kSnapshotVersionFieldNumber = 2,
+    kLastListenSequenceNumberFieldNumber = 4,
+    kTargetIdFieldNumber = 1,
+    kQueryFieldNumber = 5,
+    kDocumentsFieldNumber = 6,
+  };
   // bytes resume_token = 3;
   void clear_resume_token();
-  static const int kResumeTokenFieldNumber = 3;
-  const ::std::string& resume_token() const;
-  void set_resume_token(const ::std::string& value);
-  #if LANG_CXX11
-  void set_resume_token(::std::string&& value);
-  #endif
+  const std::string& resume_token() const;
+  void set_resume_token(const std::string& value);
+  void set_resume_token(std::string&& value);
   void set_resume_token(const char* value);
   void set_resume_token(const void* value, size_t size);
-  ::std::string* mutable_resume_token();
-  ::std::string* release_resume_token();
-  void set_allocated_resume_token(::std::string* resume_token);
+  std::string* mutable_resume_token();
+  std::string* release_resume_token();
+  void set_allocated_resume_token(std::string* resume_token);
 
   // .google.protobuf.Timestamp snapshot_version = 2;
   bool has_snapshot_version() const;
   void clear_snapshot_version();
-  static const int kSnapshotVersionFieldNumber = 2;
-  const ::google::protobuf::Timestamp& snapshot_version() const;
-  ::google::protobuf::Timestamp* release_snapshot_version();
-  ::google::protobuf::Timestamp* mutable_snapshot_version();
-  void set_allocated_snapshot_version(::google::protobuf::Timestamp* snapshot_version);
+  const PROTOBUF_NAMESPACE_ID::Timestamp& snapshot_version() const;
+  PROTOBUF_NAMESPACE_ID::Timestamp* release_snapshot_version();
+  PROTOBUF_NAMESPACE_ID::Timestamp* mutable_snapshot_version();
+  void set_allocated_snapshot_version(PROTOBUF_NAMESPACE_ID::Timestamp* snapshot_version);
 
   // int64 last_listen_sequence_number = 4;
   void clear_last_listen_sequence_number();
-  static const int kLastListenSequenceNumberFieldNumber = 4;
-  ::google::protobuf::int64 last_listen_sequence_number() const;
-  void set_last_listen_sequence_number(::google::protobuf::int64 value);
+  ::PROTOBUF_NAMESPACE_ID::int64 last_listen_sequence_number() const;
+  void set_last_listen_sequence_number(::PROTOBUF_NAMESPACE_ID::int64 value);
 
   // int32 target_id = 1;
   void clear_target_id();
-  static const int kTargetIdFieldNumber = 1;
-  ::google::protobuf::int32 target_id() const;
-  void set_target_id(::google::protobuf::int32 value);
+  ::PROTOBUF_NAMESPACE_ID::int32 target_id() const;
+  void set_target_id(::PROTOBUF_NAMESPACE_ID::int32 value);
 
   // .google.firestore.v1.Target.QueryTarget query = 5;
   bool has_query() const;
   void clear_query();
-  static const int kQueryFieldNumber = 5;
   const ::google::firestore::v1::Target_QueryTarget& query() const;
   ::google::firestore::v1::Target_QueryTarget* release_query();
   ::google::firestore::v1::Target_QueryTarget* mutable_query();
@@ -219,57 +257,55 @@ class Target : public ::google::protobuf::Message /* @@protoc_insertion_point(cl
   // .google.firestore.v1.Target.DocumentsTarget documents = 6;
   bool has_documents() const;
   void clear_documents();
-  static const int kDocumentsFieldNumber = 6;
   const ::google::firestore::v1::Target_DocumentsTarget& documents() const;
   ::google::firestore::v1::Target_DocumentsTarget* release_documents();
   ::google::firestore::v1::Target_DocumentsTarget* mutable_documents();
   void set_allocated_documents(::google::firestore::v1::Target_DocumentsTarget* documents);
 
+  void clear_target_type();
   TargetTypeCase target_type_case() const;
   // @@protoc_insertion_point(class_scope:firestore.client.Target)
  private:
+  class _Internal;
   void set_has_query();
   void set_has_documents();
 
   inline bool has_target_type() const;
-  void clear_target_type();
   inline void clear_has_target_type();
 
-  ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
-  ::google::protobuf::internal::ArenaStringPtr resume_token_;
-  ::google::protobuf::Timestamp* snapshot_version_;
-  ::google::protobuf::int64 last_listen_sequence_number_;
-  ::google::protobuf::int32 target_id_;
+  ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
+  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr resume_token_;
+  PROTOBUF_NAMESPACE_ID::Timestamp* snapshot_version_;
+  ::PROTOBUF_NAMESPACE_ID::int64 last_listen_sequence_number_;
+  ::PROTOBUF_NAMESPACE_ID::int32 target_id_;
   union TargetTypeUnion {
     TargetTypeUnion() {}
     ::google::firestore::v1::Target_QueryTarget* query_;
     ::google::firestore::v1::Target_DocumentsTarget* documents_;
   } target_type_;
-  mutable int _cached_size_;
-  ::google::protobuf::uint32 _oneof_case_[1];
+  mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+  ::PROTOBUF_NAMESPACE_ID::uint32 _oneof_case_[1];
 
-  friend struct ::protobuf_firestore_2flocal_2ftarget_2eproto::TableStruct;
-  friend void ::protobuf_firestore_2flocal_2ftarget_2eproto::InitDefaultsTargetImpl();
+  friend struct ::TableStruct_firestore_2flocal_2ftarget_2eproto;
 };
 // -------------------------------------------------------------------
 
-class TargetGlobal : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:firestore.client.TargetGlobal) */ {
+class TargetGlobal :
+    public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:firestore.client.TargetGlobal) */ {
  public:
   TargetGlobal();
   virtual ~TargetGlobal();
 
   TargetGlobal(const TargetGlobal& from);
-
-  inline TargetGlobal& operator=(const TargetGlobal& from) {
-    CopyFrom(from);
-    return *this;
-  }
-  #if LANG_CXX11
   TargetGlobal(TargetGlobal&& from) noexcept
     : TargetGlobal() {
     *this = ::std::move(from);
   }
 
+  inline TargetGlobal& operator=(const TargetGlobal& from) {
+    CopyFrom(from);
+    return *this;
+  }
   inline TargetGlobal& operator=(TargetGlobal&& from) noexcept {
     if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
       if (this != &from) InternalSwap(&from);
@@ -278,8 +314,16 @@ class TargetGlobal : public ::google::protobuf::Message /* @@protoc_insertion_po
     }
     return *this;
   }
-  #endif
-  static const ::google::protobuf::Descriptor* descriptor();
+
+  static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
+    return GetDescriptor();
+  }
+  static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
+    return GetMetadataStatic().descriptor;
+  }
+  static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
+    return GetMetadataStatic().reflection;
+  }
   static const TargetGlobal& default_instance();
 
   static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
@@ -287,92 +331,117 @@ class TargetGlobal : public ::google::protobuf::Message /* @@protoc_insertion_po
     return reinterpret_cast<const TargetGlobal*>(
                &_TargetGlobal_default_instance_);
   }
-  static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+  static constexpr int kIndexInFileMessages =
     1;
 
-  void Swap(TargetGlobal* other);
   friend void swap(TargetGlobal& a, TargetGlobal& b) {
     a.Swap(&b);
   }
+  inline void Swap(TargetGlobal* other) {
+    if (other == this) return;
+    InternalSwap(other);
+  }
 
   // implements Message ----------------------------------------------
 
-  inline TargetGlobal* New() const PROTOBUF_FINAL { return New(NULL); }
+  inline TargetGlobal* New() const final {
+    return CreateMaybeMessage<TargetGlobal>(nullptr);
+  }
 
-  TargetGlobal* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
-  void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
-  void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+  TargetGlobal* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+    return CreateMaybeMessage<TargetGlobal>(arena);
+  }
+  void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
+  void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
   void CopyFrom(const TargetGlobal& from);
   void MergeFrom(const TargetGlobal& from);
-  void Clear() PROTOBUF_FINAL;
-  bool IsInitialized() const PROTOBUF_FINAL;
+  PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
+  bool IsInitialized() const final;
 
-  size_t ByteSizeLong() const PROTOBUF_FINAL;
+  size_t ByteSizeLong() const final;
+  #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
+  const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
+  #else
   bool MergePartialFromCodedStream(
-      ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
+      ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final;
+  #endif  // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
   void SerializeWithCachedSizes(
-      ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
-  ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
-      bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
-  int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
+      ::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream* output) const final;
+  ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray(
+      ::PROTOBUF_NAMESPACE_ID::uint8* target) const final;
+  int GetCachedSize() const final { return _cached_size_.Get(); }
+
   private:
-  void SharedCtor();
-  void SharedDtor();
-  void SetCachedSize(int size) const PROTOBUF_FINAL;
+  inline void SharedCtor();
+  inline void SharedDtor();
+  void SetCachedSize(int size) const final;
   void InternalSwap(TargetGlobal* other);
+  friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
+  static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
+    return "firestore.client.TargetGlobal";
+  }
   private:
-  inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
-    return NULL;
+  inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const {
+    return nullptr;
   }
   inline void* MaybeArenaPtr() const {
-    return NULL;
+    return nullptr;
   }
   public:
 
-  ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
+  ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
+  private:
+  static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
+    ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_firestore_2flocal_2ftarget_2eproto);
+    return ::descriptor_table_firestore_2flocal_2ftarget_2eproto.file_level_metadata[kIndexInFileMessages];
+  }
+
+  public:
 
   // nested types ----------------------------------------------------
 
   // accessors -------------------------------------------------------
 
+  enum : int {
+    kLastRemoteSnapshotVersionFieldNumber = 3,
+    kHighestListenSequenceNumberFieldNumber = 2,
+    kHighestTargetIdFieldNumber = 1,
+    kTargetCountFieldNumber = 4,
+  };
   // .google.protobuf.Timestamp last_remote_snapshot_version = 3;
   bool has_last_remote_snapshot_version() const;
   void clear_last_remote_snapshot_version();
-  static const int kLastRemoteSnapshotVersionFieldNumber = 3;
-  const ::google::protobuf::Timestamp& last_remote_snapshot_version() const;
-  ::google::protobuf::Timestamp* release_last_remote_snapshot_version();
-  ::google::protobuf::Timestamp* mutable_last_remote_snapshot_version();
-  void set_allocated_last_remote_snapshot_version(::google::protobuf::Timestamp* last_remote_snapshot_version);
+  const PROTOBUF_NAMESPACE_ID::Timestamp& last_remote_snapshot_version() const;
+  PROTOBUF_NAMESPACE_ID::Timestamp* release_last_remote_snapshot_version();
+  PROTOBUF_NAMESPACE_ID::Timestamp* mutable_last_remote_snapshot_version();
+  void set_allocated_last_remote_snapshot_version(PROTOBUF_NAMESPACE_ID::Timestamp* last_remote_snapshot_version);
 
   // int64 highest_listen_sequence_number = 2;
   void clear_highest_listen_sequence_number();
-  static const int kHighestListenSequenceNumberFieldNumber = 2;
-  ::google::protobuf::int64 highest_listen_sequence_number() const;
-  void set_highest_listen_sequence_number(::google::protobuf::int64 value);
+  ::PROTOBUF_NAMESPACE_ID::int64 highest_listen_sequence_number() const;
+  void set_highest_listen_sequence_number(::PROTOBUF_NAMESPACE_ID::int64 value);
 
   // int32 highest_target_id = 1;
   void clear_highest_target_id();
-  static const int kHighestTargetIdFieldNumber = 1;
-  ::google::protobuf::int32 highest_target_id() const;
-  void set_highest_target_id(::google::protobuf::int32 value);
+  ::PROTOBUF_NAMESPACE_ID::int32 highest_target_id() const;
+  void set_highest_target_id(::PROTOBUF_NAMESPACE_ID::int32 value);
 
   // int32 target_count = 4;
   void clear_target_count();
-  static const int kTargetCountFieldNumber = 4;
-  ::google::protobuf::int32 target_count() const;
-  void set_target_count(::google::protobuf::int32 value);
+  ::PROTOBUF_NAMESPACE_ID::int32 target_count() const;
+  void set_target_count(::PROTOBUF_NAMESPACE_ID::int32 value);
 
   // @@protoc_insertion_point(class_scope:firestore.client.TargetGlobal)
  private:
-
-  ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
-  ::google::protobuf::Timestamp* last_remote_snapshot_version_;
-  ::google::protobuf::int64 highest_listen_sequence_number_;
-  ::google::protobuf::int32 highest_target_id_;
-  ::google::protobuf::int32 target_count_;
-  mutable int _cached_size_;
-  friend struct ::protobuf_firestore_2flocal_2ftarget_2eproto::TableStruct;
-  friend void ::protobuf_firestore_2flocal_2ftarget_2eproto::InitDefaultsTargetGlobalImpl();
+  class _Internal;
+
+  ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
+  PROTOBUF_NAMESPACE_ID::Timestamp* last_remote_snapshot_version_;
+  ::PROTOBUF_NAMESPACE_ID::int64 highest_listen_sequence_number_;
+  ::PROTOBUF_NAMESPACE_ID::int32 highest_target_id_;
+  ::PROTOBUF_NAMESPACE_ID::int32 target_count_;
+  mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+  friend struct ::TableStruct_firestore_2flocal_2ftarget_2eproto;
 };
 // ===================================================================
 
@@ -389,11 +458,11 @@ class TargetGlobal : public ::google::protobuf::Message /* @@protoc_insertion_po
 inline void Target::clear_target_id() {
   target_id_ = 0;
 }
-inline ::google::protobuf::int32 Target::target_id() const {
+inline ::PROTOBUF_NAMESPACE_ID::int32 Target::target_id() const {
   // @@protoc_insertion_point(field_get:firestore.client.Target.target_id)
   return target_id_;
 }
-inline void Target::set_target_id(::google::protobuf::int32 value) {
+inline void Target::set_target_id(::PROTOBUF_NAMESPACE_ID::int32 value) {
   
   target_id_ = value;
   // @@protoc_insertion_point(field_set:firestore.client.Target.target_id)
@@ -401,39 +470,40 @@ inline void Target::set_target_id(::google::protobuf::int32 value) {
 
 // .google.protobuf.Timestamp snapshot_version = 2;
 inline bool Target::has_snapshot_version() const {
-  return this != internal_default_instance() && snapshot_version_ != NULL;
+  return this != internal_default_instance() && snapshot_version_ != nullptr;
 }
-inline const ::google::protobuf::Timestamp& Target::snapshot_version() const {
-  const ::google::protobuf::Timestamp* p = snapshot_version_;
+inline const PROTOBUF_NAMESPACE_ID::Timestamp& Target::snapshot_version() const {
+  const PROTOBUF_NAMESPACE_ID::Timestamp* p = snapshot_version_;
   // @@protoc_insertion_point(field_get:firestore.client.Target.snapshot_version)
-  return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::Timestamp*>(
-      &::google::protobuf::_Timestamp_default_instance_);
+  return p != nullptr ? *p : *reinterpret_cast<const PROTOBUF_NAMESPACE_ID::Timestamp*>(
+      &PROTOBUF_NAMESPACE_ID::_Timestamp_default_instance_);
 }
-inline ::google::protobuf::Timestamp* Target::release_snapshot_version() {
+inline PROTOBUF_NAMESPACE_ID::Timestamp* Target::release_snapshot_version() {
   // @@protoc_insertion_point(field_release:firestore.client.Target.snapshot_version)
   
-  ::google::protobuf::Timestamp* temp = snapshot_version_;
-  snapshot_version_ = NULL;
+  PROTOBUF_NAMESPACE_ID::Timestamp* temp = snapshot_version_;
+  snapshot_version_ = nullptr;
   return temp;
 }
-inline ::google::protobuf::Timestamp* Target::mutable_snapshot_version() {
+inline PROTOBUF_NAMESPACE_ID::Timestamp* Target::mutable_snapshot_version() {
   
-  if (snapshot_version_ == NULL) {
-    snapshot_version_ = new ::google::protobuf::Timestamp;
+  if (snapshot_version_ == nullptr) {
+    auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Timestamp>(GetArenaNoVirtual());
+    snapshot_version_ = p;
   }
   // @@protoc_insertion_point(field_mutable:firestore.client.Target.snapshot_version)
   return snapshot_version_;
 }
-inline void Target::set_allocated_snapshot_version(::google::protobuf::Timestamp* snapshot_version) {
-  ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
-  if (message_arena == NULL) {
-    delete reinterpret_cast< ::google::protobuf::MessageLite*>(snapshot_version_);
+inline void Target::set_allocated_snapshot_version(PROTOBUF_NAMESPACE_ID::Timestamp* snapshot_version) {
+  ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual();
+  if (message_arena == nullptr) {
+    delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(snapshot_version_);
   }
   if (snapshot_version) {
-    ::google::protobuf::Arena* submessage_arena =
-      reinterpret_cast< ::google::protobuf::MessageLite*>(snapshot_version)->GetArena();
+    ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
+      reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(snapshot_version)->GetArena();
     if (message_arena != submessage_arena) {
-      snapshot_version = ::google::protobuf::internal::GetOwnedMessage(
+      snapshot_version = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
           message_arena, snapshot_version, submessage_arena);
     }
     
@@ -446,66 +516,64 @@ inline void Target::set_allocated_snapshot_version(::google::protobuf::Timestamp
 
 // bytes resume_token = 3;
 inline void Target::clear_resume_token() {
-  resume_token_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  resume_token_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
 }
-inline const ::std::string& Target::resume_token() const {
+inline const std::string& Target::resume_token() const {
   // @@protoc_insertion_point(field_get:firestore.client.Target.resume_token)
   return resume_token_.GetNoArena();
 }
-inline void Target::set_resume_token(const ::std::string& value) {
+inline void Target::set_resume_token(const std::string& value) {
   
-  resume_token_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+  resume_token_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value);
   // @@protoc_insertion_point(field_set:firestore.client.Target.resume_token)
 }
-#if LANG_CXX11
-inline void Target::set_resume_token(::std::string&& value) {
+inline void Target::set_resume_token(std::string&& value) {
   
   resume_token_.SetNoArena(
-    &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+    &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
   // @@protoc_insertion_point(field_set_rvalue:firestore.client.Target.resume_token)
 }
-#endif
 inline void Target::set_resume_token(const char* value) {
-  GOOGLE_DCHECK(value != NULL);
+  GOOGLE_DCHECK(value != nullptr);
   
-  resume_token_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+  resume_token_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
   // @@protoc_insertion_point(field_set_char:firestore.client.Target.resume_token)
 }
 inline void Target::set_resume_token(const void* value, size_t size) {
   
-  resume_token_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+  resume_token_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
       ::std::string(reinterpret_cast<const char*>(value), size));
   // @@protoc_insertion_point(field_set_pointer:firestore.client.Target.resume_token)
 }
-inline ::std::string* Target::mutable_resume_token() {
+inline std::string* Target::mutable_resume_token() {
   
   // @@protoc_insertion_point(field_mutable:firestore.client.Target.resume_token)
-  return resume_token_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  return resume_token_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
 }
-inline ::std::string* Target::release_resume_token() {
+inline std::string* Target::release_resume_token() {
   // @@protoc_insertion_point(field_release:firestore.client.Target.resume_token)
   
-  return resume_token_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  return resume_token_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
 }
-inline void Target::set_allocated_resume_token(::std::string* resume_token) {
-  if (resume_token != NULL) {
+inline void Target::set_allocated_resume_token(std::string* resume_token) {
+  if (resume_token != nullptr) {
     
   } else {
     
   }
-  resume_token_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), resume_token);
+  resume_token_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), resume_token);
   // @@protoc_insertion_point(field_set_allocated:firestore.client.Target.resume_token)
 }
 
 // int64 last_listen_sequence_number = 4;
 inline void Target::clear_last_listen_sequence_number() {
-  last_listen_sequence_number_ = GOOGLE_LONGLONG(0);
+  last_listen_sequence_number_ = PROTOBUF_LONGLONG(0);
 }
-inline ::google::protobuf::int64 Target::last_listen_sequence_number() const {
+inline ::PROTOBUF_NAMESPACE_ID::int64 Target::last_listen_sequence_number() const {
   // @@protoc_insertion_point(field_get:firestore.client.Target.last_listen_sequence_number)
   return last_listen_sequence_number_;
 }
-inline void Target::set_last_listen_sequence_number(::google::protobuf::int64 value) {
+inline void Target::set_last_listen_sequence_number(::PROTOBUF_NAMESPACE_ID::int64 value) {
   
   last_listen_sequence_number_ = value;
   // @@protoc_insertion_point(field_set:firestore.client.Target.last_listen_sequence_number)
@@ -523,10 +591,10 @@ inline ::google::firestore::v1::Target_QueryTarget* Target::release_query() {
   if (has_query()) {
     clear_has_target_type();
       ::google::firestore::v1::Target_QueryTarget* temp = target_type_.query_;
-    target_type_.query_ = NULL;
+    target_type_.query_ = nullptr;
     return temp;
   } else {
-    return NULL;
+    return nullptr;
   }
 }
 inline const ::google::firestore::v1::Target_QueryTarget& Target::query() const {
@@ -539,7 +607,8 @@ inline ::google::firestore::v1::Target_QueryTarget* Target::mutable_query() {
   if (!has_query()) {
     clear_target_type();
     set_has_query();
-    target_type_.query_ = new ::google::firestore::v1::Target_QueryTarget;
+    target_type_.query_ = CreateMaybeMessage< ::google::firestore::v1::Target_QueryTarget >(
+        GetArenaNoVirtual());
   }
   // @@protoc_insertion_point(field_mutable:firestore.client.Target.query)
   return target_type_.query_;
@@ -557,10 +626,10 @@ inline ::google::firestore::v1::Target_DocumentsTarget* Target::release_document
   if (has_documents()) {
     clear_has_target_type();
       ::google::firestore::v1::Target_DocumentsTarget* temp = target_type_.documents_;
-    target_type_.documents_ = NULL;
+    target_type_.documents_ = nullptr;
     return temp;
   } else {
-    return NULL;
+    return nullptr;
   }
 }
 inline const ::google::firestore::v1::Target_DocumentsTarget& Target::documents() const {
@@ -573,7 +642,8 @@ inline ::google::firestore::v1::Target_DocumentsTarget* Target::mutable_document
   if (!has_documents()) {
     clear_target_type();
     set_has_documents();
-    target_type_.documents_ = new ::google::firestore::v1::Target_DocumentsTarget;
+    target_type_.documents_ = CreateMaybeMessage< ::google::firestore::v1::Target_DocumentsTarget >(
+        GetArenaNoVirtual());
   }
   // @@protoc_insertion_point(field_mutable:firestore.client.Target.documents)
   return target_type_.documents_;
@@ -596,11 +666,11 @@ inline Target::TargetTypeCase Target::target_type_case() const {
 inline void TargetGlobal::clear_highest_target_id() {
   highest_target_id_ = 0;
 }
-inline ::google::protobuf::int32 TargetGlobal::highest_target_id() const {
+inline ::PROTOBUF_NAMESPACE_ID::int32 TargetGlobal::highest_target_id() const {
   // @@protoc_insertion_point(field_get:firestore.client.TargetGlobal.highest_target_id)
   return highest_target_id_;
 }
-inline void TargetGlobal::set_highest_target_id(::google::protobuf::int32 value) {
+inline void TargetGlobal::set_highest_target_id(::PROTOBUF_NAMESPACE_ID::int32 value) {
   
   highest_target_id_ = value;
   // @@protoc_insertion_point(field_set:firestore.client.TargetGlobal.highest_target_id)
@@ -608,13 +678,13 @@ inline void TargetGlobal::set_highest_target_id(::google::protobuf::int32 value)
 
 // int64 highest_listen_sequence_number = 2;
 inline void TargetGlobal::clear_highest_listen_sequence_number() {
-  highest_listen_sequence_number_ = GOOGLE_LONGLONG(0);
+  highest_listen_sequence_number_ = PROTOBUF_LONGLONG(0);
 }
-inline ::google::protobuf::int64 TargetGlobal::highest_listen_sequence_number() const {
+inline ::PROTOBUF_NAMESPACE_ID::int64 TargetGlobal::highest_listen_sequence_number() const {
   // @@protoc_insertion_point(field_get:firestore.client.TargetGlobal.highest_listen_sequence_number)
   return highest_listen_sequence_number_;
 }
-inline void TargetGlobal::set_highest_listen_sequence_number(::google::protobuf::int64 value) {
+inline void TargetGlobal::set_highest_listen_sequence_number(::PROTOBUF_NAMESPACE_ID::int64 value) {
   
   highest_listen_sequence_number_ = value;
   // @@protoc_insertion_point(field_set:firestore.client.TargetGlobal.highest_listen_sequence_number)
@@ -622,39 +692,40 @@ inline void TargetGlobal::set_highest_listen_sequence_number(::google::protobuf:
 
 // .google.protobuf.Timestamp last_remote_snapshot_version = 3;
 inline bool TargetGlobal::has_last_remote_snapshot_version() const {
-  return this != internal_default_instance() && last_remote_snapshot_version_ != NULL;
+  return this != internal_default_instance() && last_remote_snapshot_version_ != nullptr;
 }
-inline const ::google::protobuf::Timestamp& TargetGlobal::last_remote_snapshot_version() const {
-  const ::google::protobuf::Timestamp* p = last_remote_snapshot_version_;
+inline const PROTOBUF_NAMESPACE_ID::Timestamp& TargetGlobal::last_remote_snapshot_version() const {
+  const PROTOBUF_NAMESPACE_ID::Timestamp* p = last_remote_snapshot_version_;
   // @@protoc_insertion_point(field_get:firestore.client.TargetGlobal.last_remote_snapshot_version)
-  return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::Timestamp*>(
-      &::google::protobuf::_Timestamp_default_instance_);
+  return p != nullptr ? *p : *reinterpret_cast<const PROTOBUF_NAMESPACE_ID::Timestamp*>(
+      &PROTOBUF_NAMESPACE_ID::_Timestamp_default_instance_);
 }
-inline ::google::protobuf::Timestamp* TargetGlobal::release_last_remote_snapshot_version() {
+inline PROTOBUF_NAMESPACE_ID::Timestamp* TargetGlobal::release_last_remote_snapshot_version() {
   // @@protoc_insertion_point(field_release:firestore.client.TargetGlobal.last_remote_snapshot_version)
   
-  ::google::protobuf::Timestamp* temp = last_remote_snapshot_version_;
-  last_remote_snapshot_version_ = NULL;
+  PROTOBUF_NAMESPACE_ID::Timestamp* temp = last_remote_snapshot_version_;
+  last_remote_snapshot_version_ = nullptr;
   return temp;
 }
-inline ::google::protobuf::Timestamp* TargetGlobal::mutable_last_remote_snapshot_version() {
+inline PROTOBUF_NAMESPACE_ID::Timestamp* TargetGlobal::mutable_last_remote_snapshot_version() {
   
-  if (last_remote_snapshot_version_ == NULL) {
-    last_remote_snapshot_version_ = new ::google::protobuf::Timestamp;
+  if (last_remote_snapshot_version_ == nullptr) {
+    auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Timestamp>(GetArenaNoVirtual());
+    last_remote_snapshot_version_ = p;
   }
   // @@protoc_insertion_point(field_mutable:firestore.client.TargetGlobal.last_remote_snapshot_version)
   return last_remote_snapshot_version_;
 }
-inline void TargetGlobal::set_allocated_last_remote_snapshot_version(::google::protobuf::Timestamp* last_remote_snapshot_version) {
-  ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
-  if (message_arena == NULL) {
-    delete reinterpret_cast< ::google::protobuf::MessageLite*>(last_remote_snapshot_version_);
+inline void TargetGlobal::set_allocated_last_remote_snapshot_version(PROTOBUF_NAMESPACE_ID::Timestamp* last_remote_snapshot_version) {
+  ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual();
+  if (message_arena == nullptr) {
+    delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(last_remote_snapshot_version_);
   }
   if (last_remote_snapshot_version) {
-    ::google::protobuf::Arena* submessage_arena =
-      reinterpret_cast< ::google::protobuf::MessageLite*>(last_remote_snapshot_version)->GetArena();
+    ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
+      reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(last_remote_snapshot_version)->GetArena();
     if (message_arena != submessage_arena) {
-      last_remote_snapshot_version = ::google::protobuf::internal::GetOwnedMessage(
+      last_remote_snapshot_version = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
           message_arena, last_remote_snapshot_version, submessage_arena);
     }
     
@@ -669,11 +740,11 @@ inline void TargetGlobal::set_allocated_last_remote_snapshot_version(::google::p
 inline void TargetGlobal::clear_target_count() {
   target_count_ = 0;
 }
-inline ::google::protobuf::int32 TargetGlobal::target_count() const {
+inline ::PROTOBUF_NAMESPACE_ID::int32 TargetGlobal::target_count() const {
   // @@protoc_insertion_point(field_get:firestore.client.TargetGlobal.target_count)
   return target_count_;
 }
-inline void TargetGlobal::set_target_count(::google::protobuf::int32 value) {
+inline void TargetGlobal::set_target_count(::PROTOBUF_NAMESPACE_ID::int32 value) {
   
   target_count_ = value;
   // @@protoc_insertion_point(field_set:firestore.client.TargetGlobal.target_count)
@@ -692,4 +763,5 @@ inline void TargetGlobal::set_target_count(::google::protobuf::int32 value) {
 
 // @@protoc_insertion_point(global_scope)
 
-#endif  // PROTOBUF_firestore_2flocal_2ftarget_2eproto__INCLUDED
+#include <google/protobuf/port_undef.inc>
+#endif  // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_firestore_2flocal_2ftarget_2eproto

+ 41 - 61
Firestore/Protos/cpp/google/api/annotations.pb.cc

@@ -22,85 +22,65 @@
 #include <algorithm>
 
 #include <google/protobuf/stubs/common.h>
-#include <google/protobuf/stubs/port.h>
-#include <google/protobuf/stubs/once.h>
 #include <google/protobuf/io/coded_stream.h>
-#include <google/protobuf/wire_format_lite_inl.h>
+#include <google/protobuf/extension_set.h>
+#include <google/protobuf/wire_format_lite.h>
 #include <google/protobuf/descriptor.h>
 #include <google/protobuf/generated_message_reflection.h>
 #include <google/protobuf/reflection_ops.h>
 #include <google/protobuf/wire_format.h>
-// This is a temporary google only hack
-#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
-#include "third_party/protobuf/version.h"
-#endif
 // @@protoc_insertion_point(includes)
+#include <google/protobuf/port_def.inc>
+extern PROTOBUF_INTERNAL_EXPORT_google_2fapi_2fhttp_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_HttpRule_google_2fapi_2fhttp_2eproto;
 namespace google {
 namespace api {
 }  // namespace api
 }  // namespace google
-namespace protobuf_google_2fapi_2fannotations_2eproto {
-const ::google::protobuf::uint32 TableStruct::offsets[1] = {};
-static const ::google::protobuf::internal::MigrationSchema* schemas = NULL;
-static const ::google::protobuf::Message* const* file_default_instances = NULL;
+static constexpr ::PROTOBUF_NAMESPACE_ID::Metadata* file_level_metadata_google_2fapi_2fannotations_2eproto = nullptr;
+static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fapi_2fannotations_2eproto = nullptr;
+static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fapi_2fannotations_2eproto = nullptr;
+const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fapi_2fannotations_2eproto::offsets[1] = {};
+static constexpr ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema* schemas = nullptr;
+static constexpr ::PROTOBUF_NAMESPACE_ID::Message* const* file_default_instances = nullptr;
 
-void protobuf_AssignDescriptors() {
-  AddDescriptors();
-  ::google::protobuf::MessageFactory* factory = NULL;
-  AssignDescriptors(
-      "google/api/annotations.proto", schemas, file_default_instances, TableStruct::offsets, factory,
-      NULL, NULL, NULL);
-}
+const char descriptor_table_protodef_google_2fapi_2fannotations_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
+  "\n\034google/api/annotations.proto\022\ngoogle.a"
+  "pi\032\025google/api/http.proto\032 google/protob"
+  "uf/descriptor.proto:E\n\004http\022\036.google.pro"
+  "tobuf.MethodOptions\030\260\312\274\" \001(\0132\024.google.ap"
+  "i.HttpRuleBn\n\016com.google.apiB\020Annotation"
+  "sProtoP\001ZAgoogle.golang.org/genproto/goo"
+  "gleapis/api/annotations;annotations\242\002\004GA"
+  "PIb\006proto3"
+  ;
+static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_google_2fapi_2fannotations_2eproto_deps[2] = {
+  &::descriptor_table_google_2fapi_2fhttp_2eproto,
+  &::descriptor_table_google_2fprotobuf_2fdescriptor_2eproto,
+};
+static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_google_2fapi_2fannotations_2eproto_sccs[1] = {
+};
+static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_google_2fapi_2fannotations_2eproto_once;
+static bool descriptor_table_google_2fapi_2fannotations_2eproto_initialized = false;
+const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fapi_2fannotations_2eproto = {
+  &descriptor_table_google_2fapi_2fannotations_2eproto_initialized, descriptor_table_protodef_google_2fapi_2fannotations_2eproto, "google/api/annotations.proto", 290,
+  &descriptor_table_google_2fapi_2fannotations_2eproto_once, descriptor_table_google_2fapi_2fannotations_2eproto_sccs, descriptor_table_google_2fapi_2fannotations_2eproto_deps, 0, 2,
+  schemas, file_default_instances, TableStruct_google_2fapi_2fannotations_2eproto::offsets,
+  file_level_metadata_google_2fapi_2fannotations_2eproto, 0, file_level_enum_descriptors_google_2fapi_2fannotations_2eproto, file_level_service_descriptors_google_2fapi_2fannotations_2eproto,
+};
 
-void protobuf_AssignDescriptorsOnce() {
-  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
-  ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors);
-}
-
-void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
-void protobuf_RegisterTypes(const ::std::string&) {
-  protobuf_AssignDescriptorsOnce();
-}
-
-void AddDescriptorsImpl() {
-  InitDefaults();
-  static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
-      "\n\034google/api/annotations.proto\022\ngoogle.a"
-      "pi\032\025google/api/http.proto\032 google/protob"
-      "uf/descriptor.proto:E\n\004http\022\036.google.pro"
-      "tobuf.MethodOptions\030\260\312\274\" \001(\0132\024.google.ap"
-      "i.HttpRuleBn\n\016com.google.apiB\020Annotation"
-      "sProtoP\001ZAgoogle.golang.org/genproto/goo"
-      "gleapis/api/annotations;annotations\242\002\004GA"
-      "PIb\006proto3"
-  };
-  ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
-      descriptor, 290);
-  ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
-    "google/api/annotations.proto", &protobuf_RegisterTypes);
-  ::protobuf_google_2fapi_2fhttp_2eproto::AddDescriptors();
-  ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::AddDescriptors();
-}
-
-void AddDescriptors() {
-  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
-  ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);
-}
-// Force AddDescriptors() to be called at dynamic initialization time.
-struct StaticDescriptorInitializer {
-  StaticDescriptorInitializer() {
-    AddDescriptors();
-  }
-} static_descriptor_initializer;
-}  // namespace protobuf_google_2fapi_2fannotations_2eproto
+// Force running AddDescriptors() at dynamic initialization time.
+static bool dynamic_init_dummy_google_2fapi_2fannotations_2eproto = (  ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_google_2fapi_2fannotations_2eproto), true);
 namespace google {
 namespace api {
-::google::protobuf::internal::ExtensionIdentifier< ::google::protobuf::MethodOptions,
-    ::google::protobuf::internal::MessageTypeTraits< ::google::api::HttpRule >, 11, false >
+::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< ::google::protobuf::MethodOptions,
+    ::PROTOBUF_NAMESPACE_ID::internal::MessageTypeTraits< ::google::api::HttpRule >, 11, false >
   http(kHttpFieldNumber, *::google::api::HttpRule::internal_default_instance());
 
 // @@protoc_insertion_point(namespace_scope)
 }  // namespace api
 }  // namespace google
+PROTOBUF_NAMESPACE_OPEN
+PROTOBUF_NAMESPACE_CLOSE
 
 // @@protoc_insertion_point(global_scope)
+#include <google/protobuf/port_undef.inc>

+ 35 - 27
Firestore/Protos/cpp/google/api/annotations.pb.h

@@ -17,54 +17,61 @@
 // Generated by the protocol buffer compiler.  DO NOT EDIT!
 // source: google/api/annotations.proto
 
-#ifndef PROTOBUF_google_2fapi_2fannotations_2eproto__INCLUDED
-#define PROTOBUF_google_2fapi_2fannotations_2eproto__INCLUDED
+#ifndef GOOGLE_PROTOBUF_INCLUDED_google_2fapi_2fannotations_2eproto
+#define GOOGLE_PROTOBUF_INCLUDED_google_2fapi_2fannotations_2eproto
 
+#include <limits>
 #include <string>
 
-#include <google/protobuf/stubs/common.h>
-
-#if GOOGLE_PROTOBUF_VERSION < 3005000
+#include <google/protobuf/port_def.inc>
+#if PROTOBUF_VERSION < 3009000
 #error This file was generated by a newer version of protoc which is
-#error incompatible with your Protocol Buffer headers.  Please update
+#error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
+#if 3009002 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
-#error incompatible with your Protocol Buffer headers.  Please
+#error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.
 #endif
 
+#include <google/protobuf/port_undef.inc>
 #include <google/protobuf/io/coded_stream.h>
 #include <google/protobuf/arena.h>
 #include <google/protobuf/arenastring.h>
 #include <google/protobuf/generated_message_table_driven.h>
 #include <google/protobuf/generated_message_util.h>
+#include <google/protobuf/inlined_string_field.h>
 #include <google/protobuf/metadata.h>
+#include <google/protobuf/generated_message_reflection.h>
 #include <google/protobuf/repeated_field.h>  // IWYU pragma: export
 #include <google/protobuf/extension_set.h>  // IWYU pragma: export
 #include "google/api/http.pb.h"
 #include <google/protobuf/descriptor.pb.h>
 // @@protoc_insertion_point(includes)
+#include <google/protobuf/port_def.inc>
+#define PROTOBUF_INTERNAL_EXPORT_google_2fapi_2fannotations_2eproto
+PROTOBUF_NAMESPACE_OPEN
+namespace internal {
+class AnyMetadata;
+}  // namespace internal
+PROTOBUF_NAMESPACE_CLOSE
 
-namespace protobuf_google_2fapi_2fannotations_2eproto {
 // Internal implementation detail -- do not use these members.
-struct TableStruct {
-  static const ::google::protobuf::internal::ParseTableField entries[];
-  static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
-  static const ::google::protobuf::internal::ParseTable schema[1];
-  static const ::google::protobuf::internal::FieldMetadata field_metadata[];
-  static const ::google::protobuf::internal::SerializationTable serialization_table[];
-  static const ::google::protobuf::uint32 offsets[];
+struct TableStruct_google_2fapi_2fannotations_2eproto {
+  static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[]
+    PROTOBUF_SECTION_VARIABLE(protodesc_cold);
+  static const ::PROTOBUF_NAMESPACE_ID::internal::AuxillaryParseTableField aux[]
+    PROTOBUF_SECTION_VARIABLE(protodesc_cold);
+  static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[1]
+    PROTOBUF_SECTION_VARIABLE(protodesc_cold);
+  static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
+  static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
+  static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
 };
-void AddDescriptors();
-inline void InitDefaults() {
-}
-}  // namespace protobuf_google_2fapi_2fannotations_2eproto
-namespace google {
-namespace api {
-}  // namespace api
-}  // namespace google
+extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fapi_2fannotations_2eproto;
+PROTOBUF_NAMESPACE_OPEN
+PROTOBUF_NAMESPACE_CLOSE
 namespace google {
 namespace api {
 
@@ -74,8 +81,8 @@ namespace api {
 // ===================================================================
 
 static const int kHttpFieldNumber = 72295728;
-extern ::google::protobuf::internal::ExtensionIdentifier< ::google::protobuf::MethodOptions,
-    ::google::protobuf::internal::MessageTypeTraits< ::google::api::HttpRule >, 11, false >
+extern ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< ::google::protobuf::MethodOptions,
+    ::PROTOBUF_NAMESPACE_ID::internal::MessageTypeTraits< ::google::api::HttpRule >, 11, false >
   http;
 
 // ===================================================================
@@ -95,4 +102,5 @@ extern ::google::protobuf::internal::ExtensionIdentifier< ::google::protobuf::Me
 
 // @@protoc_insertion_point(global_scope)
 
-#endif  // PROTOBUF_google_2fapi_2fannotations_2eproto__INCLUDED
+#include <google/protobuf/port_undef.inc>
+#endif  // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_google_2fapi_2fannotations_2eproto

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 360 - 313
Firestore/Protos/cpp/google/api/http.pb.cc


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 392 - 288
Firestore/Protos/cpp/google/api/http.pb.h


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 311 - 322
Firestore/Protos/cpp/google/firestore/v1/common.pb.cc


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 396 - 243
Firestore/Protos/cpp/google/firestore/v1/common.pb.h


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 327 - 347
Firestore/Protos/cpp/google/firestore/v1/document.pb.cc


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 429 - 279
Firestore/Protos/cpp/google/firestore/v1/document.pb.h


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 415 - 616
Firestore/Protos/cpp/google/firestore/v1/firestore.pb.cc


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 372 - 332
Firestore/Protos/cpp/google/firestore/v1/firestore.pb.h


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 356 - 415
Firestore/Protos/cpp/google/firestore/v1/query.pb.cc


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 426 - 280
Firestore/Protos/cpp/google/firestore/v1/query.pb.h


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 343 - 363
Firestore/Protos/cpp/google/firestore/v1/write.pb.cc


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 395 - 271
Firestore/Protos/cpp/google/firestore/v1/write.pb.h


+ 191 - 186
Firestore/Protos/cpp/google/rpc/status.pb.cc

@@ -22,119 +22,87 @@
 #include <algorithm>
 
 #include <google/protobuf/stubs/common.h>
-#include <google/protobuf/stubs/port.h>
-#include <google/protobuf/stubs/once.h>
 #include <google/protobuf/io/coded_stream.h>
-#include <google/protobuf/wire_format_lite_inl.h>
+#include <google/protobuf/extension_set.h>
+#include <google/protobuf/wire_format_lite.h>
 #include <google/protobuf/descriptor.h>
 #include <google/protobuf/generated_message_reflection.h>
 #include <google/protobuf/reflection_ops.h>
 #include <google/protobuf/wire_format.h>
-// This is a temporary google only hack
-#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
-#include "third_party/protobuf/version.h"
-#endif
 // @@protoc_insertion_point(includes)
+#include <google/protobuf/port_def.inc>
+extern PROTOBUF_INTERNAL_EXPORT_google_2fprotobuf_2fany_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Any_google_2fprotobuf_2fany_2eproto;
 namespace google {
 namespace rpc {
 class StatusDefaultTypeInternal {
  public:
-  ::google::protobuf::internal::ExplicitlyConstructed<Status>
-      _instance;
+  ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<Status> _instance;
 } _Status_default_instance_;
 }  // namespace rpc
 }  // namespace google
-namespace protobuf_google_2frpc_2fstatus_2eproto {
-void InitDefaultsStatusImpl() {
+static void InitDefaultsscc_info_Status_google_2frpc_2fstatus_2eproto() {
   GOOGLE_PROTOBUF_VERIFY_VERSION;
 
-#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
-  ::google::protobuf::internal::InitProtobufDefaultsForceUnique();
-#else
-  ::google::protobuf::internal::InitProtobufDefaults();
-#endif  // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
-  protobuf_google_2fprotobuf_2fany_2eproto::InitDefaultsAny();
   {
     void* ptr = &::google::rpc::_Status_default_instance_;
     new (ptr) ::google::rpc::Status();
-    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
+    ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
   }
   ::google::rpc::Status::InitAsDefaultInstance();
 }
 
-void InitDefaultsStatus() {
-  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
-  ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsStatusImpl);
-}
+::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_Status_google_2frpc_2fstatus_2eproto =
+    {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_Status_google_2frpc_2fstatus_2eproto}, {
+      &scc_info_Any_google_2fprotobuf_2fany_2eproto.base,}};
 
-::google::protobuf::Metadata file_level_metadata[1];
+static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2frpc_2fstatus_2eproto[1];
+static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2frpc_2fstatus_2eproto = nullptr;
+static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2frpc_2fstatus_2eproto = nullptr;
 
-const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2frpc_2fstatus_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
   ~0u,  // no _has_bits_
-  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::rpc::Status, _internal_metadata_),
+  PROTOBUF_FIELD_OFFSET(::google::rpc::Status, _internal_metadata_),
   ~0u,  // no _extensions_
   ~0u,  // no _oneof_case_
   ~0u,  // no _weak_field_map_
-  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::rpc::Status, code_),
-  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::rpc::Status, message_),
-  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::rpc::Status, details_),
+  PROTOBUF_FIELD_OFFSET(::google::rpc::Status, code_),
+  PROTOBUF_FIELD_OFFSET(::google::rpc::Status, message_),
+  PROTOBUF_FIELD_OFFSET(::google::rpc::Status, details_),
 };
-static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
   { 0, -1, sizeof(::google::rpc::Status)},
 };
 
-static ::google::protobuf::Message const * const file_default_instances[] = {
-  reinterpret_cast<const ::google::protobuf::Message*>(&::google::rpc::_Status_default_instance_),
+static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = {
+  reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::google::rpc::_Status_default_instance_),
 };
 
-void protobuf_AssignDescriptors() {
-  AddDescriptors();
-  ::google::protobuf::MessageFactory* factory = NULL;
-  AssignDescriptors(
-      "google/rpc/status.proto", schemas, file_default_instances, TableStruct::offsets, factory,
-      file_level_metadata, NULL, NULL);
-}
-
-void protobuf_AssignDescriptorsOnce() {
-  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
-  ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors);
-}
-
-void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
-void protobuf_RegisterTypes(const ::std::string&) {
-  protobuf_AssignDescriptorsOnce();
-  ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 1);
-}
-
-void AddDescriptorsImpl() {
-  InitDefaults();
-  static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
-      "\n\027google/rpc/status.proto\022\ngoogle.rpc\032\031g"
-      "oogle/protobuf/any.proto\"N\n\006Status\022\014\n\004co"
-      "de\030\001 \001(\005\022\017\n\007message\030\002 \001(\t\022%\n\007details\030\003 \003"
-      "(\0132\024.google.protobuf.AnyB^\n\016com.google.r"
-      "pcB\013StatusProtoP\001Z7google.golang.org/gen"
-      "proto/googleapis/rpc/status;status\242\002\003RPC"
-      "b\006proto3"
-  };
-  ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
-      descriptor, 248);
-  ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
-    "google/rpc/status.proto", &protobuf_RegisterTypes);
-  ::protobuf_google_2fprotobuf_2fany_2eproto::AddDescriptors();
-}
+const char descriptor_table_protodef_google_2frpc_2fstatus_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
+  "\n\027google/rpc/status.proto\022\ngoogle.rpc\032\031g"
+  "oogle/protobuf/any.proto\"N\n\006Status\022\014\n\004co"
+  "de\030\001 \001(\005\022\017\n\007message\030\002 \001(\t\022%\n\007details\030\003 \003"
+  "(\0132\024.google.protobuf.AnyB^\n\016com.google.r"
+  "pcB\013StatusProtoP\001Z7google.golang.org/gen"
+  "proto/googleapis/rpc/status;status\242\002\003RPC"
+  "b\006proto3"
+  ;
+static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_google_2frpc_2fstatus_2eproto_deps[1] = {
+  &::descriptor_table_google_2fprotobuf_2fany_2eproto,
+};
+static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_google_2frpc_2fstatus_2eproto_sccs[1] = {
+  &scc_info_Status_google_2frpc_2fstatus_2eproto.base,
+};
+static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_google_2frpc_2fstatus_2eproto_once;
+static bool descriptor_table_google_2frpc_2fstatus_2eproto_initialized = false;
+const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2frpc_2fstatus_2eproto = {
+  &descriptor_table_google_2frpc_2fstatus_2eproto_initialized, descriptor_table_protodef_google_2frpc_2fstatus_2eproto, "google/rpc/status.proto", 248,
+  &descriptor_table_google_2frpc_2fstatus_2eproto_once, descriptor_table_google_2frpc_2fstatus_2eproto_sccs, descriptor_table_google_2frpc_2fstatus_2eproto_deps, 1, 1,
+  schemas, file_default_instances, TableStruct_google_2frpc_2fstatus_2eproto::offsets,
+  file_level_metadata_google_2frpc_2fstatus_2eproto, 1, file_level_enum_descriptors_google_2frpc_2fstatus_2eproto, file_level_service_descriptors_google_2frpc_2fstatus_2eproto,
+};
 
-void AddDescriptors() {
-  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
-  ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);
-}
-// Force AddDescriptors() to be called at dynamic initialization time.
-struct StaticDescriptorInitializer {
-  StaticDescriptorInitializer() {
-    AddDescriptors();
-  }
-} static_descriptor_initializer;
-}  // namespace protobuf_google_2frpc_2fstatus_2eproto
+// Force running AddDescriptors() at dynamic initialization time.
+static bool dynamic_init_dummy_google_2frpc_2fstatus_2eproto = (  ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_google_2frpc_2fstatus_2eproto), true);
 namespace google {
 namespace rpc {
 
@@ -142,41 +110,35 @@ namespace rpc {
 
 void Status::InitAsDefaultInstance() {
 }
+class Status::_Internal {
+ public:
+};
+
 void Status::clear_details() {
   details_.Clear();
 }
-#if !defined(_MSC_VER) || _MSC_VER >= 1900
-const int Status::kCodeFieldNumber;
-const int Status::kMessageFieldNumber;
-const int Status::kDetailsFieldNumber;
-#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900
-
 Status::Status()
-  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
-  if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
-    ::protobuf_google_2frpc_2fstatus_2eproto::InitDefaultsStatus();
-  }
+  : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
   SharedCtor();
   // @@protoc_insertion_point(constructor:google.rpc.Status)
 }
 Status::Status(const Status& from)
-  : ::google::protobuf::Message(),
-      _internal_metadata_(NULL),
-      details_(from.details_),
-      _cached_size_(0) {
+  : ::PROTOBUF_NAMESPACE_ID::Message(),
+      _internal_metadata_(nullptr),
+      details_(from.details_) {
   _internal_metadata_.MergeFrom(from._internal_metadata_);
-  message_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  if (from.message().size() > 0) {
-    message_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.message_);
+  message_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  if (!from.message().empty()) {
+    message_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.message_);
   }
   code_ = from.code_;
   // @@protoc_insertion_point(copy_constructor:google.rpc.Status)
 }
 
 void Status::SharedCtor() {
-  message_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_Status_google_2frpc_2fstatus_2eproto.base);
+  message_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
   code_ = 0;
-  _cached_size_ = 0;
 }
 
 Status::~Status() {
@@ -185,61 +147,100 @@ Status::~Status() {
 }
 
 void Status::SharedDtor() {
-  message_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  message_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
 }
 
 void Status::SetCachedSize(int size) const {
-  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
-  _cached_size_ = size;
-  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  _cached_size_.Set(size);
 }
-const ::google::protobuf::Descriptor* Status::descriptor() {
-  ::protobuf_google_2frpc_2fstatus_2eproto::protobuf_AssignDescriptorsOnce();
-  return ::protobuf_google_2frpc_2fstatus_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
-}
-
 const Status& Status::default_instance() {
-  ::protobuf_google_2frpc_2fstatus_2eproto::InitDefaultsStatus();
+  ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_Status_google_2frpc_2fstatus_2eproto.base);
   return *internal_default_instance();
 }
 
-Status* Status::New(::google::protobuf::Arena* arena) const {
-  Status* n = new Status;
-  if (arena != NULL) {
-    arena->Own(n);
-  }
-  return n;
-}
 
 void Status::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.rpc.Status)
-  ::google::protobuf::uint32 cached_has_bits = 0;
+  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
   details_.Clear();
-  message_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  message_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
   code_ = 0;
   _internal_metadata_.Clear();
 }
 
+#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
+const char* Status::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
+#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
+  while (!ctx->Done(&ptr)) {
+    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
+    CHK_(ptr);
+    switch (tag >> 3) {
+      // int32 code = 1;
+      case 1:
+        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
+          code_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr);
+          CHK_(ptr);
+        } else goto handle_unusual;
+        continue;
+      // string message = 2;
+      case 2:
+        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+          ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(mutable_message(), ptr, ctx, "google.rpc.Status.message");
+          CHK_(ptr);
+        } else goto handle_unusual;
+        continue;
+      // repeated .google.protobuf.Any details = 3;
+      case 3:
+        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
+          ptr -= 1;
+          do {
+            ptr += 1;
+            ptr = ctx->ParseMessage(add_details(), ptr);
+            CHK_(ptr);
+            if (!ctx->DataAvailable(ptr)) break;
+          } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 26);
+        } else goto handle_unusual;
+        continue;
+      default: {
+      handle_unusual:
+        if ((tag & 7) == 4 || tag == 0) {
+          ctx->SetLastTag(tag);
+          goto success;
+        }
+        ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
+        CHK_(ptr != nullptr);
+        continue;
+      }
+    }  // switch
+  }  // while
+success:
+  return ptr;
+failure:
+  ptr = nullptr;
+  goto success;
+#undef CHK_
+}
+#else  // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
 bool Status::MergePartialFromCodedStream(
-    ::google::protobuf::io::CodedInputStream* input) {
-#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
-  ::google::protobuf::uint32 tag;
+    ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure
+  ::PROTOBUF_NAMESPACE_ID::uint32 tag;
   // @@protoc_insertion_point(parse_start:google.rpc.Status)
   for (;;) {
-    ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+    ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
     tag = p.first;
     if (!p.second) goto handle_unusual;
-    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+    switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) {
       // int32 code = 1;
       case 1: {
-        if (static_cast< ::google::protobuf::uint8>(tag) ==
-            static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) {
+        if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (8 & 0xFF)) {
 
-          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
-                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+          DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive<
+                   ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>(
                  input, &code_)));
         } else {
           goto handle_unusual;
@@ -249,13 +250,12 @@ bool Status::MergePartialFromCodedStream(
 
       // string message = 2;
       case 2: {
-        if (static_cast< ::google::protobuf::uint8>(tag) ==
-            static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
-          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+        if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) {
+          DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
                 input, this->mutable_message()));
-          DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
+          DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
             this->message().data(), static_cast<int>(this->message().length()),
-            ::google::protobuf::internal::WireFormatLite::PARSE,
+            ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE,
             "google.rpc.Status.message"));
         } else {
           goto handle_unusual;
@@ -265,9 +265,9 @@ bool Status::MergePartialFromCodedStream(
 
       // repeated .google.protobuf.Any details = 3;
       case 3: {
-        if (static_cast< ::google::protobuf::uint8>(tag) ==
-            static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
-          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_details()));
+        if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (26 & 0xFF)) {
+          DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage(
+                input, add_details()));
         } else {
           goto handle_unusual;
         }
@@ -279,7 +279,7 @@ bool Status::MergePartialFromCodedStream(
         if (tag == 0) {
           goto success;
         }
-        DO_(::google::protobuf::internal::WireFormat::SkipField(
+        DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField(
               input, tag, _internal_metadata_.mutable_unknown_fields()));
         break;
       }
@@ -293,76 +293,78 @@ failure:
   return false;
 #undef DO_
 }
+#endif  // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
 
 void Status::SerializeWithCachedSizes(
-    ::google::protobuf::io::CodedOutputStream* output) const {
+    ::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream* output) const {
   // @@protoc_insertion_point(serialize_start:google.rpc.Status)
-  ::google::protobuf::uint32 cached_has_bits = 0;
+  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
   (void) cached_has_bits;
 
   // int32 code = 1;
   if (this->code() != 0) {
-    ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->code(), output);
+    ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32(1, this->code(), output);
   }
 
   // string message = 2;
   if (this->message().size() > 0) {
-    ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
+    ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
       this->message().data(), static_cast<int>(this->message().length()),
-      ::google::protobuf::internal::WireFormatLite::SERIALIZE,
+      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
       "google.rpc.Status.message");
-    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
+    ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteStringMaybeAliased(
       2, this->message(), output);
   }
 
   // repeated .google.protobuf.Any details = 3;
   for (unsigned int i = 0,
       n = static_cast<unsigned int>(this->details_size()); i < n; i++) {
-    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      3, this->details(static_cast<int>(i)), output);
+    ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteMessageMaybeToArray(
+      3,
+      this->details(static_cast<int>(i)),
+      output);
   }
 
-  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
-    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
-        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()), output);
+  if (_internal_metadata_.have_unknown_fields()) {
+    ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFields(
+        _internal_metadata_.unknown_fields(), output);
   }
   // @@protoc_insertion_point(serialize_end:google.rpc.Status)
 }
 
-::google::protobuf::uint8* Status::InternalSerializeWithCachedSizesToArray(
-    bool deterministic, ::google::protobuf::uint8* target) const {
-  (void)deterministic; // Unused
+::PROTOBUF_NAMESPACE_ID::uint8* Status::InternalSerializeWithCachedSizesToArray(
+    ::PROTOBUF_NAMESPACE_ID::uint8* target) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.rpc.Status)
-  ::google::protobuf::uint32 cached_has_bits = 0;
+  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
   (void) cached_has_bits;
 
   // int32 code = 1;
   if (this->code() != 0) {
-    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->code(), target);
+    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->code(), target);
   }
 
   // string message = 2;
   if (this->message().size() > 0) {
-    ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
+    ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
       this->message().data(), static_cast<int>(this->message().length()),
-      ::google::protobuf::internal::WireFormatLite::SERIALIZE,
+      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
       "google.rpc.Status.message");
     target =
-      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
+      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteStringToArray(
         2, this->message(), target);
   }
 
   // repeated .google.protobuf.Any details = 3;
   for (unsigned int i = 0,
       n = static_cast<unsigned int>(this->details_size()); i < n; i++) {
-    target = ::google::protobuf::internal::WireFormatLite::
+    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
       InternalWriteMessageToArray(
-        3, this->details(static_cast<int>(i)), deterministic, target);
+        3, this->details(static_cast<int>(i)), target);
   }
 
-  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
-    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
-        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()), target);
+  if (_internal_metadata_.have_unknown_fields()) {
+    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFieldsToArray(
+        _internal_metadata_.unknown_fields(), target);
   }
   // @@protoc_insertion_point(serialize_to_array_end:google.rpc.Status)
   return target;
@@ -372,18 +374,22 @@ size_t Status::ByteSizeLong() const {
 // @@protoc_insertion_point(message_byte_size_start:google.rpc.Status)
   size_t total_size = 0;
 
-  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
+  if (_internal_metadata_.have_unknown_fields()) {
     total_size +=
-      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
-        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()));
+      ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::ComputeUnknownFieldsSize(
+        _internal_metadata_.unknown_fields());
   }
+  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  // Prevent compiler warnings about cached_has_bits being unused
+  (void) cached_has_bits;
+
   // repeated .google.protobuf.Any details = 3;
   {
     unsigned int count = static_cast<unsigned int>(this->details_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
-        ::google::protobuf::internal::WireFormatLite::MessageSize(
+        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
           this->details(static_cast<int>(i)));
     }
   }
@@ -391,33 +397,31 @@ size_t Status::ByteSizeLong() const {
   // string message = 2;
   if (this->message().size() > 0) {
     total_size += 1 +
-      ::google::protobuf::internal::WireFormatLite::StringSize(
+      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
         this->message());
   }
 
   // int32 code = 1;
   if (this->code() != 0) {
     total_size += 1 +
-      ::google::protobuf::internal::WireFormatLite::Int32Size(
+      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
         this->code());
   }
 
-  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
-  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
-  _cached_size_ = cached_size;
-  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
+  SetCachedSize(cached_size);
   return total_size;
 }
 
-void Status::MergeFrom(const ::google::protobuf::Message& from) {
+void Status::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
 // @@protoc_insertion_point(generalized_merge_from_start:google.rpc.Status)
   GOOGLE_DCHECK_NE(&from, this);
   const Status* source =
-      ::google::protobuf::internal::DynamicCastToGenerated<const Status>(
+      ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<Status>(
           &from);
-  if (source == NULL) {
+  if (source == nullptr) {
   // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.rpc.Status)
-    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+    ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
   } else {
   // @@protoc_insertion_point(generalized_merge_from_cast_success:google.rpc.Status)
     MergeFrom(*source);
@@ -428,20 +432,20 @@ void Status::MergeFrom(const Status& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.rpc.Status)
   GOOGLE_DCHECK_NE(&from, this);
   _internal_metadata_.MergeFrom(from._internal_metadata_);
-  ::google::protobuf::uint32 cached_has_bits = 0;
+  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
   (void) cached_has_bits;
 
   details_.MergeFrom(from.details_);
   if (from.message().size() > 0) {
 
-    message_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.message_);
+    message_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.message_);
   }
   if (from.code() != 0) {
     set_code(from.code());
   }
 }
 
-void Status::CopyFrom(const ::google::protobuf::Message& from) {
+void Status::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
 // @@protoc_insertion_point(generalized_copy_from_start:google.rpc.Status)
   if (&from == this) return;
   Clear();
@@ -459,27 +463,28 @@ bool Status::IsInitialized() const {
   return true;
 }
 
-void Status::Swap(Status* other) {
-  if (other == this) return;
-  InternalSwap(other);
-}
 void Status::InternalSwap(Status* other) {
   using std::swap;
-  details_.InternalSwap(&other->details_);
-  message_.Swap(&other->message_);
-  swap(code_, other->code_);
   _internal_metadata_.Swap(&other->_internal_metadata_);
-  swap(_cached_size_, other->_cached_size_);
+  CastToBase(&details_)->InternalSwap(CastToBase(&other->details_));
+  message_.Swap(&other->message_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+    GetArenaNoVirtual());
+  swap(code_, other->code_);
 }
 
-::google::protobuf::Metadata Status::GetMetadata() const {
-  protobuf_google_2frpc_2fstatus_2eproto::protobuf_AssignDescriptorsOnce();
-  return ::protobuf_google_2frpc_2fstatus_2eproto::file_level_metadata[kIndexInFileMessages];
+::PROTOBUF_NAMESPACE_ID::Metadata Status::GetMetadata() const {
+  return GetMetadataStatic();
 }
 
 
 // @@protoc_insertion_point(namespace_scope)
 }  // namespace rpc
 }  // namespace google
+PROTOBUF_NAMESPACE_OPEN
+template<> PROTOBUF_NOINLINE ::google::rpc::Status* Arena::CreateMaybeMessage< ::google::rpc::Status >(Arena* arena) {
+  return Arena::CreateInternal< ::google::rpc::Status >(arena);
+}
+PROTOBUF_NAMESPACE_CLOSE
 
 // @@protoc_insertion_point(global_scope)
+#include <google/protobuf/port_undef.inc>

+ 149 - 111
Firestore/Protos/cpp/google/rpc/status.pb.h

@@ -17,54 +17,60 @@
 // Generated by the protocol buffer compiler.  DO NOT EDIT!
 // source: google/rpc/status.proto
 
-#ifndef PROTOBUF_google_2frpc_2fstatus_2eproto__INCLUDED
-#define PROTOBUF_google_2frpc_2fstatus_2eproto__INCLUDED
+#ifndef GOOGLE_PROTOBUF_INCLUDED_google_2frpc_2fstatus_2eproto
+#define GOOGLE_PROTOBUF_INCLUDED_google_2frpc_2fstatus_2eproto
 
+#include <limits>
 #include <string>
 
-#include <google/protobuf/stubs/common.h>
-
-#if GOOGLE_PROTOBUF_VERSION < 3005000
+#include <google/protobuf/port_def.inc>
+#if PROTOBUF_VERSION < 3009000
 #error This file was generated by a newer version of protoc which is
-#error incompatible with your Protocol Buffer headers.  Please update
+#error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
+#if 3009002 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
-#error incompatible with your Protocol Buffer headers.  Please
+#error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.
 #endif
 
+#include <google/protobuf/port_undef.inc>
 #include <google/protobuf/io/coded_stream.h>
 #include <google/protobuf/arena.h>
 #include <google/protobuf/arenastring.h>
 #include <google/protobuf/generated_message_table_driven.h>
 #include <google/protobuf/generated_message_util.h>
+#include <google/protobuf/inlined_string_field.h>
 #include <google/protobuf/metadata.h>
+#include <google/protobuf/generated_message_reflection.h>
 #include <google/protobuf/message.h>
 #include <google/protobuf/repeated_field.h>  // IWYU pragma: export
 #include <google/protobuf/extension_set.h>  // IWYU pragma: export
 #include <google/protobuf/unknown_field_set.h>
 #include <google/protobuf/any.pb.h>
 // @@protoc_insertion_point(includes)
+#include <google/protobuf/port_def.inc>
+#define PROTOBUF_INTERNAL_EXPORT_google_2frpc_2fstatus_2eproto
+PROTOBUF_NAMESPACE_OPEN
+namespace internal {
+class AnyMetadata;
+}  // namespace internal
+PROTOBUF_NAMESPACE_CLOSE
 
-namespace protobuf_google_2frpc_2fstatus_2eproto {
 // Internal implementation detail -- do not use these members.
-struct TableStruct {
-  static const ::google::protobuf::internal::ParseTableField entries[];
-  static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
-  static const ::google::protobuf::internal::ParseTable schema[1];
-  static const ::google::protobuf::internal::FieldMetadata field_metadata[];
-  static const ::google::protobuf::internal::SerializationTable serialization_table[];
-  static const ::google::protobuf::uint32 offsets[];
+struct TableStruct_google_2frpc_2fstatus_2eproto {
+  static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[]
+    PROTOBUF_SECTION_VARIABLE(protodesc_cold);
+  static const ::PROTOBUF_NAMESPACE_ID::internal::AuxillaryParseTableField aux[]
+    PROTOBUF_SECTION_VARIABLE(protodesc_cold);
+  static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[1]
+    PROTOBUF_SECTION_VARIABLE(protodesc_cold);
+  static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
+  static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
+  static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
 };
-void AddDescriptors();
-void InitDefaultsStatusImpl();
-void InitDefaultsStatus();
-inline void InitDefaults() {
-  InitDefaultsStatus();
-}
-}  // namespace protobuf_google_2frpc_2fstatus_2eproto
+extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2frpc_2fstatus_2eproto;
 namespace google {
 namespace rpc {
 class Status;
@@ -72,28 +78,30 @@ class StatusDefaultTypeInternal;
 extern StatusDefaultTypeInternal _Status_default_instance_;
 }  // namespace rpc
 }  // namespace google
+PROTOBUF_NAMESPACE_OPEN
+template<> ::google::rpc::Status* Arena::CreateMaybeMessage<::google::rpc::Status>(Arena*);
+PROTOBUF_NAMESPACE_CLOSE
 namespace google {
 namespace rpc {
 
 // ===================================================================
 
-class Status : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.rpc.Status) */ {
+class Status :
+    public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.rpc.Status) */ {
  public:
   Status();
   virtual ~Status();
 
   Status(const Status& from);
-
-  inline Status& operator=(const Status& from) {
-    CopyFrom(from);
-    return *this;
-  }
-  #if LANG_CXX11
   Status(Status&& from) noexcept
     : Status() {
     *this = ::std::move(from);
   }
 
+  inline Status& operator=(const Status& from) {
+    CopyFrom(from);
+    return *this;
+  }
   inline Status& operator=(Status&& from) noexcept {
     if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
       if (this != &from) InternalSwap(&from);
@@ -102,8 +110,16 @@ class Status : public ::google::protobuf::Message /* @@protoc_insertion_point(cl
     }
     return *this;
   }
-  #endif
-  static const ::google::protobuf::Descriptor* descriptor();
+
+  static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
+    return GetDescriptor();
+  }
+  static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
+    return GetMetadataStatic().descriptor;
+  }
+  static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
+    return GetMetadataStatic().reflection;
+  }
   static const Status& default_instance();
 
   static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
@@ -111,96 +127,119 @@ class Status : public ::google::protobuf::Message /* @@protoc_insertion_point(cl
     return reinterpret_cast<const Status*>(
                &_Status_default_instance_);
   }
-  static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+  static constexpr int kIndexInFileMessages =
     0;
 
-  void Swap(Status* other);
   friend void swap(Status& a, Status& b) {
     a.Swap(&b);
   }
+  inline void Swap(Status* other) {
+    if (other == this) return;
+    InternalSwap(other);
+  }
 
   // implements Message ----------------------------------------------
 
-  inline Status* New() const PROTOBUF_FINAL { return New(NULL); }
+  inline Status* New() const final {
+    return CreateMaybeMessage<Status>(nullptr);
+  }
 
-  Status* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
-  void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
-  void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+  Status* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+    return CreateMaybeMessage<Status>(arena);
+  }
+  void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
+  void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
   void CopyFrom(const Status& from);
   void MergeFrom(const Status& from);
-  void Clear() PROTOBUF_FINAL;
-  bool IsInitialized() const PROTOBUF_FINAL;
+  PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
+  bool IsInitialized() const final;
 
-  size_t ByteSizeLong() const PROTOBUF_FINAL;
+  size_t ByteSizeLong() const final;
+  #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
+  const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
+  #else
   bool MergePartialFromCodedStream(
-      ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
+      ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final;
+  #endif  // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
   void SerializeWithCachedSizes(
-      ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
-  ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
-      bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
-  int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
+      ::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream* output) const final;
+  ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray(
+      ::PROTOBUF_NAMESPACE_ID::uint8* target) const final;
+  int GetCachedSize() const final { return _cached_size_.Get(); }
+
   private:
-  void SharedCtor();
-  void SharedDtor();
-  void SetCachedSize(int size) const PROTOBUF_FINAL;
+  inline void SharedCtor();
+  inline void SharedDtor();
+  void SetCachedSize(int size) const final;
   void InternalSwap(Status* other);
+  friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
+  static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
+    return "google.rpc.Status";
+  }
   private:
-  inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
-    return NULL;
+  inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const {
+    return nullptr;
   }
   inline void* MaybeArenaPtr() const {
-    return NULL;
+    return nullptr;
   }
   public:
 
-  ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
+  ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
+  private:
+  static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
+    ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_google_2frpc_2fstatus_2eproto);
+    return ::descriptor_table_google_2frpc_2fstatus_2eproto.file_level_metadata[kIndexInFileMessages];
+  }
+
+  public:
 
   // nested types ----------------------------------------------------
 
   // accessors -------------------------------------------------------
 
+  enum : int {
+    kDetailsFieldNumber = 3,
+    kMessageFieldNumber = 2,
+    kCodeFieldNumber = 1,
+  };
   // repeated .google.protobuf.Any details = 3;
   int details_size() const;
   void clear_details();
-  static const int kDetailsFieldNumber = 3;
-  const ::google::protobuf::Any& details(int index) const;
-  ::google::protobuf::Any* mutable_details(int index);
-  ::google::protobuf::Any* add_details();
-  ::google::protobuf::RepeatedPtrField< ::google::protobuf::Any >*
+  PROTOBUF_NAMESPACE_ID::Any* mutable_details(int index);
+  ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Any >*
       mutable_details();
-  const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Any >&
+  const PROTOBUF_NAMESPACE_ID::Any& details(int index) const;
+  PROTOBUF_NAMESPACE_ID::Any* add_details();
+  const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Any >&
       details() const;
 
   // string message = 2;
   void clear_message();
-  static const int kMessageFieldNumber = 2;
-  const ::std::string& message() const;
-  void set_message(const ::std::string& value);
-  #if LANG_CXX11
-  void set_message(::std::string&& value);
-  #endif
+  const std::string& message() const;
+  void set_message(const std::string& value);
+  void set_message(std::string&& value);
   void set_message(const char* value);
   void set_message(const char* value, size_t size);
-  ::std::string* mutable_message();
-  ::std::string* release_message();
-  void set_allocated_message(::std::string* message);
+  std::string* mutable_message();
+  std::string* release_message();
+  void set_allocated_message(std::string* message);
 
   // int32 code = 1;
   void clear_code();
-  static const int kCodeFieldNumber = 1;
-  ::google::protobuf::int32 code() const;
-  void set_code(::google::protobuf::int32 value);
+  ::PROTOBUF_NAMESPACE_ID::int32 code() const;
+  void set_code(::PROTOBUF_NAMESPACE_ID::int32 value);
 
   // @@protoc_insertion_point(class_scope:google.rpc.Status)
  private:
-
-  ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
-  ::google::protobuf::RepeatedPtrField< ::google::protobuf::Any > details_;
-  ::google::protobuf::internal::ArenaStringPtr message_;
-  ::google::protobuf::int32 code_;
-  mutable int _cached_size_;
-  friend struct ::protobuf_google_2frpc_2fstatus_2eproto::TableStruct;
-  friend void ::protobuf_google_2frpc_2fstatus_2eproto::InitDefaultsStatusImpl();
+  class _Internal;
+
+  ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
+  ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Any > details_;
+  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr message_;
+  ::PROTOBUF_NAMESPACE_ID::int32 code_;
+  mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+  friend struct ::TableStruct_google_2frpc_2fstatus_2eproto;
 };
 // ===================================================================
 
@@ -217,11 +256,11 @@ class Status : public ::google::protobuf::Message /* @@protoc_insertion_point(cl
 inline void Status::clear_code() {
   code_ = 0;
 }
-inline ::google::protobuf::int32 Status::code() const {
+inline ::PROTOBUF_NAMESPACE_ID::int32 Status::code() const {
   // @@protoc_insertion_point(field_get:google.rpc.Status.code)
   return code_;
 }
-inline void Status::set_code(::google::protobuf::int32 value) {
+inline void Status::set_code(::PROTOBUF_NAMESPACE_ID::int32 value) {
   
   code_ = value;
   // @@protoc_insertion_point(field_set:google.rpc.Status.code)
@@ -229,54 +268,52 @@ inline void Status::set_code(::google::protobuf::int32 value) {
 
 // string message = 2;
 inline void Status::clear_message() {
-  message_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  message_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
 }
-inline const ::std::string& Status::message() const {
+inline const std::string& Status::message() const {
   // @@protoc_insertion_point(field_get:google.rpc.Status.message)
   return message_.GetNoArena();
 }
-inline void Status::set_message(const ::std::string& value) {
+inline void Status::set_message(const std::string& value) {
   
-  message_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+  message_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value);
   // @@protoc_insertion_point(field_set:google.rpc.Status.message)
 }
-#if LANG_CXX11
-inline void Status::set_message(::std::string&& value) {
+inline void Status::set_message(std::string&& value) {
   
   message_.SetNoArena(
-    &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+    &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
   // @@protoc_insertion_point(field_set_rvalue:google.rpc.Status.message)
 }
-#endif
 inline void Status::set_message(const char* value) {
-  GOOGLE_DCHECK(value != NULL);
+  GOOGLE_DCHECK(value != nullptr);
   
-  message_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+  message_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
   // @@protoc_insertion_point(field_set_char:google.rpc.Status.message)
 }
 inline void Status::set_message(const char* value, size_t size) {
   
-  message_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+  message_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
       ::std::string(reinterpret_cast<const char*>(value), size));
   // @@protoc_insertion_point(field_set_pointer:google.rpc.Status.message)
 }
-inline ::std::string* Status::mutable_message() {
+inline std::string* Status::mutable_message() {
   
   // @@protoc_insertion_point(field_mutable:google.rpc.Status.message)
-  return message_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  return message_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
 }
-inline ::std::string* Status::release_message() {
+inline std::string* Status::release_message() {
   // @@protoc_insertion_point(field_release:google.rpc.Status.message)
   
-  return message_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  return message_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
 }
-inline void Status::set_allocated_message(::std::string* message) {
-  if (message != NULL) {
+inline void Status::set_allocated_message(std::string* message) {
+  if (message != nullptr) {
     
   } else {
     
   }
-  message_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), message);
+  message_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), message);
   // @@protoc_insertion_point(field_set_allocated:google.rpc.Status.message)
 }
 
@@ -284,24 +321,24 @@ inline void Status::set_allocated_message(::std::string* message) {
 inline int Status::details_size() const {
   return details_.size();
 }
-inline const ::google::protobuf::Any& Status::details(int index) const {
-  // @@protoc_insertion_point(field_get:google.rpc.Status.details)
-  return details_.Get(index);
-}
-inline ::google::protobuf::Any* Status::mutable_details(int index) {
+inline PROTOBUF_NAMESPACE_ID::Any* Status::mutable_details(int index) {
   // @@protoc_insertion_point(field_mutable:google.rpc.Status.details)
   return details_.Mutable(index);
 }
-inline ::google::protobuf::Any* Status::add_details() {
-  // @@protoc_insertion_point(field_add:google.rpc.Status.details)
-  return details_.Add();
-}
-inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::Any >*
+inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Any >*
 Status::mutable_details() {
   // @@protoc_insertion_point(field_mutable_list:google.rpc.Status.details)
   return &details_;
 }
-inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Any >&
+inline const PROTOBUF_NAMESPACE_ID::Any& Status::details(int index) const {
+  // @@protoc_insertion_point(field_get:google.rpc.Status.details)
+  return details_.Get(index);
+}
+inline PROTOBUF_NAMESPACE_ID::Any* Status::add_details() {
+  // @@protoc_insertion_point(field_add:google.rpc.Status.details)
+  return details_.Add();
+}
+inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Any >&
 Status::details() const {
   // @@protoc_insertion_point(field_list:google.rpc.Status.details)
   return details_;
@@ -318,4 +355,5 @@ Status::details() const {
 
 // @@protoc_insertion_point(global_scope)
 
-#endif  // PROTOBUF_google_2frpc_2fstatus_2eproto__INCLUDED
+#include <google/protobuf/port_undef.inc>
+#endif  // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_google_2frpc_2fstatus_2eproto

+ 151 - 162
Firestore/Protos/cpp/google/type/latlng.pb.cc

@@ -22,114 +22,81 @@
 #include <algorithm>
 
 #include <google/protobuf/stubs/common.h>
-#include <google/protobuf/stubs/port.h>
-#include <google/protobuf/stubs/once.h>
 #include <google/protobuf/io/coded_stream.h>
-#include <google/protobuf/wire_format_lite_inl.h>
+#include <google/protobuf/extension_set.h>
+#include <google/protobuf/wire_format_lite.h>
 #include <google/protobuf/descriptor.h>
 #include <google/protobuf/generated_message_reflection.h>
 #include <google/protobuf/reflection_ops.h>
 #include <google/protobuf/wire_format.h>
-// This is a temporary google only hack
-#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
-#include "third_party/protobuf/version.h"
-#endif
 // @@protoc_insertion_point(includes)
+#include <google/protobuf/port_def.inc>
 namespace google {
 namespace type {
 class LatLngDefaultTypeInternal {
  public:
-  ::google::protobuf::internal::ExplicitlyConstructed<LatLng>
-      _instance;
+  ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<LatLng> _instance;
 } _LatLng_default_instance_;
 }  // namespace type
 }  // namespace google
-namespace protobuf_google_2ftype_2flatlng_2eproto {
-void InitDefaultsLatLngImpl() {
+static void InitDefaultsscc_info_LatLng_google_2ftype_2flatlng_2eproto() {
   GOOGLE_PROTOBUF_VERIFY_VERSION;
 
-#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
-  ::google::protobuf::internal::InitProtobufDefaultsForceUnique();
-#else
-  ::google::protobuf::internal::InitProtobufDefaults();
-#endif  // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
   {
     void* ptr = &::google::type::_LatLng_default_instance_;
     new (ptr) ::google::type::LatLng();
-    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
+    ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
   }
   ::google::type::LatLng::InitAsDefaultInstance();
 }
 
-void InitDefaultsLatLng() {
-  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
-  ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsLatLngImpl);
-}
+::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_LatLng_google_2ftype_2flatlng_2eproto =
+    {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_LatLng_google_2ftype_2flatlng_2eproto}, {}};
 
-::google::protobuf::Metadata file_level_metadata[1];
+static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2ftype_2flatlng_2eproto[1];
+static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2ftype_2flatlng_2eproto = nullptr;
+static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2ftype_2flatlng_2eproto = nullptr;
 
-const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2ftype_2flatlng_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
   ~0u,  // no _has_bits_
-  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::type::LatLng, _internal_metadata_),
+  PROTOBUF_FIELD_OFFSET(::google::type::LatLng, _internal_metadata_),
   ~0u,  // no _extensions_
   ~0u,  // no _oneof_case_
   ~0u,  // no _weak_field_map_
-  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::type::LatLng, latitude_),
-  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::type::LatLng, longitude_),
+  PROTOBUF_FIELD_OFFSET(::google::type::LatLng, latitude_),
+  PROTOBUF_FIELD_OFFSET(::google::type::LatLng, longitude_),
 };
-static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
   { 0, -1, sizeof(::google::type::LatLng)},
 };
 
-static ::google::protobuf::Message const * const file_default_instances[] = {
-  reinterpret_cast<const ::google::protobuf::Message*>(&::google::type::_LatLng_default_instance_),
+static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = {
+  reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::google::type::_LatLng_default_instance_),
 };
 
-void protobuf_AssignDescriptors() {
-  AddDescriptors();
-  ::google::protobuf::MessageFactory* factory = NULL;
-  AssignDescriptors(
-      "google/type/latlng.proto", schemas, file_default_instances, TableStruct::offsets, factory,
-      file_level_metadata, NULL, NULL);
-}
-
-void protobuf_AssignDescriptorsOnce() {
-  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
-  ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors);
-}
-
-void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
-void protobuf_RegisterTypes(const ::std::string&) {
-  protobuf_AssignDescriptorsOnce();
-  ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 1);
-}
-
-void AddDescriptorsImpl() {
-  InitDefaults();
-  static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
-      "\n\030google/type/latlng.proto\022\013google.type\""
-      "-\n\006LatLng\022\020\n\010latitude\030\001 \001(\001\022\021\n\tlongitude"
-      "\030\002 \001(\001B`\n\017com.google.typeB\013LatLngProtoP\001"
-      "Z8google.golang.org/genproto/googleapis/"
-      "type/latlng;latlng\242\002\003GTPb\006proto3"
-  };
-  ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
-      descriptor, 192);
-  ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
-    "google/type/latlng.proto", &protobuf_RegisterTypes);
-}
+const char descriptor_table_protodef_google_2ftype_2flatlng_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
+  "\n\030google/type/latlng.proto\022\013google.type\""
+  "-\n\006LatLng\022\020\n\010latitude\030\001 \001(\001\022\021\n\tlongitude"
+  "\030\002 \001(\001B`\n\017com.google.typeB\013LatLngProtoP\001"
+  "Z8google.golang.org/genproto/googleapis/"
+  "type/latlng;latlng\242\002\003GTPb\006proto3"
+  ;
+static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_google_2ftype_2flatlng_2eproto_deps[1] = {
+};
+static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_google_2ftype_2flatlng_2eproto_sccs[1] = {
+  &scc_info_LatLng_google_2ftype_2flatlng_2eproto.base,
+};
+static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_google_2ftype_2flatlng_2eproto_once;
+static bool descriptor_table_google_2ftype_2flatlng_2eproto_initialized = false;
+const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2ftype_2flatlng_2eproto = {
+  &descriptor_table_google_2ftype_2flatlng_2eproto_initialized, descriptor_table_protodef_google_2ftype_2flatlng_2eproto, "google/type/latlng.proto", 192,
+  &descriptor_table_google_2ftype_2flatlng_2eproto_once, descriptor_table_google_2ftype_2flatlng_2eproto_sccs, descriptor_table_google_2ftype_2flatlng_2eproto_deps, 1, 0,
+  schemas, file_default_instances, TableStruct_google_2ftype_2flatlng_2eproto::offsets,
+  file_level_metadata_google_2ftype_2flatlng_2eproto, 1, file_level_enum_descriptors_google_2ftype_2flatlng_2eproto, file_level_service_descriptors_google_2ftype_2flatlng_2eproto,
+};
 
-void AddDescriptors() {
-  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
-  ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);
-}
-// Force AddDescriptors() to be called at dynamic initialization time.
-struct StaticDescriptorInitializer {
-  StaticDescriptorInitializer() {
-    AddDescriptors();
-  }
-} static_descriptor_initializer;
-}  // namespace protobuf_google_2ftype_2flatlng_2eproto
+// Force running AddDescriptors() at dynamic initialization time.
+static bool dynamic_init_dummy_google_2ftype_2flatlng_2eproto = (  ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_google_2ftype_2flatlng_2eproto), true);
 namespace google {
 namespace type {
 
@@ -137,23 +104,18 @@ namespace type {
 
 void LatLng::InitAsDefaultInstance() {
 }
-#if !defined(_MSC_VER) || _MSC_VER >= 1900
-const int LatLng::kLatitudeFieldNumber;
-const int LatLng::kLongitudeFieldNumber;
-#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900
+class LatLng::_Internal {
+ public:
+};
 
 LatLng::LatLng()
-  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
-  if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
-    ::protobuf_google_2ftype_2flatlng_2eproto::InitDefaultsLatLng();
-  }
+  : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
   SharedCtor();
   // @@protoc_insertion_point(constructor:google.type.LatLng)
 }
 LatLng::LatLng(const LatLng& from)
-  : ::google::protobuf::Message(),
-      _internal_metadata_(NULL),
-      _cached_size_(0) {
+  : ::PROTOBUF_NAMESPACE_ID::Message(),
+      _internal_metadata_(nullptr) {
   _internal_metadata_.MergeFrom(from._internal_metadata_);
   ::memcpy(&latitude_, &from.latitude_,
     static_cast<size_t>(reinterpret_cast<char*>(&longitude_) -
@@ -165,7 +127,6 @@ void LatLng::SharedCtor() {
   ::memset(&latitude_, 0, static_cast<size_t>(
       reinterpret_cast<char*>(&longitude_) -
       reinterpret_cast<char*>(&latitude_)) + sizeof(longitude_));
-  _cached_size_ = 0;
 }
 
 LatLng::~LatLng() {
@@ -177,31 +138,17 @@ void LatLng::SharedDtor() {
 }
 
 void LatLng::SetCachedSize(int size) const {
-  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
-  _cached_size_ = size;
-  GOOGLE_SAFE_CONCURRENT_WRITES_END();
-}
-const ::google::protobuf::Descriptor* LatLng::descriptor() {
-  ::protobuf_google_2ftype_2flatlng_2eproto::protobuf_AssignDescriptorsOnce();
-  return ::protobuf_google_2ftype_2flatlng_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+  _cached_size_.Set(size);
 }
-
 const LatLng& LatLng::default_instance() {
-  ::protobuf_google_2ftype_2flatlng_2eproto::InitDefaultsLatLng();
+  ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_LatLng_google_2ftype_2flatlng_2eproto.base);
   return *internal_default_instance();
 }
 
-LatLng* LatLng::New(::google::protobuf::Arena* arena) const {
-  LatLng* n = new LatLng;
-  if (arena != NULL) {
-    arena->Own(n);
-  }
-  return n;
-}
 
 void LatLng::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.type.LatLng)
-  ::google::protobuf::uint32 cached_has_bits = 0;
+  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -211,23 +158,64 @@ void LatLng::Clear() {
   _internal_metadata_.Clear();
 }
 
+#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
+const char* LatLng::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
+#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
+  while (!ctx->Done(&ptr)) {
+    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
+    CHK_(ptr);
+    switch (tag >> 3) {
+      // double latitude = 1;
+      case 1:
+        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 9)) {
+          latitude_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<double>(ptr);
+          ptr += sizeof(double);
+        } else goto handle_unusual;
+        continue;
+      // double longitude = 2;
+      case 2:
+        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 17)) {
+          longitude_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<double>(ptr);
+          ptr += sizeof(double);
+        } else goto handle_unusual;
+        continue;
+      default: {
+      handle_unusual:
+        if ((tag & 7) == 4 || tag == 0) {
+          ctx->SetLastTag(tag);
+          goto success;
+        }
+        ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
+        CHK_(ptr != nullptr);
+        continue;
+      }
+    }  // switch
+  }  // while
+success:
+  return ptr;
+failure:
+  ptr = nullptr;
+  goto success;
+#undef CHK_
+}
+#else  // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
 bool LatLng::MergePartialFromCodedStream(
-    ::google::protobuf::io::CodedInputStream* input) {
-#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
-  ::google::protobuf::uint32 tag;
+    ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure
+  ::PROTOBUF_NAMESPACE_ID::uint32 tag;
   // @@protoc_insertion_point(parse_start:google.type.LatLng)
   for (;;) {
-    ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+    ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
     tag = p.first;
     if (!p.second) goto handle_unusual;
-    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+    switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) {
       // double latitude = 1;
       case 1: {
-        if (static_cast< ::google::protobuf::uint8>(tag) ==
-            static_cast< ::google::protobuf::uint8>(9u /* 9 & 0xFF */)) {
+        if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (9 & 0xFF)) {
 
-          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
-                   double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>(
+          DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive<
+                   double, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_DOUBLE>(
                  input, &latitude_)));
         } else {
           goto handle_unusual;
@@ -237,11 +225,10 @@ bool LatLng::MergePartialFromCodedStream(
 
       // double longitude = 2;
       case 2: {
-        if (static_cast< ::google::protobuf::uint8>(tag) ==
-            static_cast< ::google::protobuf::uint8>(17u /* 17 & 0xFF */)) {
+        if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (17 & 0xFF)) {
 
-          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
-                   double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>(
+          DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive<
+                   double, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_DOUBLE>(
                  input, &longitude_)));
         } else {
           goto handle_unusual;
@@ -254,7 +241,7 @@ bool LatLng::MergePartialFromCodedStream(
         if (tag == 0) {
           goto success;
         }
-        DO_(::google::protobuf::internal::WireFormat::SkipField(
+        DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField(
               input, tag, _internal_metadata_.mutable_unknown_fields()));
         break;
       }
@@ -268,50 +255,50 @@ failure:
   return false;
 #undef DO_
 }
+#endif  // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
 
 void LatLng::SerializeWithCachedSizes(
-    ::google::protobuf::io::CodedOutputStream* output) const {
+    ::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream* output) const {
   // @@protoc_insertion_point(serialize_start:google.type.LatLng)
-  ::google::protobuf::uint32 cached_has_bits = 0;
+  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
   (void) cached_has_bits;
 
   // double latitude = 1;
-  if (this->latitude() != 0) {
-    ::google::protobuf::internal::WireFormatLite::WriteDouble(1, this->latitude(), output);
+  if (!(this->latitude() <= 0 && this->latitude() >= 0)) {
+    ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteDouble(1, this->latitude(), output);
   }
 
   // double longitude = 2;
-  if (this->longitude() != 0) {
-    ::google::protobuf::internal::WireFormatLite::WriteDouble(2, this->longitude(), output);
+  if (!(this->longitude() <= 0 && this->longitude() >= 0)) {
+    ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteDouble(2, this->longitude(), output);
   }
 
-  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
-    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
-        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()), output);
+  if (_internal_metadata_.have_unknown_fields()) {
+    ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFields(
+        _internal_metadata_.unknown_fields(), output);
   }
   // @@protoc_insertion_point(serialize_end:google.type.LatLng)
 }
 
-::google::protobuf::uint8* LatLng::InternalSerializeWithCachedSizesToArray(
-    bool deterministic, ::google::protobuf::uint8* target) const {
-  (void)deterministic; // Unused
+::PROTOBUF_NAMESPACE_ID::uint8* LatLng::InternalSerializeWithCachedSizesToArray(
+    ::PROTOBUF_NAMESPACE_ID::uint8* target) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.type.LatLng)
-  ::google::protobuf::uint32 cached_has_bits = 0;
+  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
   (void) cached_has_bits;
 
   // double latitude = 1;
-  if (this->latitude() != 0) {
-    target = ::google::protobuf::internal::WireFormatLite::WriteDoubleToArray(1, this->latitude(), target);
+  if (!(this->latitude() <= 0 && this->latitude() >= 0)) {
+    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteDoubleToArray(1, this->latitude(), target);
   }
 
   // double longitude = 2;
-  if (this->longitude() != 0) {
-    target = ::google::protobuf::internal::WireFormatLite::WriteDoubleToArray(2, this->longitude(), target);
+  if (!(this->longitude() <= 0 && this->longitude() >= 0)) {
+    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteDoubleToArray(2, this->longitude(), target);
   }
 
-  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
-    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
-        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()), target);
+  if (_internal_metadata_.have_unknown_fields()) {
+    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFieldsToArray(
+        _internal_metadata_.unknown_fields(), target);
   }
   // @@protoc_insertion_point(serialize_to_array_end:google.type.LatLng)
   return target;
@@ -321,37 +308,39 @@ size_t LatLng::ByteSizeLong() const {
 // @@protoc_insertion_point(message_byte_size_start:google.type.LatLng)
   size_t total_size = 0;
 
-  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
+  if (_internal_metadata_.have_unknown_fields()) {
     total_size +=
-      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
-        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()));
+      ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::ComputeUnknownFieldsSize(
+        _internal_metadata_.unknown_fields());
   }
+  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  // Prevent compiler warnings about cached_has_bits being unused
+  (void) cached_has_bits;
+
   // double latitude = 1;
-  if (this->latitude() != 0) {
+  if (!(this->latitude() <= 0 && this->latitude() >= 0)) {
     total_size += 1 + 8;
   }
 
   // double longitude = 2;
-  if (this->longitude() != 0) {
+  if (!(this->longitude() <= 0 && this->longitude() >= 0)) {
     total_size += 1 + 8;
   }
 
-  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
-  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
-  _cached_size_ = cached_size;
-  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
+  SetCachedSize(cached_size);
   return total_size;
 }
 
-void LatLng::MergeFrom(const ::google::protobuf::Message& from) {
+void LatLng::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
 // @@protoc_insertion_point(generalized_merge_from_start:google.type.LatLng)
   GOOGLE_DCHECK_NE(&from, this);
   const LatLng* source =
-      ::google::protobuf::internal::DynamicCastToGenerated<const LatLng>(
+      ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<LatLng>(
           &from);
-  if (source == NULL) {
+  if (source == nullptr) {
   // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.type.LatLng)
-    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+    ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
   } else {
   // @@protoc_insertion_point(generalized_merge_from_cast_success:google.type.LatLng)
     MergeFrom(*source);
@@ -362,18 +351,18 @@ void LatLng::MergeFrom(const LatLng& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.type.LatLng)
   GOOGLE_DCHECK_NE(&from, this);
   _internal_metadata_.MergeFrom(from._internal_metadata_);
-  ::google::protobuf::uint32 cached_has_bits = 0;
+  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
   (void) cached_has_bits;
 
-  if (from.latitude() != 0) {
+  if (!(from.latitude() <= 0 && from.latitude() >= 0)) {
     set_latitude(from.latitude());
   }
-  if (from.longitude() != 0) {
+  if (!(from.longitude() <= 0 && from.longitude() >= 0)) {
     set_longitude(from.longitude());
   }
 }
 
-void LatLng::CopyFrom(const ::google::protobuf::Message& from) {
+void LatLng::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
 // @@protoc_insertion_point(generalized_copy_from_start:google.type.LatLng)
   if (&from == this) return;
   Clear();
@@ -391,26 +380,26 @@ bool LatLng::IsInitialized() const {
   return true;
 }
 
-void LatLng::Swap(LatLng* other) {
-  if (other == this) return;
-  InternalSwap(other);
-}
 void LatLng::InternalSwap(LatLng* other) {
   using std::swap;
+  _internal_metadata_.Swap(&other->_internal_metadata_);
   swap(latitude_, other->latitude_);
   swap(longitude_, other->longitude_);
-  _internal_metadata_.Swap(&other->_internal_metadata_);
-  swap(_cached_size_, other->_cached_size_);
 }
 
-::google::protobuf::Metadata LatLng::GetMetadata() const {
-  protobuf_google_2ftype_2flatlng_2eproto::protobuf_AssignDescriptorsOnce();
-  return ::protobuf_google_2ftype_2flatlng_2eproto::file_level_metadata[kIndexInFileMessages];
+::PROTOBUF_NAMESPACE_ID::Metadata LatLng::GetMetadata() const {
+  return GetMetadataStatic();
 }
 
 
 // @@protoc_insertion_point(namespace_scope)
 }  // namespace type
 }  // namespace google
+PROTOBUF_NAMESPACE_OPEN
+template<> PROTOBUF_NOINLINE ::google::type::LatLng* Arena::CreateMaybeMessage< ::google::type::LatLng >(Arena* arena) {
+  return Arena::CreateInternal< ::google::type::LatLng >(arena);
+}
+PROTOBUF_NAMESPACE_CLOSE
 
 // @@protoc_insertion_point(global_scope)
+#include <google/protobuf/port_undef.inc>

+ 102 - 60
Firestore/Protos/cpp/google/type/latlng.pb.h

@@ -17,53 +17,59 @@
 // Generated by the protocol buffer compiler.  DO NOT EDIT!
 // source: google/type/latlng.proto
 
-#ifndef PROTOBUF_google_2ftype_2flatlng_2eproto__INCLUDED
-#define PROTOBUF_google_2ftype_2flatlng_2eproto__INCLUDED
+#ifndef GOOGLE_PROTOBUF_INCLUDED_google_2ftype_2flatlng_2eproto
+#define GOOGLE_PROTOBUF_INCLUDED_google_2ftype_2flatlng_2eproto
 
+#include <limits>
 #include <string>
 
-#include <google/protobuf/stubs/common.h>
-
-#if GOOGLE_PROTOBUF_VERSION < 3005000
+#include <google/protobuf/port_def.inc>
+#if PROTOBUF_VERSION < 3009000
 #error This file was generated by a newer version of protoc which is
-#error incompatible with your Protocol Buffer headers.  Please update
+#error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
+#if 3009002 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
-#error incompatible with your Protocol Buffer headers.  Please
+#error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.
 #endif
 
+#include <google/protobuf/port_undef.inc>
 #include <google/protobuf/io/coded_stream.h>
 #include <google/protobuf/arena.h>
 #include <google/protobuf/arenastring.h>
 #include <google/protobuf/generated_message_table_driven.h>
 #include <google/protobuf/generated_message_util.h>
+#include <google/protobuf/inlined_string_field.h>
 #include <google/protobuf/metadata.h>
+#include <google/protobuf/generated_message_reflection.h>
 #include <google/protobuf/message.h>
 #include <google/protobuf/repeated_field.h>  // IWYU pragma: export
 #include <google/protobuf/extension_set.h>  // IWYU pragma: export
 #include <google/protobuf/unknown_field_set.h>
 // @@protoc_insertion_point(includes)
+#include <google/protobuf/port_def.inc>
+#define PROTOBUF_INTERNAL_EXPORT_google_2ftype_2flatlng_2eproto
+PROTOBUF_NAMESPACE_OPEN
+namespace internal {
+class AnyMetadata;
+}  // namespace internal
+PROTOBUF_NAMESPACE_CLOSE
 
-namespace protobuf_google_2ftype_2flatlng_2eproto {
 // Internal implementation detail -- do not use these members.
-struct TableStruct {
-  static const ::google::protobuf::internal::ParseTableField entries[];
-  static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
-  static const ::google::protobuf::internal::ParseTable schema[1];
-  static const ::google::protobuf::internal::FieldMetadata field_metadata[];
-  static const ::google::protobuf::internal::SerializationTable serialization_table[];
-  static const ::google::protobuf::uint32 offsets[];
+struct TableStruct_google_2ftype_2flatlng_2eproto {
+  static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[]
+    PROTOBUF_SECTION_VARIABLE(protodesc_cold);
+  static const ::PROTOBUF_NAMESPACE_ID::internal::AuxillaryParseTableField aux[]
+    PROTOBUF_SECTION_VARIABLE(protodesc_cold);
+  static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[1]
+    PROTOBUF_SECTION_VARIABLE(protodesc_cold);
+  static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
+  static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
+  static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
 };
-void AddDescriptors();
-void InitDefaultsLatLngImpl();
-void InitDefaultsLatLng();
-inline void InitDefaults() {
-  InitDefaultsLatLng();
-}
-}  // namespace protobuf_google_2ftype_2flatlng_2eproto
+extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2ftype_2flatlng_2eproto;
 namespace google {
 namespace type {
 class LatLng;
@@ -71,28 +77,30 @@ class LatLngDefaultTypeInternal;
 extern LatLngDefaultTypeInternal _LatLng_default_instance_;
 }  // namespace type
 }  // namespace google
+PROTOBUF_NAMESPACE_OPEN
+template<> ::google::type::LatLng* Arena::CreateMaybeMessage<::google::type::LatLng>(Arena*);
+PROTOBUF_NAMESPACE_CLOSE
 namespace google {
 namespace type {
 
 // ===================================================================
 
-class LatLng : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.type.LatLng) */ {
+class LatLng :
+    public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.type.LatLng) */ {
  public:
   LatLng();
   virtual ~LatLng();
 
   LatLng(const LatLng& from);
-
-  inline LatLng& operator=(const LatLng& from) {
-    CopyFrom(from);
-    return *this;
-  }
-  #if LANG_CXX11
   LatLng(LatLng&& from) noexcept
     : LatLng() {
     *this = ::std::move(from);
   }
 
+  inline LatLng& operator=(const LatLng& from) {
+    CopyFrom(from);
+    return *this;
+  }
   inline LatLng& operator=(LatLng&& from) noexcept {
     if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
       if (this != &from) InternalSwap(&from);
@@ -101,8 +109,16 @@ class LatLng : public ::google::protobuf::Message /* @@protoc_insertion_point(cl
     }
     return *this;
   }
-  #endif
-  static const ::google::protobuf::Descriptor* descriptor();
+
+  static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
+    return GetDescriptor();
+  }
+  static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
+    return GetMetadataStatic().descriptor;
+  }
+  static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
+    return GetMetadataStatic().reflection;
+  }
   static const LatLng& default_instance();
 
   static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
@@ -110,75 +126,100 @@ class LatLng : public ::google::protobuf::Message /* @@protoc_insertion_point(cl
     return reinterpret_cast<const LatLng*>(
                &_LatLng_default_instance_);
   }
-  static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+  static constexpr int kIndexInFileMessages =
     0;
 
-  void Swap(LatLng* other);
   friend void swap(LatLng& a, LatLng& b) {
     a.Swap(&b);
   }
+  inline void Swap(LatLng* other) {
+    if (other == this) return;
+    InternalSwap(other);
+  }
 
   // implements Message ----------------------------------------------
 
-  inline LatLng* New() const PROTOBUF_FINAL { return New(NULL); }
+  inline LatLng* New() const final {
+    return CreateMaybeMessage<LatLng>(nullptr);
+  }
 
-  LatLng* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
-  void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
-  void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+  LatLng* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+    return CreateMaybeMessage<LatLng>(arena);
+  }
+  void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
+  void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
   void CopyFrom(const LatLng& from);
   void MergeFrom(const LatLng& from);
-  void Clear() PROTOBUF_FINAL;
-  bool IsInitialized() const PROTOBUF_FINAL;
+  PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
+  bool IsInitialized() const final;
 
-  size_t ByteSizeLong() const PROTOBUF_FINAL;
+  size_t ByteSizeLong() const final;
+  #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
+  const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
+  #else
   bool MergePartialFromCodedStream(
-      ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
+      ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final;
+  #endif  // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
   void SerializeWithCachedSizes(
-      ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
-  ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
-      bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
-  int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
+      ::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream* output) const final;
+  ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray(
+      ::PROTOBUF_NAMESPACE_ID::uint8* target) const final;
+  int GetCachedSize() const final { return _cached_size_.Get(); }
+
   private:
-  void SharedCtor();
-  void SharedDtor();
-  void SetCachedSize(int size) const PROTOBUF_FINAL;
+  inline void SharedCtor();
+  inline void SharedDtor();
+  void SetCachedSize(int size) const final;
   void InternalSwap(LatLng* other);
+  friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
+  static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
+    return "google.type.LatLng";
+  }
   private:
-  inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
-    return NULL;
+  inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const {
+    return nullptr;
   }
   inline void* MaybeArenaPtr() const {
-    return NULL;
+    return nullptr;
   }
   public:
 
-  ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
+  ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
+  private:
+  static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
+    ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_google_2ftype_2flatlng_2eproto);
+    return ::descriptor_table_google_2ftype_2flatlng_2eproto.file_level_metadata[kIndexInFileMessages];
+  }
+
+  public:
 
   // nested types ----------------------------------------------------
 
   // accessors -------------------------------------------------------
 
+  enum : int {
+    kLatitudeFieldNumber = 1,
+    kLongitudeFieldNumber = 2,
+  };
   // double latitude = 1;
   void clear_latitude();
-  static const int kLatitudeFieldNumber = 1;
   double latitude() const;
   void set_latitude(double value);
 
   // double longitude = 2;
   void clear_longitude();
-  static const int kLongitudeFieldNumber = 2;
   double longitude() const;
   void set_longitude(double value);
 
   // @@protoc_insertion_point(class_scope:google.type.LatLng)
  private:
+  class _Internal;
 
-  ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
+  ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
   double latitude_;
   double longitude_;
-  mutable int _cached_size_;
-  friend struct ::protobuf_google_2ftype_2flatlng_2eproto::TableStruct;
-  friend void ::protobuf_google_2ftype_2flatlng_2eproto::InitDefaultsLatLngImpl();
+  mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+  friend struct ::TableStruct_google_2ftype_2flatlng_2eproto;
 };
 // ===================================================================
 
@@ -230,4 +271,5 @@ inline void LatLng::set_longitude(double value) {
 
 // @@protoc_insertion_point(global_scope)
 
-#endif  // PROTOBUF_google_2ftype_2flatlng_2eproto__INCLUDED
+#include <google/protobuf/port_undef.inc>
+#endif  // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_google_2ftype_2flatlng_2eproto

+ 13 - 0
Firestore/Protos/lib/__init__.py

@@ -0,0 +1,13 @@
+# Copyright 2019 Google
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.

+ 400 - 0
Firestore/Protos/lib/pretty_printing.py

@@ -0,0 +1,400 @@
+#!/usr/bin/env python
+
+# Copyright 2019 Google
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import textwrap
+
+from google.protobuf.descriptor_pb2 import FieldDescriptorProto
+import nanopb_generator as nanopb
+
+
+LINE_WIDTH = 80
+
+
+def _indent(level):
+  """Returns leading whitespace corresponding to the given indentation `level`.
+  """
+
+  indent_per_level = 4
+  return ' ' * (indent_per_level * level)
+
+
+class FilePrettyPrinting:
+  """Allows generating pretty-printing support for a proto file.
+
+  Because two files (header and source) are generated for each proto file, this
+  class doesn't generate the necessary code directly. Use `messages` and `enums`
+  properties to generate the declarations and definitions separately and insert
+  them to the appropriate locations within the generated files.
+  """
+
+  def __init__(self, file_desc):
+    """Args:
+      file_desc: nanopb.ProtoFile describing this proto file.
+    """
+
+    self.messages = [MessagePrettyPrinting(m) for m in
+                     file_desc.messages]
+    self.enums = [EnumPrettyPrinting(e) for e in file_desc.enums]
+
+
+class MessagePrettyPrinting:
+  """Generates pretty-printing support for a message.
+
+  Adds the following member function to the Nanopb generated class:
+
+  std::string ToString(int indent = 0) const;
+
+  Because the generated code is split between a header and a source, the
+  declaration and definition are generated separately. Definition has the
+  out-of-class form.
+
+  The output of the generated function represents the proto in its text form,
+  suitable for parsing, and with proper indentation. The top-level message
+  additionally displays message name and the value of the pointer to `this`.
+  """
+
+  def __init__(self, message_desc):
+    """Args:
+      message_desc: nanopb.Message describing this message.
+    """
+
+    self.full_classname = str(message_desc.name)
+    self._short_classname = message_desc.name.parts[-1]
+
+    self._fields = [self._create_field(f, message_desc) for f in
+                    message_desc.fields]
+    # Make sure fields are printed ordered by tag, for consistency with official
+    # proto libraries.
+    self._fields.sort(key=lambda f: f.tag)
+
+  def _create_field(self, field_desc, message_desc):
+    if isinstance(field_desc, nanopb.OneOf):
+      return OneOfPrettyPrinting(field_desc, message_desc)
+    else:
+      return FieldPrettyPrinting(field_desc, message_desc)
+
+  def generate_declaration(self):
+    """Generates the declaration of a `ToString()` member function.
+    """
+
+    return '\n' + _indent(1) + 'std::string ToString(int indent = 0) const;\n'
+
+  def generate_definition(self):
+    """Generates the out-of-class definition of a `ToString()` member function.
+    """
+
+    result = '''\
+std::string %s::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "%s", this);
+    std::string result;\n\n''' % (
+    self.full_classname, self._short_classname)
+
+    for field in self._fields:
+      result += str(field)
+
+    can_be_empty = all(f.is_primitive or f.is_repeated for f in self._fields)
+    if can_be_empty:
+      result += '''
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}\n\n'''
+    else:
+      result += '''
+    std::string tail = PrintTail(indent);
+    return header + result + tail;
+}\n\n'''
+
+    return result
+
+
+class FieldPrettyPrinting:
+  """Generates pretty-printing support for a field.
+
+  The generated C++ code will output the field name and value; the output format
+  is the proto text format, suitable for parsing. Unset fields are not printed.
+  Repeated and optional fields are supported.
+
+  Oneofs are not supported; use `OneOfPrettyPrinting` instead.
+
+  The actual output will be delegated to a C++ function called
+  `PrintPrimitiveField()`, `PrintEnumField()`, or `PrintMessageField()`,
+  according to the field type; the function is expected to be visible at the
+  point of definition.
+  """
+
+  def __init__(self, field_desc, message_desc):
+    """Args:
+      field_desc: nanopb.Field describing this field.
+      message_desc: nanopb.Message describing the message containing this field.
+    """
+
+    self.name = field_desc.name
+    self.tag = field_desc.tag
+
+    self.is_optional = (field_desc.rules == 'OPTIONAL' and field_desc.allocation == 'STATIC')
+    self.is_repeated = field_desc.rules == 'REPEATED'
+    self.is_primitive = field_desc.pbtype != 'MESSAGE'
+    self.is_enum = field_desc.pbtype in ['ENUM', 'UENUM']
+
+  def __str__(self):
+    """Generates a C++ statement that prints the field according to its type.
+    """
+
+    if self.is_optional:
+      return self._generate_for_optional()
+    elif self.is_repeated:
+      return self._generate_for_repeated()
+    else:
+      return self._generate_for_leaf()
+
+  def _generate_for_repeated(self):
+    """Generates a C++ statement that prints the repeated field, if non-empty.
+    """
+
+    count = self.name + '_count'
+
+    result = '''\
+    for (pb_size_t i = 0; i != %s; ++i) {\n''' % count
+    # If the repeated field is non-empty, print all its members, even if they are
+    # zero or empty (otherwise, an array of zeroes would be indistinguishable from
+    # an empty array).
+    result += self._generate_for_leaf(indent=2, always_print=True)
+    result += '''\
+    }\n'''
+
+    return result
+
+  def _generate_for_optional(self):
+    """Generates a C++ statement that prints the optional field, if set.
+    """
+
+    name = self.name
+    result = '''\
+    if (has_%s) {\n''' % name
+    # If an optional field is set, always print the value, even if it's zero or
+    # empty.
+    result += self._generate_for_leaf(indent=2, always_print=True)
+    result += '''\
+    }\n'''
+
+    return result
+
+  def _generate_for_leaf(self, indent=1, always_print=False, parent_oneof=None):
+    """Generates a C++ statement that prints the "leaf" field.
+
+    "Leaf" is to indicate that this function is non-recursive. If the field is
+    a message type, the generated code will delegate printing to its
+    `ToString()` member function.
+
+    Args:
+      indent: The indentation level of the generated statement.
+      always_print: If `False`, the field will not be printed if it has the
+        default value, or for a message, if each field it contains has the
+        default value.
+      parent_oneof: If the field is a member of a oneof, a reference to the
+        corresponding `OneOfPrettyPrinting`
+    """
+
+    always_print = 'true' if always_print else 'false'
+
+    display_name = self.name
+    if self.is_primitive:
+      display_name += ':'
+
+    cc_name = self._get_cc_name(parent_oneof)
+    function_name = self._get_printer_function_name()
+
+    return self._generate(indent, display_name, cc_name, function_name,
+                          always_print)
+
+  def _get_cc_name(self, parent_oneof):
+    """Gets the name of the field to use in the generated C++ code:
+
+    - for repeated fields, appends indexing in the form of `[i]`;
+    - for named union members, prepends the name of the enclosing union;
+    - ensures the name isn't a C++ keyword by appending an underscore
+      (currently, only for keyword `delete`).
+    """
+
+    cc_name = self.name
+
+    # If a proto field is named `delete`, it is renamed to `delete_` by our script
+    # because `delete` is a keyword in C++. Unfortunately, the renaming mechanism
+    # runs separately from generating pretty printers; consequently, when pretty
+    # printers are being generated, all proto fields still have their unmodified
+    # names.
+    if cc_name == 'delete':
+      cc_name = 'delete_'
+
+    if self.is_repeated:
+      cc_name += '[i]'
+
+    if parent_oneof and not parent_oneof.is_anonymous:
+      cc_name = parent_oneof.name + '.' + cc_name
+
+    return cc_name
+
+  def _get_printer_function_name(self):
+    """Gets the name of the C++ function to delegate printing to.
+    """
+
+    if self.is_enum:
+      return 'PrintEnumField'
+    elif self.is_primitive:
+      return 'PrintPrimitiveField'
+    else:
+      return 'PrintMessageField'
+
+  def _generate(self, indent_level, display_name, cc_name, function_name,
+                always_print):
+    """Generates the C++ statement that prints the field.
+
+    Args:
+      indent_level: The indentation level of the generated statement.
+      display_name: The name of the field to display in the output.
+      cc_name: The name of the field to use in the generated C++ code; may
+        differ from `display_name`.
+      function_name: The C++ function to delegate printing the value to.
+      always_print: Whether to print the field if it has its default value.
+    """
+
+    format_str = '%sresult += %s("%s ",%s%s, indent + 1, %s);\n'
+    for maybe_linebreak in [' ', '\n' + _indent(indent_level + 1)]:
+      args = (
+        _indent(indent_level), function_name, display_name, maybe_linebreak,
+        cc_name,
+        always_print)
+
+      result = format_str % args
+      # Best-effort attempt to fit within the expected line width.
+      if len(result) <= LINE_WIDTH:
+        break
+
+    return result
+
+
+class OneOfPrettyPrinting(FieldPrettyPrinting):
+  """Generates pretty-printing support for a oneof field.
+
+  This class represents the "whole" oneof, with all of its members nested, not
+  a single oneof member.
+  Note that all members of the oneof are nested (in `_fields` property).
+  """
+
+  def __init__(self, field_desc, message_desc):
+    """Args:
+      field_desc: nanopb.Field describing this oneof field.
+      message_desc: nanopb.Message describing the message containing this field.
+    """
+
+    FieldPrettyPrinting.__init__(self, field_desc, message_desc)
+
+    self._full_classname = str(message_desc.name)
+
+    self._which = 'which_' + field_desc.name
+    self.is_anonymous = field_desc.anonymous
+    self._fields = [FieldPrettyPrinting(f, message_desc) for f in
+                    field_desc.fields]
+
+  def __str__(self):
+    """Generates a C++ statement that prints the oneof field, if it is set.
+    """
+
+    which = self._which
+    result = '''\
+    switch (%s) {\n''' % which
+
+    for f in self._fields:
+      tag_name = '%s_%s_tag' % (self._full_classname, f.name)
+      result += '''\
+    case %s:\n''' % tag_name
+
+      # If oneof is set, always print that member, even if it's zero or empty.
+      result += f._generate_for_leaf(indent=2, parent_oneof=self,
+                                     always_print=True)
+      result += '''\
+        break;\n'''
+
+    result += '''\
+    }\n'''
+
+    return result
+
+
+class EnumPrettyPrinting:
+  """Generates pretty-printing support for an enumeration.
+
+  Adds the following free function to the file:
+
+  const char* EnumToString(SomeEnumType value);
+
+  Because the generated code is split between a header and a source, the
+  declaration and definition are generated separately.
+
+  The output of the generated function represents the string value of the given
+  enum constant. If the given value is not part of the enum, a string
+  representing an error is returned.
+  """
+
+  def __init__(self, enum_desc):
+    """Args:
+      enum_desc: nanopb.Enum describing this enumeration.
+    """
+
+    self.name = str(enum_desc.names)
+    self._members = [str(n) for n in enum_desc.value_longnames]
+
+  def generate_declaration(self):
+    """Generates the declaration of a `EnumToString()` free function.
+    """
+
+    # Best-effort attempt to fit within the expected line width.
+    format_str = 'const char* EnumToString(%s%s value);\n'
+    for maybe_linebreak in ['', '\n' + _indent(1)]:
+      args = (maybe_linebreak, self.name)
+      result = format_str % args
+      # Best-effort attempt to fit within the expected line width.
+      if len(result) <= LINE_WIDTH:
+        break
+
+    return result
+
+  def generate_definition(self):
+    """Generates the definition of a `EnumToString()` free function.
+    """
+
+    result = '''\
+const char* EnumToString(
+  %s value) {
+    switch (value) {\n''' % self.name
+
+    for full_name in self._members:
+      short_name = full_name.replace('%s_' % self.name, '')
+      result += '''\
+    case %s:
+        return "%s";\n''' % (full_name, short_name)
+
+    result += '''\
+    }
+    return "<unknown enum value>";
+}\n\n'''
+
+    return result

+ 59 - 0
Firestore/Protos/nanopb/firestore/local/maybe_document.nanopb.cc

@@ -19,9 +19,17 @@
 
 #include "maybe_document.nanopb.h"
 
+#include "Firestore/core/src/firebase/firestore/nanopb/pretty_printing.h"
+
 namespace firebase {
 namespace firestore {
 
+using nanopb::PrintEnumField;
+using nanopb::PrintHeader;
+using nanopb::PrintMessageField;
+using nanopb::PrintPrimitiveField;
+using nanopb::PrintTail;
+
 /* @@protoc_insertion_point(includes) */
 #if PB_PROTO_HEADER_VERSION != 30
 #error Regenerate this file with the current version of nanopb generator.
@@ -74,6 +82,57 @@ PB_STATIC_ASSERT((pb_membersize(firestore_client_NoDocument, read_time) < 256 &&
 #endif
 
 
+std::string firestore_client_NoDocument::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "NoDocument", this);
+    std::string result;
+
+    result += PrintPrimitiveField("name: ", name, indent + 1, false);
+    result += PrintMessageField("read_time ", read_time, indent + 1, false);
+
+    std::string tail = PrintTail(indent);
+    return header + result + tail;
+}
+
+std::string firestore_client_UnknownDocument::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "UnknownDocument", this);
+    std::string result;
+
+    result += PrintPrimitiveField("name: ", name, indent + 1, false);
+    result += PrintMessageField("version ", version, indent + 1, false);
+
+    std::string tail = PrintTail(indent);
+    return header + result + tail;
+}
+
+std::string firestore_client_MaybeDocument::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "MaybeDocument", this);
+    std::string result;
+
+    switch (which_document_type) {
+    case firestore_client_MaybeDocument_no_document_tag:
+        result += PrintMessageField("no_document ",
+            no_document, indent + 1, true);
+        break;
+    case firestore_client_MaybeDocument_document_tag:
+        result += PrintMessageField("document ", document, indent + 1, true);
+        break;
+    case firestore_client_MaybeDocument_unknown_document_tag:
+        result += PrintMessageField("unknown_document ",
+            unknown_document, indent + 1, true);
+        break;
+    }
+    result += PrintPrimitiveField("has_committed_mutations: ",
+        has_committed_mutations, indent + 1, false);
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
 }  // namespace firestore
 }  // namespace firebase
 

+ 8 - 0
Firestore/Protos/nanopb/firestore/local/maybe_document.nanopb.h

@@ -25,6 +25,8 @@
 
 #include "google/protobuf/timestamp.nanopb.h"
 
+#include <string>
+
 namespace firebase {
 namespace firestore {
 
@@ -38,12 +40,16 @@ namespace firestore {
 typedef struct _firestore_client_NoDocument {
     pb_bytes_array_t *name;
     google_protobuf_Timestamp read_time;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:firestore_client_NoDocument) */
 } firestore_client_NoDocument;
 
 typedef struct _firestore_client_UnknownDocument {
     pb_bytes_array_t *name;
     google_protobuf_Timestamp version;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:firestore_client_UnknownDocument) */
 } firestore_client_UnknownDocument;
 
@@ -55,6 +61,8 @@ typedef struct _firestore_client_MaybeDocument {
         firestore_client_UnknownDocument unknown_document;
     };
     bool has_committed_mutations;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:firestore_client_MaybeDocument) */
 } firestore_client_MaybeDocument;
 

+ 45 - 0
Firestore/Protos/nanopb/firestore/local/mutation.nanopb.cc

@@ -19,9 +19,17 @@
 
 #include "mutation.nanopb.h"
 
+#include "Firestore/core/src/firebase/firestore/nanopb/pretty_printing.h"
+
 namespace firebase {
 namespace firestore {
 
+using nanopb::PrintEnumField;
+using nanopb::PrintHeader;
+using nanopb::PrintMessageField;
+using nanopb::PrintPrimitiveField;
+using nanopb::PrintTail;
+
 /* @@protoc_insertion_point(includes) */
 #if PB_PROTO_HEADER_VERSION != 30
 #error Regenerate this file with the current version of nanopb generator.
@@ -68,6 +76,43 @@ PB_STATIC_ASSERT((pb_membersize(firestore_client_WriteBatch, local_write_time) <
 #endif
 
 
+std::string firestore_client_MutationQueue::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "MutationQueue", this);
+    std::string result;
+
+    result += PrintPrimitiveField("last_acknowledged_batch_id: ",
+        last_acknowledged_batch_id, indent + 1, false);
+    result += PrintPrimitiveField("last_stream_token: ",
+        last_stream_token, indent + 1, false);
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string firestore_client_WriteBatch::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "WriteBatch", this);
+    std::string result;
+
+    result += PrintPrimitiveField("batch_id: ", batch_id, indent + 1, false);
+    for (pb_size_t i = 0; i != writes_count; ++i) {
+        result += PrintMessageField("writes ", writes[i], indent + 1, true);
+    }
+    result += PrintMessageField("local_write_time ",
+        local_write_time, indent + 1, false);
+    for (pb_size_t i = 0; i != base_writes_count; ++i) {
+        result += PrintMessageField("base_writes ",
+            base_writes[i], indent + 1, true);
+    }
+
+    std::string tail = PrintTail(indent);
+    return header + result + tail;
+}
+
 }  // namespace firestore
 }  // namespace firebase
 

+ 6 - 0
Firestore/Protos/nanopb/firestore/local/mutation.nanopb.h

@@ -25,6 +25,8 @@
 
 #include "google/protobuf/timestamp.nanopb.h"
 
+#include <string>
+
 namespace firebase {
 namespace firestore {
 
@@ -38,6 +40,8 @@ namespace firestore {
 typedef struct _firestore_client_MutationQueue {
     int32_t last_acknowledged_batch_id;
     pb_bytes_array_t *last_stream_token;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:firestore_client_MutationQueue) */
 } firestore_client_MutationQueue;
 
@@ -48,6 +52,8 @@ typedef struct _firestore_client_WriteBatch {
     google_protobuf_Timestamp local_write_time;
     pb_size_t base_writes_count;
     struct _google_firestore_v1_Write *base_writes;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:firestore_client_WriteBatch) */
 } firestore_client_WriteBatch;
 

+ 49 - 0
Firestore/Protos/nanopb/firestore/local/target.nanopb.cc

@@ -19,9 +19,17 @@
 
 #include "target.nanopb.h"
 
+#include "Firestore/core/src/firebase/firestore/nanopb/pretty_printing.h"
+
 namespace firebase {
 namespace firestore {
 
+using nanopb::PrintEnumField;
+using nanopb::PrintHeader;
+using nanopb::PrintMessageField;
+using nanopb::PrintPrimitiveField;
+using nanopb::PrintTail;
+
 /* @@protoc_insertion_point(includes) */
 #if PB_PROTO_HEADER_VERSION != 30
 #error Regenerate this file with the current version of nanopb generator.
@@ -72,6 +80,47 @@ PB_STATIC_ASSERT((pb_membersize(firestore_client_Target, query) < 256 && pb_memb
 #endif
 
 
+std::string firestore_client_Target::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "Target", this);
+    std::string result;
+
+    result += PrintPrimitiveField("target_id: ", target_id, indent + 1, false);
+    result += PrintMessageField("snapshot_version ",
+        snapshot_version, indent + 1, false);
+    result += PrintPrimitiveField("resume_token: ",
+        resume_token, indent + 1, false);
+    result += PrintPrimitiveField("last_listen_sequence_number: ",
+        last_listen_sequence_number, indent + 1, false);
+    switch (which_target_type) {
+    case firestore_client_Target_query_tag:
+        result += PrintMessageField("query ", query, indent + 1, true);
+        break;
+    case firestore_client_Target_documents_tag:
+        result += PrintMessageField("documents ", documents, indent + 1, true);
+        break;
+    }
+
+    std::string tail = PrintTail(indent);
+    return header + result + tail;
+}
+
+std::string firestore_client_TargetGlobal::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "TargetGlobal", this);
+    std::string result;
+
+    result += PrintPrimitiveField("highest_target_id: ",
+        highest_target_id, indent + 1, false);
+    result += PrintPrimitiveField("highest_listen_sequence_number: ",
+        highest_listen_sequence_number, indent + 1, false);
+    result += PrintMessageField("last_remote_snapshot_version ",
+        last_remote_snapshot_version, indent + 1, false);
+    result += PrintPrimitiveField("target_count: ",
+        target_count, indent + 1, false);
+
+    std::string tail = PrintTail(indent);
+    return header + result + tail;
+}
+
 }  // namespace firestore
 }  // namespace firebase
 

+ 6 - 0
Firestore/Protos/nanopb/firestore/local/target.nanopb.h

@@ -25,6 +25,8 @@
 
 #include "google/protobuf/timestamp.nanopb.h"
 
+#include <string>
+
 namespace firebase {
 namespace firestore {
 
@@ -45,6 +47,8 @@ typedef struct _firestore_client_Target {
         google_firestore_v1_Target_QueryTarget query;
         google_firestore_v1_Target_DocumentsTarget documents;
     };
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:firestore_client_Target) */
 } firestore_client_Target;
 
@@ -53,6 +57,8 @@ typedef struct _firestore_client_TargetGlobal {
     int64_t highest_listen_sequence_number;
     google_protobuf_Timestamp last_remote_snapshot_version;
     int32_t target_count;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:firestore_client_TargetGlobal) */
 } firestore_client_TargetGlobal;
 

+ 8 - 0
Firestore/Protos/nanopb/google/api/annotations.nanopb.cc

@@ -19,9 +19,17 @@
 
 #include "annotations.nanopb.h"
 
+#include "Firestore/core/src/firebase/firestore/nanopb/pretty_printing.h"
+
 namespace firebase {
 namespace firestore {
 
+using nanopb::PrintEnumField;
+using nanopb::PrintHeader;
+using nanopb::PrintMessageField;
+using nanopb::PrintPrimitiveField;
+using nanopb::PrintTail;
+
 /* @@protoc_insertion_point(includes) */
 #if PB_PROTO_HEADER_VERSION != 30
 #error Regenerate this file with the current version of nanopb generator.

+ 2 - 0
Firestore/Protos/nanopb/google/api/annotations.nanopb.h

@@ -23,6 +23,8 @@
 
 #include "google/api/http.nanopb.h"
 
+#include <string>
+
 namespace firebase {
 namespace firestore {
 

+ 83 - 0
Firestore/Protos/nanopb/google/api/http.nanopb.cc

@@ -19,9 +19,17 @@
 
 #include "http.nanopb.h"
 
+#include "Firestore/core/src/firebase/firestore/nanopb/pretty_printing.h"
+
 namespace firebase {
 namespace firestore {
 
+using nanopb::PrintEnumField;
+using nanopb::PrintHeader;
+using nanopb::PrintMessageField;
+using nanopb::PrintPrimitiveField;
+using nanopb::PrintTail;
+
 /* @@protoc_insertion_point(includes) */
 #if PB_PROTO_HEADER_VERSION != 30
 #error Regenerate this file with the current version of nanopb generator.
@@ -79,6 +87,81 @@ PB_STATIC_ASSERT((pb_membersize(google_api_HttpRule, custom) < 256), YOU_MUST_DE
 #endif
 
 
+std::string google_api_Http::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "Http", this);
+    std::string result;
+
+    for (pb_size_t i = 0; i != rules_count; ++i) {
+        result += PrintMessageField("rules ", rules[i], indent + 1, true);
+    }
+    result += PrintPrimitiveField("fully_decode_reserved_expansion: ",
+        fully_decode_reserved_expansion, indent + 1, false);
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string google_api_HttpRule::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "HttpRule", this);
+    std::string result;
+
+    result += PrintPrimitiveField("selector: ", selector, indent + 1, false);
+    switch (which_pattern) {
+    case google_api_HttpRule_get_tag:
+        result += PrintPrimitiveField("get: ", get, indent + 1, true);
+        break;
+    case google_api_HttpRule_put_tag:
+        result += PrintPrimitiveField("put: ", put, indent + 1, true);
+        break;
+    case google_api_HttpRule_post_tag:
+        result += PrintPrimitiveField("post: ", post, indent + 1, true);
+        break;
+    case google_api_HttpRule_delete_tag:
+        result += PrintPrimitiveField("delete: ", delete_, indent + 1, true);
+        break;
+    case google_api_HttpRule_patch_tag:
+        result += PrintPrimitiveField("patch: ", patch, indent + 1, true);
+        break;
+    case google_api_HttpRule_custom_tag:
+        result += PrintMessageField("custom ", custom, indent + 1, true);
+        break;
+    }
+    result += PrintPrimitiveField("body: ", body, indent + 1, false);
+    for (pb_size_t i = 0; i != additional_bindings_count; ++i) {
+        result += PrintMessageField("additional_bindings ",
+            additional_bindings[i], indent + 1, true);
+    }
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string google_api_CustomHttpPattern::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "CustomHttpPattern", this);
+    std::string result;
+
+    result += PrintPrimitiveField("kind: ", kind, indent + 1, false);
+    result += PrintPrimitiveField("path: ", path, indent + 1, false);
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
 }  // namespace firestore
 }  // namespace firebase
 

+ 8 - 0
Firestore/Protos/nanopb/google/api/http.nanopb.h

@@ -21,6 +21,8 @@
 #define PB_GOOGLE_API_HTTP_NANOPB_H_INCLUDED
 #include <pb.h>
 
+#include <string>
+
 namespace firebase {
 namespace firestore {
 
@@ -34,6 +36,8 @@ namespace firestore {
 typedef struct _google_api_CustomHttpPattern {
     pb_bytes_array_t *kind;
     pb_bytes_array_t *path;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_api_CustomHttpPattern) */
 } google_api_CustomHttpPattern;
 
@@ -41,6 +45,8 @@ typedef struct _google_api_Http {
     pb_size_t rules_count;
     struct _google_api_HttpRule *rules;
     bool fully_decode_reserved_expansion;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_api_Http) */
 } google_api_Http;
 
@@ -58,6 +64,8 @@ typedef struct _google_api_HttpRule {
     pb_bytes_array_t *body;
     pb_size_t additional_bindings_count;
     struct _google_api_HttpRule *additional_bindings;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_api_HttpRule) */
 } google_api_HttpRule;
 

+ 107 - 0
Firestore/Protos/nanopb/google/firestore/v1/common.nanopb.cc

@@ -19,9 +19,17 @@
 
 #include "common.nanopb.h"
 
+#include "Firestore/core/src/firebase/firestore/nanopb/pretty_printing.h"
+
 namespace firebase {
 namespace firestore {
 
+using nanopb::PrintEnumField;
+using nanopb::PrintHeader;
+using nanopb::PrintMessageField;
+using nanopb::PrintPrimitiveField;
+using nanopb::PrintTail;
+
 /* @@protoc_insertion_point(includes) */
 #if PB_PROTO_HEADER_VERSION != 30
 #error Regenerate this file with the current version of nanopb generator.
@@ -81,6 +89,105 @@ PB_STATIC_ASSERT((pb_membersize(google_firestore_v1_Precondition, update_time) <
 #endif
 
 
+std::string google_firestore_v1_DocumentMask::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "DocumentMask", this);
+    std::string result;
+
+    for (pb_size_t i = 0; i != field_paths_count; ++i) {
+        result += PrintPrimitiveField("field_paths: ",
+            field_paths[i], indent + 1, true);
+    }
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string google_firestore_v1_Precondition::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "Precondition", this);
+    std::string result;
+
+    switch (which_condition_type) {
+    case google_firestore_v1_Precondition_exists_tag:
+        result += PrintPrimitiveField("exists: ", exists, indent + 1, true);
+        break;
+    case google_firestore_v1_Precondition_update_time_tag:
+        result += PrintMessageField("update_time ",
+            update_time, indent + 1, true);
+        break;
+    }
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string google_firestore_v1_TransactionOptions::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "TransactionOptions", this);
+    std::string result;
+
+    switch (which_mode) {
+    case google_firestore_v1_TransactionOptions_read_only_tag:
+        result += PrintMessageField("read_only ", read_only, indent + 1, true);
+        break;
+    case google_firestore_v1_TransactionOptions_read_write_tag:
+        result += PrintMessageField("read_write ",
+            read_write, indent + 1, true);
+        break;
+    }
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string google_firestore_v1_TransactionOptions_ReadWrite::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "ReadWrite", this);
+    std::string result;
+
+    result += PrintPrimitiveField("retry_transaction: ",
+        retry_transaction, indent + 1, false);
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string google_firestore_v1_TransactionOptions_ReadOnly::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "ReadOnly", this);
+    std::string result;
+
+    switch (which_consistency_selector) {
+    case google_firestore_v1_TransactionOptions_ReadOnly_read_time_tag:
+        result += PrintMessageField("read_time ", read_time, indent + 1, true);
+        break;
+    }
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
 }  // namespace firestore
 }  // namespace firebase
 

+ 12 - 0
Firestore/Protos/nanopb/google/firestore/v1/common.nanopb.h

@@ -25,6 +25,8 @@
 
 #include "google/protobuf/timestamp.nanopb.h"
 
+#include <string>
+
 namespace firebase {
 namespace firestore {
 
@@ -38,11 +40,15 @@ namespace firestore {
 typedef struct _google_firestore_v1_DocumentMask {
     pb_size_t field_paths_count;
     pb_bytes_array_t **field_paths;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_DocumentMask) */
 } google_firestore_v1_DocumentMask;
 
 typedef struct _google_firestore_v1_TransactionOptions_ReadWrite {
     pb_bytes_array_t *retry_transaction;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_TransactionOptions_ReadWrite) */
 } google_firestore_v1_TransactionOptions_ReadWrite;
 
@@ -52,6 +58,8 @@ typedef struct _google_firestore_v1_Precondition {
         bool exists;
         google_protobuf_Timestamp update_time;
     };
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_Precondition) */
 } google_firestore_v1_Precondition;
 
@@ -60,6 +68,8 @@ typedef struct _google_firestore_v1_TransactionOptions_ReadOnly {
     union {
         google_protobuf_Timestamp read_time;
     };
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_TransactionOptions_ReadOnly) */
 } google_firestore_v1_TransactionOptions_ReadOnly;
 
@@ -69,6 +79,8 @@ typedef struct _google_firestore_v1_TransactionOptions {
         google_firestore_v1_TransactionOptions_ReadOnly read_only;
         google_firestore_v1_TransactionOptions_ReadWrite read_write;
     };
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_TransactionOptions) */
 } google_firestore_v1_TransactionOptions;
 

+ 141 - 0
Firestore/Protos/nanopb/google/firestore/v1/document.nanopb.cc

@@ -19,9 +19,17 @@
 
 #include "document.nanopb.h"
 
+#include "Firestore/core/src/firebase/firestore/nanopb/pretty_printing.h"
+
 namespace firebase {
 namespace firestore {
 
+using nanopb::PrintEnumField;
+using nanopb::PrintHeader;
+using nanopb::PrintMessageField;
+using nanopb::PrintPrimitiveField;
+using nanopb::PrintTail;
+
 /* @@protoc_insertion_point(includes) */
 #if PB_PROTO_HEADER_VERSION != 30
 #error Regenerate this file with the current version of nanopb generator.
@@ -99,6 +107,139 @@ PB_STATIC_ASSERT((pb_membersize(google_firestore_v1_Document, create_time) < 256
 #endif
 
 
+std::string google_firestore_v1_Document::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "Document", this);
+    std::string result;
+
+    result += PrintPrimitiveField("name: ", name, indent + 1, false);
+    for (pb_size_t i = 0; i != fields_count; ++i) {
+        result += PrintMessageField("fields ", fields[i], indent + 1, true);
+    }
+    result += PrintMessageField("create_time ",
+        create_time, indent + 1, false);
+    if (has_update_time) {
+        result += PrintMessageField("update_time ",
+            update_time, indent + 1, true);
+    }
+
+    std::string tail = PrintTail(indent);
+    return header + result + tail;
+}
+
+std::string google_firestore_v1_Document_FieldsEntry::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "FieldsEntry", this);
+    std::string result;
+
+    result += PrintPrimitiveField("key: ", key, indent + 1, false);
+    result += PrintMessageField("value ", value, indent + 1, false);
+
+    std::string tail = PrintTail(indent);
+    return header + result + tail;
+}
+
+std::string google_firestore_v1_Value::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "Value", this);
+    std::string result;
+
+    switch (which_value_type) {
+    case google_firestore_v1_Value_boolean_value_tag:
+        result += PrintPrimitiveField("boolean_value: ",
+            boolean_value, indent + 1, true);
+        break;
+    case google_firestore_v1_Value_integer_value_tag:
+        result += PrintPrimitiveField("integer_value: ",
+            integer_value, indent + 1, true);
+        break;
+    case google_firestore_v1_Value_double_value_tag:
+        result += PrintPrimitiveField("double_value: ",
+            double_value, indent + 1, true);
+        break;
+    case google_firestore_v1_Value_reference_value_tag:
+        result += PrintPrimitiveField("reference_value: ",
+            reference_value, indent + 1, true);
+        break;
+    case google_firestore_v1_Value_map_value_tag:
+        result += PrintMessageField("map_value ", map_value, indent + 1, true);
+        break;
+    case google_firestore_v1_Value_geo_point_value_tag:
+        result += PrintMessageField("geo_point_value ",
+            geo_point_value, indent + 1, true);
+        break;
+    case google_firestore_v1_Value_array_value_tag:
+        result += PrintMessageField("array_value ",
+            array_value, indent + 1, true);
+        break;
+    case google_firestore_v1_Value_timestamp_value_tag:
+        result += PrintMessageField("timestamp_value ",
+            timestamp_value, indent + 1, true);
+        break;
+    case google_firestore_v1_Value_null_value_tag:
+        result += PrintEnumField("null_value: ", null_value, indent + 1, true);
+        break;
+    case google_firestore_v1_Value_string_value_tag:
+        result += PrintPrimitiveField("string_value: ",
+            string_value, indent + 1, true);
+        break;
+    case google_firestore_v1_Value_bytes_value_tag:
+        result += PrintPrimitiveField("bytes_value: ",
+            bytes_value, indent + 1, true);
+        break;
+    }
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string google_firestore_v1_ArrayValue::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "ArrayValue", this);
+    std::string result;
+
+    for (pb_size_t i = 0; i != values_count; ++i) {
+        result += PrintMessageField("values ", values[i], indent + 1, true);
+    }
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string google_firestore_v1_MapValue::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "MapValue", this);
+    std::string result;
+
+    for (pb_size_t i = 0; i != fields_count; ++i) {
+        result += PrintMessageField("fields ", fields[i], indent + 1, true);
+    }
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string google_firestore_v1_MapValue_FieldsEntry::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "FieldsEntry", this);
+    std::string result;
+
+    result += PrintPrimitiveField("key: ", key, indent + 1, false);
+    result += PrintMessageField("value ", value, indent + 1, false);
+
+    std::string tail = PrintTail(indent);
+    return header + result + tail;
+}
+
 }  // namespace firestore
 }  // namespace firebase
 

+ 14 - 0
Firestore/Protos/nanopb/google/firestore/v1/document.nanopb.h

@@ -29,6 +29,8 @@
 
 #include "google/type/latlng.nanopb.h"
 
+#include <string>
+
 namespace firebase {
 namespace firestore {
 
@@ -42,12 +44,16 @@ namespace firestore {
 typedef struct _google_firestore_v1_ArrayValue {
     pb_size_t values_count;
     struct _google_firestore_v1_Value *values;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_ArrayValue) */
 } google_firestore_v1_ArrayValue;
 
 typedef struct _google_firestore_v1_MapValue {
     pb_size_t fields_count;
     struct _google_firestore_v1_MapValue_FieldsEntry *fields;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_MapValue) */
 } google_firestore_v1_MapValue;
 
@@ -58,6 +64,8 @@ typedef struct _google_firestore_v1_Document {
     google_protobuf_Timestamp create_time;
     bool has_update_time;
     google_protobuf_Timestamp update_time;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_Document) */
 } google_firestore_v1_Document;
 
@@ -76,18 +84,24 @@ typedef struct _google_firestore_v1_Value {
         pb_bytes_array_t *string_value;
         pb_bytes_array_t *bytes_value;
     };
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_Value) */
 } google_firestore_v1_Value;
 
 typedef struct _google_firestore_v1_Document_FieldsEntry {
     pb_bytes_array_t *key;
     google_firestore_v1_Value value;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_Document_FieldsEntry) */
 } google_firestore_v1_Document_FieldsEntry;
 
 typedef struct _google_firestore_v1_MapValue_FieldsEntry {
     pb_bytes_array_t *key;
     google_firestore_v1_Value value;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_MapValue_FieldsEntry) */
 } google_firestore_v1_MapValue_FieldsEntry;
 

+ 584 - 0
Firestore/Protos/nanopb/google/firestore/v1/firestore.nanopb.cc

@@ -19,9 +19,17 @@
 
 #include "firestore.nanopb.h"
 
+#include "Firestore/core/src/firebase/firestore/nanopb/pretty_printing.h"
+
 namespace firebase {
 namespace firestore {
 
+using nanopb::PrintEnumField;
+using nanopb::PrintHeader;
+using nanopb::PrintMessageField;
+using nanopb::PrintPrimitiveField;
+using nanopb::PrintTail;
+
 /* @@protoc_insertion_point(includes) */
 #if PB_PROTO_HEADER_VERSION != 30
 #error Regenerate this file with the current version of nanopb generator.
@@ -259,6 +267,582 @@ PB_STATIC_ASSERT((pb_membersize(google_firestore_v1_GetDocumentRequest, read_tim
 #endif
 
 
+const char* EnumToString(
+  google_firestore_v1_TargetChange_TargetChangeType value) {
+    switch (value) {
+    case google_firestore_v1_TargetChange_TargetChangeType_NO_CHANGE:
+        return "NO_CHANGE";
+    case google_firestore_v1_TargetChange_TargetChangeType_ADD:
+        return "ADD";
+    case google_firestore_v1_TargetChange_TargetChangeType_REMOVE:
+        return "REMOVE";
+    case google_firestore_v1_TargetChange_TargetChangeType_CURRENT:
+        return "CURRENT";
+    case google_firestore_v1_TargetChange_TargetChangeType_RESET:
+        return "RESET";
+    }
+    return "<unknown enum value>";
+}
+
+std::string google_firestore_v1_GetDocumentRequest::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "GetDocumentRequest", this);
+    std::string result;
+
+    result += PrintPrimitiveField("name: ", name, indent + 1, false);
+    result += PrintMessageField("mask ", mask, indent + 1, false);
+    switch (which_consistency_selector) {
+    case google_firestore_v1_GetDocumentRequest_transaction_tag:
+        result += PrintPrimitiveField("transaction: ",
+            transaction, indent + 1, true);
+        break;
+    case google_firestore_v1_GetDocumentRequest_read_time_tag:
+        result += PrintMessageField("read_time ", read_time, indent + 1, true);
+        break;
+    }
+
+    std::string tail = PrintTail(indent);
+    return header + result + tail;
+}
+
+std::string google_firestore_v1_ListDocumentsRequest::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "ListDocumentsRequest", this);
+    std::string result;
+
+    result += PrintPrimitiveField("parent: ", parent, indent + 1, false);
+    result += PrintPrimitiveField("collection_id: ",
+        collection_id, indent + 1, false);
+    result += PrintPrimitiveField("page_size: ", page_size, indent + 1, false);
+    result += PrintPrimitiveField("page_token: ",
+        page_token, indent + 1, false);
+    result += PrintPrimitiveField("order_by: ", order_by, indent + 1, false);
+    result += PrintMessageField("mask ", mask, indent + 1, false);
+    switch (which_consistency_selector) {
+    case google_firestore_v1_ListDocumentsRequest_transaction_tag:
+        result += PrintPrimitiveField("transaction: ",
+            transaction, indent + 1, true);
+        break;
+    case google_firestore_v1_ListDocumentsRequest_read_time_tag:
+        result += PrintMessageField("read_time ", read_time, indent + 1, true);
+        break;
+    }
+    result += PrintPrimitiveField("show_missing: ",
+        show_missing, indent + 1, false);
+
+    std::string tail = PrintTail(indent);
+    return header + result + tail;
+}
+
+std::string google_firestore_v1_ListDocumentsResponse::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "ListDocumentsResponse", this);
+    std::string result;
+
+    for (pb_size_t i = 0; i != documents_count; ++i) {
+        result += PrintMessageField("documents ",
+            documents[i], indent + 1, true);
+    }
+    result += PrintPrimitiveField("next_page_token: ",
+        next_page_token, indent + 1, false);
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string google_firestore_v1_CreateDocumentRequest::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "CreateDocumentRequest", this);
+    std::string result;
+
+    result += PrintPrimitiveField("parent: ", parent, indent + 1, false);
+    result += PrintPrimitiveField("collection_id: ",
+        collection_id, indent + 1, false);
+    result += PrintPrimitiveField("document_id: ",
+        document_id, indent + 1, false);
+    result += PrintMessageField("document ", document, indent + 1, false);
+    result += PrintMessageField("mask ", mask, indent + 1, false);
+
+    std::string tail = PrintTail(indent);
+    return header + result + tail;
+}
+
+std::string google_firestore_v1_UpdateDocumentRequest::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "UpdateDocumentRequest", this);
+    std::string result;
+
+    result += PrintMessageField("document ", document, indent + 1, false);
+    result += PrintMessageField("update_mask ",
+        update_mask, indent + 1, false);
+    result += PrintMessageField("mask ", mask, indent + 1, false);
+    result += PrintMessageField("current_document ",
+        current_document, indent + 1, false);
+
+    std::string tail = PrintTail(indent);
+    return header + result + tail;
+}
+
+std::string google_firestore_v1_DeleteDocumentRequest::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "DeleteDocumentRequest", this);
+    std::string result;
+
+    result += PrintPrimitiveField("name: ", name, indent + 1, false);
+    result += PrintMessageField("current_document ",
+        current_document, indent + 1, false);
+
+    std::string tail = PrintTail(indent);
+    return header + result + tail;
+}
+
+std::string google_firestore_v1_BatchGetDocumentsRequest::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "BatchGetDocumentsRequest", this);
+    std::string result;
+
+    result += PrintPrimitiveField("database: ", database, indent + 1, false);
+    for (pb_size_t i = 0; i != documents_count; ++i) {
+        result += PrintPrimitiveField("documents: ",
+            documents[i], indent + 1, true);
+    }
+    result += PrintMessageField("mask ", mask, indent + 1, false);
+    switch (which_consistency_selector) {
+    case google_firestore_v1_BatchGetDocumentsRequest_transaction_tag:
+        result += PrintPrimitiveField("transaction: ",
+            transaction, indent + 1, true);
+        break;
+    case google_firestore_v1_BatchGetDocumentsRequest_new_transaction_tag:
+        result += PrintMessageField("new_transaction ",
+            new_transaction, indent + 1, true);
+        break;
+    case google_firestore_v1_BatchGetDocumentsRequest_read_time_tag:
+        result += PrintMessageField("read_time ", read_time, indent + 1, true);
+        break;
+    }
+
+    std::string tail = PrintTail(indent);
+    return header + result + tail;
+}
+
+std::string google_firestore_v1_BatchGetDocumentsResponse::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "BatchGetDocumentsResponse", this);
+    std::string result;
+
+    switch (which_result) {
+    case google_firestore_v1_BatchGetDocumentsResponse_found_tag:
+        result += PrintMessageField("found ", found, indent + 1, true);
+        break;
+    case google_firestore_v1_BatchGetDocumentsResponse_missing_tag:
+        result += PrintPrimitiveField("missing: ", missing, indent + 1, true);
+        break;
+    }
+    result += PrintPrimitiveField("transaction: ",
+        transaction, indent + 1, false);
+    result += PrintMessageField("read_time ", read_time, indent + 1, false);
+
+    std::string tail = PrintTail(indent);
+    return header + result + tail;
+}
+
+std::string google_firestore_v1_BeginTransactionRequest::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "BeginTransactionRequest", this);
+    std::string result;
+
+    result += PrintPrimitiveField("database: ", database, indent + 1, false);
+    result += PrintMessageField("options ", options, indent + 1, false);
+
+    std::string tail = PrintTail(indent);
+    return header + result + tail;
+}
+
+std::string google_firestore_v1_BeginTransactionResponse::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "BeginTransactionResponse", this);
+    std::string result;
+
+    result += PrintPrimitiveField("transaction: ",
+        transaction, indent + 1, false);
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string google_firestore_v1_CommitRequest::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "CommitRequest", this);
+    std::string result;
+
+    result += PrintPrimitiveField("database: ", database, indent + 1, false);
+    for (pb_size_t i = 0; i != writes_count; ++i) {
+        result += PrintMessageField("writes ", writes[i], indent + 1, true);
+    }
+    result += PrintPrimitiveField("transaction: ",
+        transaction, indent + 1, false);
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string google_firestore_v1_CommitResponse::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "CommitResponse", this);
+    std::string result;
+
+    for (pb_size_t i = 0; i != write_results_count; ++i) {
+        result += PrintMessageField("write_results ",
+            write_results[i], indent + 1, true);
+    }
+    result += PrintMessageField("commit_time ",
+        commit_time, indent + 1, false);
+
+    std::string tail = PrintTail(indent);
+    return header + result + tail;
+}
+
+std::string google_firestore_v1_RollbackRequest::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "RollbackRequest", this);
+    std::string result;
+
+    result += PrintPrimitiveField("database: ", database, indent + 1, false);
+    result += PrintPrimitiveField("transaction: ",
+        transaction, indent + 1, false);
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string google_firestore_v1_RunQueryRequest::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "RunQueryRequest", this);
+    std::string result;
+
+    result += PrintPrimitiveField("parent: ", parent, indent + 1, false);
+    switch (which_query_type) {
+    case google_firestore_v1_RunQueryRequest_structured_query_tag:
+        result += PrintMessageField("structured_query ",
+            query_type.structured_query, indent + 1, true);
+        break;
+    }
+    switch (which_consistency_selector) {
+    case google_firestore_v1_RunQueryRequest_transaction_tag:
+        result += PrintPrimitiveField("transaction: ",
+            consistency_selector.transaction, indent + 1, true);
+        break;
+    case google_firestore_v1_RunQueryRequest_new_transaction_tag:
+        result += PrintMessageField("new_transaction ",
+            consistency_selector.new_transaction, indent + 1, true);
+        break;
+    case google_firestore_v1_RunQueryRequest_read_time_tag:
+        result += PrintMessageField("read_time ",
+            consistency_selector.read_time, indent + 1, true);
+        break;
+    }
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string google_firestore_v1_RunQueryResponse::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "RunQueryResponse", this);
+    std::string result;
+
+    result += PrintMessageField("document ", document, indent + 1, false);
+    result += PrintPrimitiveField("transaction: ",
+        transaction, indent + 1, false);
+    result += PrintMessageField("read_time ", read_time, indent + 1, false);
+    result += PrintPrimitiveField("skipped_results: ",
+        skipped_results, indent + 1, false);
+
+    std::string tail = PrintTail(indent);
+    return header + result + tail;
+}
+
+std::string google_firestore_v1_WriteRequest::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "WriteRequest", this);
+    std::string result;
+
+    result += PrintPrimitiveField("database: ", database, indent + 1, false);
+    result += PrintPrimitiveField("stream_id: ", stream_id, indent + 1, false);
+    for (pb_size_t i = 0; i != writes_count; ++i) {
+        result += PrintMessageField("writes ", writes[i], indent + 1, true);
+    }
+    result += PrintPrimitiveField("stream_token: ",
+        stream_token, indent + 1, false);
+    for (pb_size_t i = 0; i != labels_count; ++i) {
+        result += PrintMessageField("labels ", labels[i], indent + 1, true);
+    }
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string google_firestore_v1_WriteRequest_LabelsEntry::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "LabelsEntry", this);
+    std::string result;
+
+    result += PrintPrimitiveField("key: ", key, indent + 1, false);
+    result += PrintPrimitiveField("value: ", value, indent + 1, false);
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string google_firestore_v1_WriteResponse::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "WriteResponse", this);
+    std::string result;
+
+    result += PrintPrimitiveField("stream_id: ", stream_id, indent + 1, false);
+    result += PrintPrimitiveField("stream_token: ",
+        stream_token, indent + 1, false);
+    for (pb_size_t i = 0; i != write_results_count; ++i) {
+        result += PrintMessageField("write_results ",
+            write_results[i], indent + 1, true);
+    }
+    result += PrintMessageField("commit_time ",
+        commit_time, indent + 1, false);
+
+    std::string tail = PrintTail(indent);
+    return header + result + tail;
+}
+
+std::string google_firestore_v1_ListenRequest::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "ListenRequest", this);
+    std::string result;
+
+    result += PrintPrimitiveField("database: ", database, indent + 1, false);
+    switch (which_target_change) {
+    case google_firestore_v1_ListenRequest_add_target_tag:
+        result += PrintMessageField("add_target ",
+            add_target, indent + 1, true);
+        break;
+    case google_firestore_v1_ListenRequest_remove_target_tag:
+        result += PrintPrimitiveField("remove_target: ",
+            remove_target, indent + 1, true);
+        break;
+    }
+    for (pb_size_t i = 0; i != labels_count; ++i) {
+        result += PrintMessageField("labels ", labels[i], indent + 1, true);
+    }
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string google_firestore_v1_ListenRequest_LabelsEntry::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "LabelsEntry", this);
+    std::string result;
+
+    result += PrintPrimitiveField("key: ", key, indent + 1, false);
+    result += PrintPrimitiveField("value: ", value, indent + 1, false);
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string google_firestore_v1_ListenResponse::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "ListenResponse", this);
+    std::string result;
+
+    switch (which_response_type) {
+    case google_firestore_v1_ListenResponse_target_change_tag:
+        result += PrintMessageField("target_change ",
+            target_change, indent + 1, true);
+        break;
+    case google_firestore_v1_ListenResponse_document_change_tag:
+        result += PrintMessageField("document_change ",
+            document_change, indent + 1, true);
+        break;
+    case google_firestore_v1_ListenResponse_document_delete_tag:
+        result += PrintMessageField("document_delete ",
+            document_delete, indent + 1, true);
+        break;
+    case google_firestore_v1_ListenResponse_filter_tag:
+        result += PrintMessageField("filter ", filter, indent + 1, true);
+        break;
+    case google_firestore_v1_ListenResponse_document_remove_tag:
+        result += PrintMessageField("document_remove ",
+            document_remove, indent + 1, true);
+        break;
+    }
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string google_firestore_v1_Target::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "Target", this);
+    std::string result;
+
+    switch (which_target_type) {
+    case google_firestore_v1_Target_query_tag:
+        result += PrintMessageField("query ",
+            target_type.query, indent + 1, true);
+        break;
+    case google_firestore_v1_Target_documents_tag:
+        result += PrintMessageField("documents ",
+            target_type.documents, indent + 1, true);
+        break;
+    }
+    switch (which_resume_type) {
+    case google_firestore_v1_Target_resume_token_tag:
+        result += PrintPrimitiveField("resume_token: ",
+            resume_type.resume_token, indent + 1, true);
+        break;
+    case google_firestore_v1_Target_read_time_tag:
+        result += PrintMessageField("read_time ",
+            resume_type.read_time, indent + 1, true);
+        break;
+    }
+    result += PrintPrimitiveField("target_id: ", target_id, indent + 1, false);
+    result += PrintPrimitiveField("once: ", once, indent + 1, false);
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string google_firestore_v1_Target_DocumentsTarget::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "DocumentsTarget", this);
+    std::string result;
+
+    for (pb_size_t i = 0; i != documents_count; ++i) {
+        result += PrintPrimitiveField("documents: ",
+            documents[i], indent + 1, true);
+    }
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string google_firestore_v1_Target_QueryTarget::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "QueryTarget", this);
+    std::string result;
+
+    result += PrintPrimitiveField("parent: ", parent, indent + 1, false);
+    switch (which_query_type) {
+    case google_firestore_v1_Target_QueryTarget_structured_query_tag:
+        result += PrintMessageField("structured_query ",
+            structured_query, indent + 1, true);
+        break;
+    }
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string google_firestore_v1_TargetChange::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "TargetChange", this);
+    std::string result;
+
+    result += PrintEnumField("target_change_type: ",
+        target_change_type, indent + 1, false);
+    for (pb_size_t i = 0; i != target_ids_count; ++i) {
+        result += PrintPrimitiveField("target_ids: ",
+            target_ids[i], indent + 1, true);
+    }
+    if (has_cause) {
+        result += PrintMessageField("cause ", cause, indent + 1, true);
+    }
+    result += PrintPrimitiveField("resume_token: ",
+        resume_token, indent + 1, false);
+    result += PrintMessageField("read_time ", read_time, indent + 1, false);
+
+    std::string tail = PrintTail(indent);
+    return header + result + tail;
+}
+
+std::string google_firestore_v1_ListCollectionIdsRequest::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "ListCollectionIdsRequest", this);
+    std::string result;
+
+    result += PrintPrimitiveField("parent: ", parent, indent + 1, false);
+    result += PrintPrimitiveField("page_size: ", page_size, indent + 1, false);
+    result += PrintPrimitiveField("page_token: ",
+        page_token, indent + 1, false);
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string google_firestore_v1_ListCollectionIdsResponse::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "ListCollectionIdsResponse", this);
+    std::string result;
+
+    for (pb_size_t i = 0; i != collection_ids_count; ++i) {
+        result += PrintPrimitiveField("collection_ids: ",
+            collection_ids[i], indent + 1, true);
+    }
+    result += PrintPrimitiveField("next_page_token: ",
+        next_page_token, indent + 1, false);
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
 }  // namespace firestore
 }  // namespace firebase
 

+ 58 - 0
Firestore/Protos/nanopb/google/firestore/v1/firestore.nanopb.h

@@ -37,6 +37,8 @@
 
 #include "google/rpc/status.nanopb.h"
 
+#include <string>
+
 namespace firebase {
 namespace firestore {
 
@@ -61,6 +63,8 @@ typedef enum _google_firestore_v1_TargetChange_TargetChangeType {
 /* Struct definitions */
 typedef struct _google_firestore_v1_BeginTransactionResponse {
     pb_bytes_array_t *transaction;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_BeginTransactionResponse) */
 } google_firestore_v1_BeginTransactionResponse;
 
@@ -69,6 +73,8 @@ typedef struct _google_firestore_v1_CommitRequest {
     pb_size_t writes_count;
     struct _google_firestore_v1_Write *writes;
     pb_bytes_array_t *transaction;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_CommitRequest) */
 } google_firestore_v1_CommitRequest;
 
@@ -76,6 +82,8 @@ typedef struct _google_firestore_v1_ListCollectionIdsResponse {
     pb_size_t collection_ids_count;
     pb_bytes_array_t **collection_ids;
     pb_bytes_array_t *next_page_token;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_ListCollectionIdsResponse) */
 } google_firestore_v1_ListCollectionIdsResponse;
 
@@ -83,24 +91,32 @@ typedef struct _google_firestore_v1_ListDocumentsResponse {
     pb_size_t documents_count;
     struct _google_firestore_v1_Document *documents;
     pb_bytes_array_t *next_page_token;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_ListDocumentsResponse) */
 } google_firestore_v1_ListDocumentsResponse;
 
 typedef struct _google_firestore_v1_ListenRequest_LabelsEntry {
     pb_bytes_array_t *key;
     pb_bytes_array_t *value;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_ListenRequest_LabelsEntry) */
 } google_firestore_v1_ListenRequest_LabelsEntry;
 
 typedef struct _google_firestore_v1_RollbackRequest {
     pb_bytes_array_t *database;
     pb_bytes_array_t *transaction;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_RollbackRequest) */
 } google_firestore_v1_RollbackRequest;
 
 typedef struct _google_firestore_v1_Target_DocumentsTarget {
     pb_size_t documents_count;
     pb_bytes_array_t **documents;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_Target_DocumentsTarget) */
 } google_firestore_v1_Target_DocumentsTarget;
 
@@ -112,12 +128,16 @@ typedef struct _google_firestore_v1_WriteRequest {
     pb_bytes_array_t *stream_token;
     pb_size_t labels_count;
     struct _google_firestore_v1_WriteRequest_LabelsEntry *labels;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_WriteRequest) */
 } google_firestore_v1_WriteRequest;
 
 typedef struct _google_firestore_v1_WriteRequest_LabelsEntry {
     pb_bytes_array_t *key;
     pb_bytes_array_t *value;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_WriteRequest_LabelsEntry) */
 } google_firestore_v1_WriteRequest_LabelsEntry;
 
@@ -132,6 +152,8 @@ typedef struct _google_firestore_v1_BatchGetDocumentsRequest {
         google_firestore_v1_TransactionOptions new_transaction;
         google_protobuf_Timestamp read_time;
     };
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_BatchGetDocumentsRequest) */
 } google_firestore_v1_BatchGetDocumentsRequest;
 
@@ -143,12 +165,16 @@ typedef struct _google_firestore_v1_BatchGetDocumentsResponse {
     };
     pb_bytes_array_t *transaction;
     google_protobuf_Timestamp read_time;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_BatchGetDocumentsResponse) */
 } google_firestore_v1_BatchGetDocumentsResponse;
 
 typedef struct _google_firestore_v1_BeginTransactionRequest {
     pb_bytes_array_t *database;
     google_firestore_v1_TransactionOptions options;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_BeginTransactionRequest) */
 } google_firestore_v1_BeginTransactionRequest;
 
@@ -156,6 +182,8 @@ typedef struct _google_firestore_v1_CommitResponse {
     pb_size_t write_results_count;
     struct _google_firestore_v1_WriteResult *write_results;
     google_protobuf_Timestamp commit_time;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_CommitResponse) */
 } google_firestore_v1_CommitResponse;
 
@@ -165,12 +193,16 @@ typedef struct _google_firestore_v1_CreateDocumentRequest {
     pb_bytes_array_t *document_id;
     google_firestore_v1_Document document;
     google_firestore_v1_DocumentMask mask;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_CreateDocumentRequest) */
 } google_firestore_v1_CreateDocumentRequest;
 
 typedef struct _google_firestore_v1_DeleteDocumentRequest {
     pb_bytes_array_t *name;
     google_firestore_v1_Precondition current_document;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_DeleteDocumentRequest) */
 } google_firestore_v1_DeleteDocumentRequest;
 
@@ -182,6 +214,8 @@ typedef struct _google_firestore_v1_GetDocumentRequest {
         pb_bytes_array_t *transaction;
         google_protobuf_Timestamp read_time;
     };
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_GetDocumentRequest) */
 } google_firestore_v1_GetDocumentRequest;
 
@@ -189,6 +223,8 @@ typedef struct _google_firestore_v1_ListCollectionIdsRequest {
     pb_bytes_array_t *parent;
     int32_t page_size;
     pb_bytes_array_t *page_token;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_ListCollectionIdsRequest) */
 } google_firestore_v1_ListCollectionIdsRequest;
 
@@ -205,6 +241,8 @@ typedef struct _google_firestore_v1_ListDocumentsRequest {
         google_protobuf_Timestamp read_time;
     };
     bool show_missing;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_ListDocumentsRequest) */
 } google_firestore_v1_ListDocumentsRequest;
 
@@ -220,6 +258,8 @@ typedef struct _google_firestore_v1_RunQueryRequest {
         google_firestore_v1_TransactionOptions new_transaction;
         google_protobuf_Timestamp read_time;
     } consistency_selector;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_RunQueryRequest) */
 } google_firestore_v1_RunQueryRequest;
 
@@ -228,6 +268,8 @@ typedef struct _google_firestore_v1_RunQueryResponse {
     pb_bytes_array_t *transaction;
     google_protobuf_Timestamp read_time;
     int32_t skipped_results;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_RunQueryResponse) */
 } google_firestore_v1_RunQueryResponse;
 
@@ -239,6 +281,8 @@ typedef struct _google_firestore_v1_TargetChange {
     google_rpc_Status cause;
     pb_bytes_array_t *resume_token;
     google_protobuf_Timestamp read_time;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_TargetChange) */
 } google_firestore_v1_TargetChange;
 
@@ -248,6 +292,8 @@ typedef struct _google_firestore_v1_Target_QueryTarget {
     union {
         google_firestore_v1_StructuredQuery structured_query;
     };
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_Target_QueryTarget) */
 } google_firestore_v1_Target_QueryTarget;
 
@@ -256,6 +302,8 @@ typedef struct _google_firestore_v1_UpdateDocumentRequest {
     google_firestore_v1_DocumentMask update_mask;
     google_firestore_v1_DocumentMask mask;
     google_firestore_v1_Precondition current_document;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_UpdateDocumentRequest) */
 } google_firestore_v1_UpdateDocumentRequest;
 
@@ -265,6 +313,8 @@ typedef struct _google_firestore_v1_WriteResponse {
     pb_size_t write_results_count;
     struct _google_firestore_v1_WriteResult *write_results;
     google_protobuf_Timestamp commit_time;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_WriteResponse) */
 } google_firestore_v1_WriteResponse;
 
@@ -277,6 +327,8 @@ typedef struct _google_firestore_v1_ListenResponse {
         google_firestore_v1_ExistenceFilter filter;
         google_firestore_v1_DocumentRemove document_remove;
     };
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_ListenResponse) */
 } google_firestore_v1_ListenResponse;
 
@@ -293,6 +345,8 @@ typedef struct _google_firestore_v1_Target {
     } resume_type;
     int32_t target_id;
     bool once;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_Target) */
 } google_firestore_v1_Target;
 
@@ -305,6 +359,8 @@ typedef struct _google_firestore_v1_ListenRequest {
     };
     pb_size_t labels_count;
     struct _google_firestore_v1_ListenRequest_LabelsEntry *labels;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_ListenRequest) */
 } google_firestore_v1_ListenRequest;
 
@@ -530,6 +586,8 @@ extern const pb_field_t google_firestore_v1_ListCollectionIdsResponse_fields[3];
 
 #endif
 
+const char* EnumToString(
+    google_firestore_v1_TargetChange_TargetChangeType value);
 }  // namespace firestore
 }  // namespace firebase
 

+ 252 - 0
Firestore/Protos/nanopb/google/firestore/v1/query.nanopb.cc

@@ -19,9 +19,17 @@
 
 #include "query.nanopb.h"
 
+#include "Firestore/core/src/firebase/firestore/nanopb/pretty_printing.h"
+
 namespace firebase {
 namespace firestore {
 
+using nanopb::PrintEnumField;
+using nanopb::PrintHeader;
+using nanopb::PrintMessageField;
+using nanopb::PrintPrimitiveField;
+using nanopb::PrintTail;
+
 /* @@protoc_insertion_point(includes) */
 #if PB_PROTO_HEADER_VERSION != 30
 #error Regenerate this file with the current version of nanopb generator.
@@ -124,6 +132,250 @@ PB_STATIC_ASSERT((pb_membersize(google_firestore_v1_StructuredQuery, select) < 2
 #endif
 
 
+const char* EnumToString(
+  google_firestore_v1_StructuredQuery_Direction value) {
+    switch (value) {
+    case google_firestore_v1_StructuredQuery_Direction_DIRECTION_UNSPECIFIED:
+        return "DIRECTION_UNSPECIFIED";
+    case google_firestore_v1_StructuredQuery_Direction_ASCENDING:
+        return "ASCENDING";
+    case google_firestore_v1_StructuredQuery_Direction_DESCENDING:
+        return "DESCENDING";
+    }
+    return "<unknown enum value>";
+}
+
+const char* EnumToString(
+  google_firestore_v1_StructuredQuery_CompositeFilter_Operator value) {
+    switch (value) {
+    case google_firestore_v1_StructuredQuery_CompositeFilter_Operator_OPERATOR_UNSPECIFIED:
+        return "OPERATOR_UNSPECIFIED";
+    case google_firestore_v1_StructuredQuery_CompositeFilter_Operator_AND:
+        return "AND";
+    }
+    return "<unknown enum value>";
+}
+
+const char* EnumToString(
+  google_firestore_v1_StructuredQuery_FieldFilter_Operator value) {
+    switch (value) {
+    case google_firestore_v1_StructuredQuery_FieldFilter_Operator_OPERATOR_UNSPECIFIED:
+        return "OPERATOR_UNSPECIFIED";
+    case google_firestore_v1_StructuredQuery_FieldFilter_Operator_LESS_THAN:
+        return "LESS_THAN";
+    case google_firestore_v1_StructuredQuery_FieldFilter_Operator_LESS_THAN_OR_EQUAL:
+        return "LESS_THAN_OR_EQUAL";
+    case google_firestore_v1_StructuredQuery_FieldFilter_Operator_GREATER_THAN:
+        return "GREATER_THAN";
+    case google_firestore_v1_StructuredQuery_FieldFilter_Operator_GREATER_THAN_OR_EQUAL:
+        return "GREATER_THAN_OR_EQUAL";
+    case google_firestore_v1_StructuredQuery_FieldFilter_Operator_EQUAL:
+        return "EQUAL";
+    case google_firestore_v1_StructuredQuery_FieldFilter_Operator_ARRAY_CONTAINS:
+        return "ARRAY_CONTAINS";
+    case google_firestore_v1_StructuredQuery_FieldFilter_Operator_IN:
+        return "IN";
+    case google_firestore_v1_StructuredQuery_FieldFilter_Operator_ARRAY_CONTAINS_ANY:
+        return "ARRAY_CONTAINS_ANY";
+    }
+    return "<unknown enum value>";
+}
+
+const char* EnumToString(
+  google_firestore_v1_StructuredQuery_UnaryFilter_Operator value) {
+    switch (value) {
+    case google_firestore_v1_StructuredQuery_UnaryFilter_Operator_OPERATOR_UNSPECIFIED:
+        return "OPERATOR_UNSPECIFIED";
+    case google_firestore_v1_StructuredQuery_UnaryFilter_Operator_IS_NAN:
+        return "IS_NAN";
+    case google_firestore_v1_StructuredQuery_UnaryFilter_Operator_IS_NULL:
+        return "IS_NULL";
+    }
+    return "<unknown enum value>";
+}
+
+std::string google_firestore_v1_StructuredQuery::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "StructuredQuery", this);
+    std::string result;
+
+    result += PrintMessageField("select ", select, indent + 1, false);
+    for (pb_size_t i = 0; i != from_count; ++i) {
+        result += PrintMessageField("from ", from[i], indent + 1, true);
+    }
+    result += PrintMessageField("where ", where, indent + 1, false);
+    for (pb_size_t i = 0; i != order_by_count; ++i) {
+        result += PrintMessageField("order_by ",
+            order_by[i], indent + 1, true);
+    }
+    if (has_limit) {
+        result += PrintMessageField("limit ", limit, indent + 1, true);
+    }
+    result += PrintPrimitiveField("offset: ", offset, indent + 1, false);
+    result += PrintMessageField("start_at ", start_at, indent + 1, false);
+    result += PrintMessageField("end_at ", end_at, indent + 1, false);
+
+    std::string tail = PrintTail(indent);
+    return header + result + tail;
+}
+
+std::string google_firestore_v1_StructuredQuery_CollectionSelector::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "CollectionSelector", this);
+    std::string result;
+
+    result += PrintPrimitiveField("collection_id: ",
+        collection_id, indent + 1, false);
+    result += PrintPrimitiveField("all_descendants: ",
+        all_descendants, indent + 1, false);
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string google_firestore_v1_StructuredQuery_Filter::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "Filter", this);
+    std::string result;
+
+    switch (which_filter_type) {
+    case google_firestore_v1_StructuredQuery_Filter_composite_filter_tag:
+        result += PrintMessageField("composite_filter ",
+            composite_filter, indent + 1, true);
+        break;
+    case google_firestore_v1_StructuredQuery_Filter_field_filter_tag:
+        result += PrintMessageField("field_filter ",
+            field_filter, indent + 1, true);
+        break;
+    case google_firestore_v1_StructuredQuery_Filter_unary_filter_tag:
+        result += PrintMessageField("unary_filter ",
+            unary_filter, indent + 1, true);
+        break;
+    }
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string google_firestore_v1_StructuredQuery_CompositeFilter::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "CompositeFilter", this);
+    std::string result;
+
+    result += PrintEnumField("op: ", op, indent + 1, false);
+    for (pb_size_t i = 0; i != filters_count; ++i) {
+        result += PrintMessageField("filters ", filters[i], indent + 1, true);
+    }
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string google_firestore_v1_StructuredQuery_FieldFilter::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "FieldFilter", this);
+    std::string result;
+
+    result += PrintMessageField("field ", field, indent + 1, false);
+    result += PrintEnumField("op: ", op, indent + 1, false);
+    result += PrintMessageField("value ", value, indent + 1, false);
+
+    std::string tail = PrintTail(indent);
+    return header + result + tail;
+}
+
+std::string google_firestore_v1_StructuredQuery_UnaryFilter::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "UnaryFilter", this);
+    std::string result;
+
+    result += PrintEnumField("op: ", op, indent + 1, false);
+    switch (which_operand_type) {
+    case google_firestore_v1_StructuredQuery_UnaryFilter_field_tag:
+        result += PrintMessageField("field ", field, indent + 1, true);
+        break;
+    }
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string google_firestore_v1_StructuredQuery_Order::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "Order", this);
+    std::string result;
+
+    result += PrintMessageField("field ", field, indent + 1, false);
+    result += PrintEnumField("direction: ", direction, indent + 1, false);
+
+    std::string tail = PrintTail(indent);
+    return header + result + tail;
+}
+
+std::string google_firestore_v1_StructuredQuery_FieldReference::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "FieldReference", this);
+    std::string result;
+
+    result += PrintPrimitiveField("field_path: ",
+        field_path, indent + 1, false);
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string google_firestore_v1_StructuredQuery_Projection::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "Projection", this);
+    std::string result;
+
+    for (pb_size_t i = 0; i != fields_count; ++i) {
+        result += PrintMessageField("fields ", fields[i], indent + 1, true);
+    }
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
+std::string google_firestore_v1_Cursor::ToString(int indent) const {
+    std::string header = PrintHeader(indent, "Cursor", this);
+    std::string result;
+
+    for (pb_size_t i = 0; i != values_count; ++i) {
+        result += PrintMessageField("values ", values[i], indent + 1, true);
+    }
+    result += PrintPrimitiveField("before: ", before, indent + 1, false);
+
+    bool is_root = indent == 0;
+    if (!result.empty() || is_root) {
+      std::string tail = PrintTail(indent);
+      return header + result + tail;
+    } else {
+      return "";
+    }
+}
+
 }  // namespace firestore
 }  // namespace firebase
 

+ 29 - 0
Firestore/Protos/nanopb/google/firestore/v1/query.nanopb.h

@@ -27,6 +27,8 @@
 
 #include "google/protobuf/wrappers.nanopb.h"
 
+#include <string>
+
 namespace firebase {
 namespace firestore {
 
@@ -81,12 +83,16 @@ typedef enum _google_firestore_v1_StructuredQuery_UnaryFilter_Operator {
 /* Struct definitions */
 typedef struct _google_firestore_v1_StructuredQuery_FieldReference {
     pb_bytes_array_t *field_path;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_StructuredQuery_FieldReference) */
 } google_firestore_v1_StructuredQuery_FieldReference;
 
 typedef struct _google_firestore_v1_StructuredQuery_Projection {
     pb_size_t fields_count;
     struct _google_firestore_v1_StructuredQuery_FieldReference *fields;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_StructuredQuery_Projection) */
 } google_firestore_v1_StructuredQuery_Projection;
 
@@ -94,12 +100,16 @@ typedef struct _google_firestore_v1_Cursor {
     pb_size_t values_count;
     struct _google_firestore_v1_Value *values;
     bool before;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_Cursor) */
 } google_firestore_v1_Cursor;
 
 typedef struct _google_firestore_v1_StructuredQuery_CollectionSelector {
     pb_bytes_array_t *collection_id;
     bool all_descendants;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_StructuredQuery_CollectionSelector) */
 } google_firestore_v1_StructuredQuery_CollectionSelector;
 
@@ -107,6 +117,8 @@ typedef struct _google_firestore_v1_StructuredQuery_CompositeFilter {
     google_firestore_v1_StructuredQuery_CompositeFilter_Operator op;
     pb_size_t filters_count;
     struct _google_firestore_v1_StructuredQuery_Filter *filters;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_StructuredQuery_CompositeFilter) */
 } google_firestore_v1_StructuredQuery_CompositeFilter;
 
@@ -114,12 +126,16 @@ typedef struct _google_firestore_v1_StructuredQuery_FieldFilter {
     google_firestore_v1_StructuredQuery_FieldReference field;
     google_firestore_v1_StructuredQuery_FieldFilter_Operator op;
     google_firestore_v1_Value value;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_StructuredQuery_FieldFilter) */
 } google_firestore_v1_StructuredQuery_FieldFilter;
 
 typedef struct _google_firestore_v1_StructuredQuery_Order {
     google_firestore_v1_StructuredQuery_FieldReference field;
     google_firestore_v1_StructuredQuery_Direction direction;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_StructuredQuery_Order) */
 } google_firestore_v1_StructuredQuery_Order;
 
@@ -129,6 +145,8 @@ typedef struct _google_firestore_v1_StructuredQuery_UnaryFilter {
     union {
         google_firestore_v1_StructuredQuery_FieldReference field;
     };
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_StructuredQuery_UnaryFilter) */
 } google_firestore_v1_StructuredQuery_UnaryFilter;
 
@@ -139,6 +157,8 @@ typedef struct _google_firestore_v1_StructuredQuery_Filter {
         google_firestore_v1_StructuredQuery_FieldFilter field_filter;
         google_firestore_v1_StructuredQuery_UnaryFilter unary_filter;
     };
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_StructuredQuery_Filter) */
 } google_firestore_v1_StructuredQuery_Filter;
 
@@ -154,6 +174,8 @@ typedef struct _google_firestore_v1_StructuredQuery {
     int32_t offset;
     google_firestore_v1_Cursor start_at;
     google_firestore_v1_Cursor end_at;
+
+    std::string ToString(int indent = 0) const;
 /* @@protoc_insertion_point(struct:google_firestore_v1_StructuredQuery) */
 } google_firestore_v1_StructuredQuery;
 
@@ -241,6 +263,13 @@ extern const pb_field_t google_firestore_v1_Cursor_fields[3];
 
 #endif
 
+const char* EnumToString(google_firestore_v1_StructuredQuery_Direction value);
+const char* EnumToString(
+    google_firestore_v1_StructuredQuery_CompositeFilter_Operator value);
+const char* EnumToString(
+    google_firestore_v1_StructuredQuery_FieldFilter_Operator value);
+const char* EnumToString(
+    google_firestore_v1_StructuredQuery_UnaryFilter_Operator value);
 }  // namespace firestore
 }  // namespace firebase
 

Vissa filer visades inte eftersom för många filer har ändrats