From 6ab9abc882eb3ac8a10a0b61f9e3c988dd2035bf Mon Sep 17 00:00:00 2001 From: Wu-Hui Date: Fri, 11 Feb 2022 11:03:27 -0500 Subject: [PATCH 01/10] Add index.proto --- .../Firestore.xcodeproj/project.pbxproj | 40 + .../Protos/cpp/google/api/resource.pb.cc | 846 +++++++++++ Firestore/Protos/cpp/google/api/resource.pb.h | 1266 +++++++++++++++++ .../cpp/google/firestore/admin/index.pb.cc | 867 +++++++++++ .../cpp/google/firestore/admin/index.pb.h | 1025 +++++++++++++ .../nanopb/google/api/resource.nanopb.cc | 135 ++ .../nanopb/google/api/resource.nanopb.h | 118 ++ .../google/firestore/admin/index.nanopb.cc | 160 +++ .../google/firestore/admin/index.nanopb.h | 144 ++ .../Protos/protos/google/api/resource.proto | 264 ++++ .../protos/google/firestore/admin/index.proto | 158 ++ 11 files changed, 5023 insertions(+) create mode 100644 Firestore/Protos/cpp/google/api/resource.pb.cc create mode 100644 Firestore/Protos/cpp/google/api/resource.pb.h create mode 100644 Firestore/Protos/cpp/google/firestore/admin/index.pb.cc create mode 100644 Firestore/Protos/cpp/google/firestore/admin/index.pb.h create mode 100644 Firestore/Protos/nanopb/google/api/resource.nanopb.cc create mode 100644 Firestore/Protos/nanopb/google/api/resource.nanopb.h create mode 100644 Firestore/Protos/nanopb/google/firestore/admin/index.nanopb.cc create mode 100644 Firestore/Protos/nanopb/google/firestore/admin/index.nanopb.h create mode 100644 Firestore/Protos/protos/google/api/resource.proto create mode 100644 Firestore/Protos/protos/google/firestore/admin/index.proto diff --git a/Firestore/Example/Firestore.xcodeproj/project.pbxproj b/Firestore/Example/Firestore.xcodeproj/project.pbxproj index e5a86dc9e3f..7f312b548e0 100644 --- a/Firestore/Example/Firestore.xcodeproj/project.pbxproj +++ b/Firestore/Example/Firestore.xcodeproj/project.pbxproj @@ -54,7 +54,9 @@ 08E3D48B3651E4908D75B23A /* async_testing.cc in Sources */ = {isa = PBXBuildFile; fileRef = 872C92ABD71B12784A1C5520 /* async_testing.cc */; }; 08F44F7DF9A3EF0D35C8FB57 /* FIRNumericTransformTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = D5B25E7E7D6873CBA4571841 /* FIRNumericTransformTests.mm */; }; 08FA4102AD14452E9587A1F2 /* leveldb_util_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 332485C4DCC6BA0DBB5E31B7 /* leveldb_util_test.cc */; }; + 0929C73B3F3BFC331E9E9D2F /* resource.pb.cc in Sources */ = {isa = PBXBuildFile; fileRef = 1C3F7302BF4AE6CBC00ECDD0 /* resource.pb.cc */; }; 0963F6D7B0F9AE1E24B82866 /* path_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 403DBF6EFB541DFD01582AA3 /* path_test.cc */; }; + 096BA3A3703AC1491F281618 /* index.pb.cc in Sources */ = {isa = PBXBuildFile; fileRef = 395E8B07639E69290A929695 /* index.pb.cc */; }; 098191405BA24F9A7E4F80C6 /* append_only_list_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 5477CDE922EE71C8000FCC1E /* append_only_list_test.cc */; }; 0A4E1B5E3E853763AE6ED7AE /* grpc_stream_tester.cc in Sources */ = {isa = PBXBuildFile; fileRef = 87553338E42B8ECA05BA987E /* grpc_stream_tester.cc */; }; 0A52B47C43B7602EE64F53A7 /* cc_compilation_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 1B342370EAE3AA02393E33EB /* cc_compilation_test.cc */; }; @@ -127,6 +129,7 @@ 18638EAED9E126FC5D895B14 /* common.pb.cc in Sources */ = {isa = PBXBuildFile; fileRef = 544129D221C2DDC800EFB9CC /* common.pb.cc */; }; 18CF41A17EA3292329E1119D /* FIRGeoPointTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5492E048202154AA00B64F25 /* FIRGeoPointTests.mm */; }; 18F644E6AA98E6D6F3F1F809 /* executor_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = B6FB4688208F9B9100554BA2 /* executor_test.cc */; }; + 190F9885BAA81587F08CD26C /* index.pb.cc in Sources */ = {isa = PBXBuildFile; fileRef = 395E8B07639E69290A929695 /* index.pb.cc */; }; 1989623826923A9D5A7EFA40 /* create_noop_connectivity_monitor.cc in Sources */ = {isa = PBXBuildFile; fileRef = CF39535F2C41AB0006FA6C0E /* create_noop_connectivity_monitor.cc */; }; 198F193BD9484E49375A7BE7 /* FSTHelpers.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5492E03A2021401F00B64F25 /* FSTHelpers.mm */; }; 199B778D5820495797E0BE02 /* filesystem_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = F51859B394D01C0C507282F1 /* filesystem_test.cc */; }; @@ -169,6 +172,7 @@ 21A2A881F71CB825299DF06E /* hard_assert_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 444B7AB3F5A2929070CB1363 /* hard_assert_test.cc */; }; 21C17F15579341289AD01051 /* persistence_testing.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9113B6F513D0473AEABBAF1F /* persistence_testing.cc */; }; 21E66B6A4A00786C3E934EB1 /* query_engine_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = B8A853940305237AFDA8050B /* query_engine_test.cc */; }; + 224496E752E42E220F809FAC /* resource.pb.cc in Sources */ = {isa = PBXBuildFile; fileRef = 1C3F7302BF4AE6CBC00ECDD0 /* resource.pb.cc */; }; 226574601C3F6D14DF14C16B /* recovery_spec_test.json in Resources */ = {isa = PBXBuildFile; fileRef = 9C1AFCC9E616EC33D6E169CF /* recovery_spec_test.json */; }; 227CFA0B2A01884C277E4F1D /* hashing_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 54511E8D209805F8005BD28F /* hashing_test.cc */; }; 229D1A9381F698D71F229471 /* string_win_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 79507DF8378D3C42F5B36268 /* string_win_test.cc */; }; @@ -243,6 +247,7 @@ 31BDB4CB0E7458C650A77ED0 /* FIRFirestoreTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5467FAFF203E56F8009C9584 /* FIRFirestoreTests.mm */; }; 31D8E3D925FA3F70AA20ACCE /* FSTMockDatastore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5492E02D20213FFC00B64F25 /* FSTMockDatastore.mm */; }; 32030FA5B4BE6ABDFF2F974E /* bundle_spec_test.json in Resources */ = {isa = PBXBuildFile; fileRef = 79EAA9F7B1B9592B5F053923 /* bundle_spec_test.json */; }; + 32A635B2EBF461CE7A7B5C31 /* resource.pb.cc in Sources */ = {isa = PBXBuildFile; fileRef = 1C3F7302BF4AE6CBC00ECDD0 /* resource.pb.cc */; }; 32A95242C56A1A230231DB6A /* testutil.cc in Sources */ = {isa = PBXBuildFile; fileRef = 54A0352820A3B3BD003E0143 /* testutil.cc */; }; 32B0739404FA588608E1F41A /* CodableTimestampTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B65C996438B84DBC7616640 /* CodableTimestampTests.swift */; }; 32F022CB75AEE48CDDAF2982 /* mutation_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = C8522DE226C467C54E6788D8 /* mutation_test.cc */; }; @@ -338,6 +343,7 @@ 4809D7ACAA9414E3192F04FF /* FIRGeoPointTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5492E048202154AA00B64F25 /* FIRGeoPointTests.mm */; }; 485CBA9F99771437BA1CB401 /* event_manager_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 6F57521E161450FAF89075ED /* event_manager_test.cc */; }; 489D672CAA09B9BC66798E9F /* status.pb.cc in Sources */ = {isa = PBXBuildFile; fileRef = 618BBE9920B89AAC00B5BCE7 /* status.pb.cc */; }; + 48BC5801432127A90CFF55E3 /* index.pb.cc in Sources */ = {isa = PBXBuildFile; fileRef = 395E8B07639E69290A929695 /* index.pb.cc */; }; 48D1B38B93D34F1B82320577 /* view_testing.cc in Sources */ = {isa = PBXBuildFile; fileRef = A5466E7809AD2871FFDE6C76 /* view_testing.cc */; }; 49774EBBC8496FE1E43AEE29 /* memory_local_store_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = F6CA0C5638AB6627CB5B4CF4 /* memory_local_store_test.cc */; }; 49794806F3D5052E5F61A40D /* http.pb.cc in Sources */ = {isa = PBXBuildFile; fileRef = 618BBE9720B89AAC00B5BCE7 /* http.pb.cc */; }; @@ -379,6 +385,7 @@ 4F857404731D45F02C5EE4C3 /* async_queue_libdispatch_test.mm in Sources */ = {isa = PBXBuildFile; fileRef = B6FB4680208EA0BE00554BA2 /* async_queue_libdispatch_test.mm */; }; 4FAB27F13EA5D3D79E770EA2 /* ordered_code_benchmark.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0473AFFF5567E667A125347B /* ordered_code_benchmark.cc */; }; 4FAD8823DC37B9CA24379E85 /* leveldb_mutation_queue_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 5C7942B6244F4C416B11B86C /* leveldb_mutation_queue_test.cc */; }; + 50059FDCD2DAAB755FEEEDF2 /* resource.pb.cc in Sources */ = {isa = PBXBuildFile; fileRef = 1C3F7302BF4AE6CBC00ECDD0 /* resource.pb.cc */; }; 50454F81EC4584D4EB5F5ED5 /* serializer_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 61F72C5520BC48FD001A68CB /* serializer_test.cc */; }; 50C852E08626CFA7DC889EEA /* field_index_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = BF76A8DA34B5B67B4DD74666 /* field_index_test.cc */; }; 513D34C9964E8C60C5C2EE1C /* leveldb_bundle_cache_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 8E9CD82E60893DDD7757B798 /* leveldb_bundle_cache_test.cc */; }; @@ -545,6 +552,7 @@ 5DA343D28AE05B0B2FE9FFB3 /* tree_sorted_map_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 549CCA4D20A36DBB00BCEB75 /* tree_sorted_map_test.cc */; }; 5DA741B0B90DB8DAB0AAE53C /* query_engine_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = B8A853940305237AFDA8050B /* query_engine_test.cc */; }; 5DDEC1A08F13226271FE636E /* resource_path_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = B686F2B02024FFD70028D6BE /* resource_path_test.cc */; }; + 5E53122E4214FC4EA3B3DC1E /* resource.pb.cc in Sources */ = {isa = PBXBuildFile; fileRef = 1C3F7302BF4AE6CBC00ECDD0 /* resource.pb.cc */; }; 5E5B3B8B3A41C8EB70035A6B /* FSTTransactionTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5492E07B202154EB00B64F25 /* FSTTransactionTests.mm */; }; 5E6F9184B271F6D5312412FF /* mutation_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = C8522DE226C467C54E6788D8 /* mutation_test.cc */; }; 5E7812753D960FBB373435BD /* defer_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 8ABAC2E0402213D837F73DC3 /* defer_test.cc */; }; @@ -643,6 +651,7 @@ 6E59498D20F55BA800ECD9A5 /* FuzzingResources in Resources */ = {isa = PBXBuildFile; fileRef = 6ED6DEA120F5502700FC6076 /* FuzzingResources */; }; 6E7603BC1D8011A5D6F62072 /* credentials_provider_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 2F4FA4576525144C5069A7A5 /* credentials_provider_test.cc */; }; 6E8302E021022309003E1EA3 /* FSTFuzzTestFieldPath.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6E8302DF21022309003E1EA3 /* FSTFuzzTestFieldPath.mm */; }; + 6E8CD8F545C8EDA84918977C /* index.pb.cc in Sources */ = {isa = PBXBuildFile; fileRef = 395E8B07639E69290A929695 /* index.pb.cc */; }; 6EA39FDE20FE820E008D461F /* FSTFuzzTestSerializer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6EA39FDD20FE820E008D461F /* FSTFuzzTestSerializer.mm */; }; 6EC28BB8C38E3FD126F68211 /* delayed_constructor_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = D0A6E9136804A41CEC9D55D4 /* delayed_constructor_test.cc */; }; 6EDD3B4620BF247500C33877 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; @@ -687,8 +696,10 @@ 7731E564468645A4A62E2A3C /* leveldb_key_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 54995F6E205B6E12004EFFA0 /* leveldb_key_test.cc */; }; 77BB66DD17A8E6545DE22E0B /* remote_document_cache_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7EB299CF85034F09CFD6F3FD /* remote_document_cache_test.cc */; }; 77C459976DCF7503AEE18F7F /* leveldb_bundle_cache_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 8E9CD82E60893DDD7757B798 /* leveldb_bundle_cache_test.cc */; }; + 77D38E78F7CCB8504450A8FB /* index.pb.cc in Sources */ = {isa = PBXBuildFile; fileRef = 395E8B07639E69290A929695 /* index.pb.cc */; }; 77D3CF0BE43BC67B9A26B06D /* FIRFieldPathTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5492E04C202154AA00B64F25 /* FIRFieldPathTests.mm */; }; 784FCB02C76096DACCBA11F2 /* bundle.pb.cc in Sources */ = {isa = PBXBuildFile; fileRef = A366F6AE1A5A77548485C091 /* bundle.pb.cc */; }; + 78E8DDDBE131F3DA9AF9F8B8 /* index.pb.cc in Sources */ = {isa = PBXBuildFile; fileRef = 395E8B07639E69290A929695 /* index.pb.cc */; }; 795A0E11B3951ACEA2859C8A /* mutation_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = C8522DE226C467C54E6788D8 /* mutation_test.cc */; }; 79987AF2DF1FCE799008B846 /* CodableGeoPointTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5495EB022040E90200EBA509 /* CodableGeoPointTests.swift */; }; 799AE5C2A38FCB435B1AB7EC /* nanopb_util_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 6F5B6C1399F92FD60F2C582B /* nanopb_util_test.cc */; }; @@ -1265,6 +1276,7 @@ FD8EA96A604E837092ACA51D /* ordered_code_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = AB380D03201BC6E400D97691 /* ordered_code_test.cc */; }; FE1C0263F6570DAC54A60F5C /* FIRTimestampTest.m in Sources */ = {isa = PBXBuildFile; fileRef = B65D34A7203C99090076A5E1 /* FIRTimestampTest.m */; }; FE701C2D739A5371BCBD62B9 /* leveldb_mutation_queue_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 5C7942B6244F4C416B11B86C /* leveldb_mutation_queue_test.cc */; }; + FE9131E2D84A560D287B6F90 /* resource.pb.cc in Sources */ = {isa = PBXBuildFile; fileRef = 1C3F7302BF4AE6CBC00ECDD0 /* resource.pb.cc */; }; FF3405218188DFCE586FB26B /* app_testing.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5467FB07203E6A44009C9584 /* app_testing.mm */; }; FF4FA5757D13A2B7CEE40F04 /* document.pb.cc in Sources */ = {isa = PBXBuildFile; fileRef = 544129D821C2DDC800EFB9CC /* document.pb.cc */; }; FF6333B8BD9732C068157221 /* memory_bundle_cache_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = AB4AB1388538CD3CB19EB028 /* memory_bundle_cache_test.cc */; }; @@ -1346,6 +1358,8 @@ 132E32997D781B896672D30A /* reference_set_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = reference_set_test.cc; sourceTree = ""; }; 166CE73C03AB4366AAC5201C /* leveldb_index_manager_test.cc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; path = leveldb_index_manager_test.cc; sourceTree = ""; }; 1B342370EAE3AA02393E33EB /* cc_compilation_test.cc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; name = cc_compilation_test.cc; path = api/cc_compilation_test.cc; sourceTree = ""; }; + 1C01D8CE367C56BB2624E299 /* index.pb.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = index.pb.h; path = admin/index.pb.h; sourceTree = ""; }; + 1C3F7302BF4AE6CBC00ECDD0 /* resource.pb.cc */ = {isa = PBXFileReference; includeInIndex = 1; path = resource.pb.cc; sourceTree = ""; }; 1CA9800A53669EFBFFB824E3 /* memory_remote_document_cache_test.cc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; path = memory_remote_document_cache_test.cc; sourceTree = ""; }; 214877F52A705012D6720CA0 /* object_value_test.cc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; path = object_value_test.cc; sourceTree = ""; }; 2220F583583EFC28DE792ABE /* Pods_Firestore_IntegrationTests_tvOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Firestore_IntegrationTests_tvOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -1367,6 +1381,7 @@ 33607A3AE91548BD219EC9C6 /* transform_operation_test.cc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; path = transform_operation_test.cc; sourceTree = ""; }; 358C3B5FE573B1D60A4F7592 /* strerror_test.cc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; path = strerror_test.cc; sourceTree = ""; }; 36D235D9F1240D5195CDB670 /* Pods-Firestore_IntegrationTests_tvOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Firestore_IntegrationTests_tvOS.release.xcconfig"; path = "Pods/Target Support Files/Pods-Firestore_IntegrationTests_tvOS/Pods-Firestore_IntegrationTests_tvOS.release.xcconfig"; sourceTree = ""; }; + 395E8B07639E69290A929695 /* index.pb.cc */ = {isa = PBXFileReference; includeInIndex = 1; name = index.pb.cc; path = admin/index.pb.cc; sourceTree = ""; }; 397FB002E298B780F1E223E2 /* Pods-Firestore_Tests_macOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Firestore_Tests_macOS.release.xcconfig"; path = "Pods/Target Support Files/Pods-Firestore_Tests_macOS/Pods-Firestore_Tests_macOS.release.xcconfig"; sourceTree = ""; }; 39B832380209CC5BAF93BC52 /* Pods_Firestore_IntegrationTests_macOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Firestore_IntegrationTests_macOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 3B843E4A1F3930A400548890 /* remote_store_spec_test.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = remote_store_spec_test.json; sourceTree = ""; }; @@ -1554,6 +1569,7 @@ 75E24C5CD7BC423D48713100 /* counting_query_engine.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = counting_query_engine.h; sourceTree = ""; }; 7628664347B9C96462D4BF17 /* byte_stream_apple_test.mm */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.objcpp; path = byte_stream_apple_test.mm; sourceTree = ""; }; 776530F066E788C355B78457 /* FIRBundlesTests.mm */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.objcpp; path = FIRBundlesTests.mm; sourceTree = ""; }; + 78EE0BFC7E60C4929458A0EA /* resource.pb.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = resource.pb.h; sourceTree = ""; }; 79507DF8378D3C42F5B36268 /* string_win_test.cc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; path = string_win_test.cc; sourceTree = ""; }; 79D4CD6A707ED3F7A6D2ECF5 /* view_testing.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = view_testing.h; sourceTree = ""; }; 79EAA9F7B1B9592B5F053923 /* bundle_spec_test.json */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.json; path = bundle_spec_test.json; sourceTree = ""; }; @@ -1816,6 +1832,15 @@ path = Integration; sourceTree = ""; }; + 3C21D8CBCC4E086899931A65 /* admin */ = { + isa = PBXGroup; + children = ( + 395E8B07639E69290A929695 /* index.pb.cc */, + 1C01D8CE367C56BB2624E299 /* index.pb.h */, + ); + name = admin; + sourceTree = ""; + }; 543B4F0520A91E4B001F506D /* App */ = { isa = PBXGroup; children = ( @@ -2257,6 +2282,7 @@ 618BBE8420B89AAC00B5BCE7 /* firestore */ = { isa = PBXGroup; children = ( + 3C21D8CBCC4E086899931A65 /* admin */, 544129CF21C2DDC800EFB9CC /* v1 */, ); path = firestore; @@ -2278,6 +2304,8 @@ 618BBE9620B89AAC00B5BCE7 /* annotations.pb.h */, 618BBE9720B89AAC00B5BCE7 /* http.pb.cc */, 618BBE9420B89AAC00B5BCE7 /* http.pb.h */, + 1C3F7302BF4AE6CBC00ECDD0 /* resource.pb.cc */, + 78EE0BFC7E60C4929458A0EA /* resource.pb.h */, ); path = api; sourceTree = ""; @@ -3527,6 +3555,7 @@ 9783FAEA4CF758E8C4C2D76E /* hashing_test.cc in Sources */, E82F8EBBC8CC37299A459E73 /* hashing_test_apple.mm in Sources */, 897F3C1936612ACB018CA1DD /* http.pb.cc in Sources */, + 48BC5801432127A90CFF55E3 /* index.pb.cc in Sources */, FAD97B82766AEC29B7B5A1B7 /* index_manager_test.cc in Sources */, E084921EFB7CF8CB1E950D6C /* iterator_adaptors_test.cc in Sources */, 49C04B97AB282FFA82FD98CD /* latlng.pb.cc in Sources */, @@ -3577,6 +3606,7 @@ 37EC6C6EA9169BB99078CA96 /* reference_set_test.cc in Sources */, 4E0777435A9A26B8B2C08A1E /* remote_document_cache_test.cc in Sources */, D377FA653FB976FB474D748C /* remote_event_test.cc in Sources */, + FE9131E2D84A560D287B6F90 /* resource.pb.cc in Sources */, C7F174164D7C55E35A526009 /* resource_path_test.cc in Sources */, 2836CD14F6F0EA3B184E325E /* schedule_test.cc in Sources */, 4DAF501EE4B4DB79ED4239B0 /* secure_random_test.cc in Sources */, @@ -3719,6 +3749,7 @@ 227CFA0B2A01884C277E4F1D /* hashing_test.cc in Sources */, CD78EEAA1CD36BE691CA3427 /* hashing_test_apple.mm in Sources */, 1357806B4CD3A62A8F5DE86D /* http.pb.cc in Sources */, + 190F9885BAA81587F08CD26C /* index.pb.cc in Sources */, F58A23FEF328EB74F681FE83 /* index_manager_test.cc in Sources */, 0E4C94369FFF7EC0C9229752 /* iterator_adaptors_test.cc in Sources */, 0FBDD5991E8F6CD5F8542474 /* latlng.pb.cc in Sources */, @@ -3769,6 +3800,7 @@ 7DBE7DB90CF83B589A94980F /* reference_set_test.cc in Sources */, F696B7467E80E370FDB3EAA7 /* remote_document_cache_test.cc in Sources */, EF43FF491B9282E0330E4CA2 /* remote_event_test.cc in Sources */, + 0929C73B3F3BFC331E9E9D2F /* resource.pb.cc in Sources */, 85B8918FC8C5DC62482E39C3 /* resource_path_test.cc in Sources */, 7F6199159E24E19E2A3F5601 /* schedule_test.cc in Sources */, A8C9FF6D13E6C83D4AB54EA7 /* secure_random_test.cc in Sources */, @@ -3925,6 +3957,7 @@ 5CADE71A1CA6358E1599F0F9 /* hashing_test.cc in Sources */, 3B256CCF6AEEE12E22F16BB8 /* hashing_test_apple.mm in Sources */, AB8209455BAA17850D5E196D /* http.pb.cc in Sources */, + 096BA3A3703AC1491F281618 /* index.pb.cc in Sources */, 4BFEEB7FDD7CD5A693B5B5C1 /* index_manager_test.cc in Sources */, FA334ADC73CFDB703A7C17CD /* iterator_adaptors_test.cc in Sources */, CBC891BEEC525F4D8F40A319 /* latlng.pb.cc in Sources */, @@ -3975,6 +4008,7 @@ C25F321AC9BF8D1CFC8543AF /* reference_set_test.cc in Sources */, 65537B22A73E3909666FB5BC /* remote_document_cache_test.cc in Sources */, 37286D731E432CB873354357 /* remote_event_test.cc in Sources */, + 50059FDCD2DAAB755FEEEDF2 /* resource.pb.cc in Sources */, AE0CFFC34A423E1B80D07418 /* resource_path_test.cc in Sources */, C0EFC5FB79517679C377C252 /* schedule_test.cc in Sources */, 39CDC9EC5FD2E891D6D49151 /* secure_random_test.cc in Sources */, @@ -4131,6 +4165,7 @@ 7C7BA1DB0B66EB899A928283 /* hashing_test.cc in Sources */, BDD2D1812BAD962E3C81A53F /* hashing_test_apple.mm in Sources */, 49794806F3D5052E5F61A40D /* http.pb.cc in Sources */, + 6E8CD8F545C8EDA84918977C /* index.pb.cc in Sources */, 650B31A5EC6F8D2AEA79C350 /* index_manager_test.cc in Sources */, 86494278BE08F10A8AAF9603 /* iterator_adaptors_test.cc in Sources */, 4173B61CB74EB4CD1D89EE68 /* latlng.pb.cc in Sources */, @@ -4181,6 +4216,7 @@ FBBB13329D3B5827C21AE7AB /* reference_set_test.cc in Sources */, 77BB66DD17A8E6545DE22E0B /* remote_document_cache_test.cc in Sources */, A7309DAD4A3B5334536ECA46 /* remote_event_test.cc in Sources */, + 5E53122E4214FC4EA3B3DC1E /* resource.pb.cc in Sources */, 2634E1C1971C05790B505824 /* resource_path_test.cc in Sources */, 5EDF0D63EAD6A65D4F8CDF45 /* schedule_test.cc in Sources */, 53F449F69DF8A3ABC711FD59 /* secure_random_test.cc in Sources */, @@ -4333,6 +4369,7 @@ 54511E8E209805F8005BD28F /* hashing_test.cc in Sources */, B69CF3F12227386500B281C8 /* hashing_test_apple.mm in Sources */, 618BBEB020B89AAC00B5BCE7 /* http.pb.cc in Sources */, + 77D38E78F7CCB8504450A8FB /* index.pb.cc in Sources */, E6357221227031DD77EE5265 /* index_manager_test.cc in Sources */, 54A0353520A3D8CB003E0143 /* iterator_adaptors_test.cc in Sources */, 618BBEAE20B89AAC00B5BCE7 /* latlng.pb.cc in Sources */, @@ -4383,6 +4420,7 @@ 132E3483789344640A52F223 /* reference_set_test.cc in Sources */, F950A371FADCA2F0B73683E0 /* remote_document_cache_test.cc in Sources */, 59880AE766F7FBFF0C41A94E /* remote_event_test.cc in Sources */, + 224496E752E42E220F809FAC /* resource.pb.cc in Sources */, B686F2B22025000D0028D6BE /* resource_path_test.cc in Sources */, 8A76A3A8345B984C91B0843E /* schedule_test.cc in Sources */, 54740A571FC914BA00713A1A /* secure_random_test.cc in Sources */, @@ -4558,6 +4596,7 @@ 46683E00E0119595555018AB /* hashing_test.cc in Sources */, 433474A3416B76645FFD17BB /* hashing_test_apple.mm in Sources */, 06A3926F89C847846BE4D6BE /* http.pb.cc in Sources */, + 78E8DDDBE131F3DA9AF9F8B8 /* index.pb.cc in Sources */, 2B4234B962625F9EE68B31AC /* index_manager_test.cc in Sources */, 8A79DDB4379A063C30A76329 /* iterator_adaptors_test.cc in Sources */, 23C04A637090E438461E4E70 /* latlng.pb.cc in Sources */, @@ -4608,6 +4647,7 @@ B921A4F35B58925D958DD9A6 /* reference_set_test.cc in Sources */, E2AE851F9DC4C037CCD05E36 /* remote_document_cache_test.cc in Sources */, AD35AA07F973934BA30C9000 /* remote_event_test.cc in Sources */, + 32A635B2EBF461CE7A7B5C31 /* resource.pb.cc in Sources */, 5DDEC1A08F13226271FE636E /* resource_path_test.cc in Sources */, 5FFDDAA9FBBBD14052D19EF4 /* schedule_test.cc in Sources */, 49DB9113178FAA52F14477B2 /* secure_random_test.cc in Sources */, diff --git a/Firestore/Protos/cpp/google/api/resource.pb.cc b/Firestore/Protos/cpp/google/api/resource.pb.cc new file mode 100644 index 00000000000..1b3e753d9be --- /dev/null +++ b/Firestore/Protos/cpp/google/api/resource.pb.cc @@ -0,0 +1,846 @@ +/* + * Copyright 2022 Google LLC + * + * 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. + */ + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/resource.proto + +#include "google/api/resource.pb.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +// @@protoc_insertion_point(includes) +#include +extern PROTOBUF_INTERNAL_EXPORT_google_2fapi_2fresource_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_ResourceDescriptor_google_2fapi_2fresource_2eproto; +extern PROTOBUF_INTERNAL_EXPORT_google_2fapi_2fresource_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_ResourceReference_google_2fapi_2fresource_2eproto; +namespace google { +namespace api { +class ResourceDescriptorDefaultTypeInternal { + public: + ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; +} _ResourceDescriptor_default_instance_; +class ResourceReferenceDefaultTypeInternal { + public: + ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; +} _ResourceReference_default_instance_; +} // namespace api +} // namespace google +static void InitDefaultsscc_info_ResourceDescriptor_google_2fapi_2fresource_2eproto() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + + { + void* ptr = &::google::api::_ResourceDescriptor_default_instance_; + new (ptr) ::google::api::ResourceDescriptor(); + ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); + } + ::google::api::ResourceDescriptor::InitAsDefaultInstance(); +} + +::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_ResourceDescriptor_google_2fapi_2fresource_2eproto = + {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_ResourceDescriptor_google_2fapi_2fresource_2eproto}, {}}; + +static void InitDefaultsscc_info_ResourceReference_google_2fapi_2fresource_2eproto() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + + { + void* ptr = &::google::api::_ResourceReference_default_instance_; + new (ptr) ::google::api::ResourceReference(); + ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); + } + ::google::api::ResourceReference::InitAsDefaultInstance(); +} + +::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_ResourceReference_google_2fapi_2fresource_2eproto = + {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_ResourceReference_google_2fapi_2fresource_2eproto}, {}}; + +static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fapi_2fresource_2eproto[2]; +static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptors_google_2fapi_2fresource_2eproto[1]; +static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fapi_2fresource_2eproto = nullptr; + +const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fapi_2fresource_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::google::api::ResourceDescriptor, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + PROTOBUF_FIELD_OFFSET(::google::api::ResourceDescriptor, type_), + PROTOBUF_FIELD_OFFSET(::google::api::ResourceDescriptor, pattern_), + PROTOBUF_FIELD_OFFSET(::google::api::ResourceDescriptor, name_field_), + PROTOBUF_FIELD_OFFSET(::google::api::ResourceDescriptor, history_), + PROTOBUF_FIELD_OFFSET(::google::api::ResourceDescriptor, plural_), + PROTOBUF_FIELD_OFFSET(::google::api::ResourceDescriptor, singular_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::google::api::ResourceReference, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + PROTOBUF_FIELD_OFFSET(::google::api::ResourceReference, type_), + PROTOBUF_FIELD_OFFSET(::google::api::ResourceReference, child_type_), +}; +static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + { 0, -1, sizeof(::google::api::ResourceDescriptor)}, + { 11, -1, sizeof(::google::api::ResourceReference)}, +}; + +static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { + reinterpret_cast(&::google::api::_ResourceDescriptor_default_instance_), + reinterpret_cast(&::google::api::_ResourceReference_default_instance_), +}; + +const char descriptor_table_protodef_google_2fapi_2fresource_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = + "\n\031google/api/resource.proto\022\ngoogle.api\032" + " google/protobuf/descriptor.proto\"\377\001\n\022Re" + "sourceDescriptor\022\014\n\004type\030\001 \001(\t\022\017\n\007patter" + "n\030\002 \003(\t\022\022\n\nname_field\030\003 \001(\t\0227\n\007history\030\004" + " \001(\0162&.google.api.ResourceDescriptor.His" + "tory\022\016\n\006plural\030\005 \001(\t\022\020\n\010singular\030\006 \001(\t\"[" + "\n\007History\022\027\n\023HISTORY_UNSPECIFIED\020\000\022\035\n\031OR" + "IGINALLY_SINGLE_PATTERN\020\001\022\030\n\024FUTURE_MULT" + "I_PATTERN\020\002\"5\n\021ResourceReference\022\014\n\004type" + "\030\001 \001(\t\022\022\n\nchild_type\030\002 \001(\t:Y\n\022resource_r" + "eference\022\035.google.protobuf.FieldOptions\030" + "\237\010 \001(\0132\035.google.api.ResourceReference:Z\n" + "\023resource_definition\022\034.google.protobuf.F" + "ileOptions\030\235\010 \003(\0132\036.google.api.ResourceD" + "escriptor:R\n\010resource\022\037.google.protobuf." + "MessageOptions\030\235\010 \001(\0132\036.google.api.Resou" + "rceDescriptorBn\n\016com.google.apiB\rResourc" + "eProtoP\001ZAgoogle.golang.org/genproto/goo" + "gleapis/api/annotations;annotations\370\001\001\242\002" + "\004GAPIb\006proto3" + ; +static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_google_2fapi_2fresource_2eproto_deps[1] = { + &::descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, +}; +static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_google_2fapi_2fresource_2eproto_sccs[2] = { + &scc_info_ResourceDescriptor_google_2fapi_2fresource_2eproto.base, + &scc_info_ResourceReference_google_2fapi_2fresource_2eproto.base, +}; +static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_google_2fapi_2fresource_2eproto_once; +static bool descriptor_table_google_2fapi_2fresource_2eproto_initialized = false; +const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fapi_2fresource_2eproto = { + &descriptor_table_google_2fapi_2fresource_2eproto_initialized, descriptor_table_protodef_google_2fapi_2fresource_2eproto, "google/api/resource.proto", 773, + &descriptor_table_google_2fapi_2fresource_2eproto_once, descriptor_table_google_2fapi_2fresource_2eproto_sccs, descriptor_table_google_2fapi_2fresource_2eproto_deps, 2, 1, + schemas, file_default_instances, TableStruct_google_2fapi_2fresource_2eproto::offsets, + file_level_metadata_google_2fapi_2fresource_2eproto, 2, file_level_enum_descriptors_google_2fapi_2fresource_2eproto, file_level_service_descriptors_google_2fapi_2fresource_2eproto, +}; + +// Force running AddDescriptors() at dynamic initialization time. +static bool dynamic_init_dummy_google_2fapi_2fresource_2eproto = ( ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_google_2fapi_2fresource_2eproto), true); +namespace google { +namespace api { +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* ResourceDescriptor_History_descriptor() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_google_2fapi_2fresource_2eproto); + return file_level_enum_descriptors_google_2fapi_2fresource_2eproto[0]; +} +bool ResourceDescriptor_History_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + return true; + default: + return false; + } +} + +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) +constexpr ResourceDescriptor_History ResourceDescriptor::HISTORY_UNSPECIFIED; +constexpr ResourceDescriptor_History ResourceDescriptor::ORIGINALLY_SINGLE_PATTERN; +constexpr ResourceDescriptor_History ResourceDescriptor::FUTURE_MULTI_PATTERN; +constexpr ResourceDescriptor_History ResourceDescriptor::History_MIN; +constexpr ResourceDescriptor_History ResourceDescriptor::History_MAX; +constexpr int ResourceDescriptor::History_ARRAYSIZE; +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) + +// =================================================================== + +void ResourceDescriptor::InitAsDefaultInstance() { +} +class ResourceDescriptor::_Internal { + public: +}; + +ResourceDescriptor::ResourceDescriptor() + : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.api.ResourceDescriptor) +} +ResourceDescriptor::ResourceDescriptor(::PROTOBUF_NAMESPACE_ID::Arena* arena) + : ::PROTOBUF_NAMESPACE_ID::Message(), + _internal_metadata_(arena), + pattern_(arena) { + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:google.api.ResourceDescriptor) +} +ResourceDescriptor::ResourceDescriptor(const ResourceDescriptor& from) + : ::PROTOBUF_NAMESPACE_ID::Message(), + _internal_metadata_(nullptr), + pattern_(from.pattern_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_type().empty()) { + type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_type(), + GetArenaNoVirtual()); + } + name_field_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_name_field().empty()) { + name_field_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_name_field(), + GetArenaNoVirtual()); + } + plural_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_plural().empty()) { + plural_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_plural(), + GetArenaNoVirtual()); + } + singular_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_singular().empty()) { + singular_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_singular(), + GetArenaNoVirtual()); + } + history_ = from.history_; + // @@protoc_insertion_point(copy_constructor:google.api.ResourceDescriptor) +} + +void ResourceDescriptor::SharedCtor() { + ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_ResourceDescriptor_google_2fapi_2fresource_2eproto.base); + type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + name_field_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + plural_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + singular_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + history_ = 0; +} + +ResourceDescriptor::~ResourceDescriptor() { + // @@protoc_insertion_point(destructor:google.api.ResourceDescriptor) + SharedDtor(); +} + +void ResourceDescriptor::SharedDtor() { + GOOGLE_DCHECK(GetArenaNoVirtual() == nullptr); + type_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + name_field_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + plural_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + singular_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void ResourceDescriptor::ArenaDtor(void* object) { + ResourceDescriptor* _this = reinterpret_cast< ResourceDescriptor* >(object); + (void)_this; +} +void ResourceDescriptor::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void ResourceDescriptor::SetCachedSize(int size) const { + _cached_size_.Set(size); +} +const ResourceDescriptor& ResourceDescriptor::default_instance() { + ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_ResourceDescriptor_google_2fapi_2fresource_2eproto.base); + return *internal_default_instance(); +} + + +void ResourceDescriptor::Clear() { +// @@protoc_insertion_point(message_clear_start:google.api.ResourceDescriptor) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + pattern_.Clear(); + type_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); + name_field_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); + plural_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); + singular_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); + history_ = 0; + _internal_metadata_.Clear(); +} + +const char* ResourceDescriptor::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + CHK_(ptr); + switch (tag >> 3) { + // string type = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + auto str = _internal_mutable_type(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.api.ResourceDescriptor.type")); + CHK_(ptr); + } else goto handle_unusual; + continue; + // repeated string pattern = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + ptr -= 1; + do { + ptr += 1; + auto str = _internal_add_pattern(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.api.ResourceDescriptor.pattern")); + CHK_(ptr); + if (!ctx->DataAvailable(ptr)) break; + } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr)); + } else goto handle_unusual; + continue; + // string name_field = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { + auto str = _internal_mutable_name_field(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.api.ResourceDescriptor.name_field")); + CHK_(ptr); + } else goto handle_unusual; + continue; + // .google.api.ResourceDescriptor.History history = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) { + ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); + CHK_(ptr); + _internal_set_history(static_cast<::google::api::ResourceDescriptor_History>(val)); + } else goto handle_unusual; + continue; + // string plural = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) { + auto str = _internal_mutable_plural(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.api.ResourceDescriptor.plural")); + CHK_(ptr); + } else goto handle_unusual; + continue; + // string singular = 6; + case 6: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) { + auto str = _internal_mutable_singular(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.api.ResourceDescriptor.singular")); + CHK_(ptr); + } 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_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* ResourceDescriptor::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:google.api.ResourceDescriptor) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // string type = 1; + if (this->type().size() > 0) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_type().data(), static_cast(this->_internal_type().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "google.api.ResourceDescriptor.type"); + target = stream->WriteStringMaybeAliased( + 1, this->_internal_type(), target); + } + + // repeated string pattern = 2; + for (int i = 0, n = this->_internal_pattern_size(); i < n; i++) { + const auto& s = this->_internal_pattern(i); + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + s.data(), static_cast(s.length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "google.api.ResourceDescriptor.pattern"); + target = stream->WriteString(2, s, target); + } + + // string name_field = 3; + if (this->name_field().size() > 0) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_name_field().data(), static_cast(this->_internal_name_field().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "google.api.ResourceDescriptor.name_field"); + target = stream->WriteStringMaybeAliased( + 3, this->_internal_name_field(), target); + } + + // .google.api.ResourceDescriptor.History history = 4; + if (this->history() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 4, this->_internal_history(), target); + } + + // string plural = 5; + if (this->plural().size() > 0) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_plural().data(), static_cast(this->_internal_plural().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "google.api.ResourceDescriptor.plural"); + target = stream->WriteStringMaybeAliased( + 5, this->_internal_plural(), target); + } + + // string singular = 6; + if (this->singular().size() > 0) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_singular().data(), static_cast(this->_internal_singular().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "google.api.ResourceDescriptor.singular"); + target = stream->WriteStringMaybeAliased( + 6, this->_internal_singular(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields(), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.api.ResourceDescriptor) + return target; +} + +size_t ResourceDescriptor::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:google.api.ResourceDescriptor) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // repeated string pattern = 2; + total_size += 1 * + ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(pattern_.size()); + for (int i = 0, n = pattern_.size(); i < n; i++) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + pattern_.Get(i)); + } + + // string type = 1; + if (this->type().size() > 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_type()); + } + + // string name_field = 3; + if (this->name_field().size() > 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_name_field()); + } + + // string plural = 5; + if (this->plural().size() > 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_plural()); + } + + // string singular = 6; + if (this->singular().size() > 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_singular()); + } + + // .google.api.ResourceDescriptor.History history = 4; + if (this->history() != 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_history()); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( + _internal_metadata_, total_size, &_cached_size_); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void ResourceDescriptor::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:google.api.ResourceDescriptor) + GOOGLE_DCHECK_NE(&from, this); + const ResourceDescriptor* source = + ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( + &from); + if (source == nullptr) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.api.ResourceDescriptor) + ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); + } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:google.api.ResourceDescriptor) + MergeFrom(*source); + } +} + +void ResourceDescriptor::MergeFrom(const ResourceDescriptor& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:google.api.ResourceDescriptor) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + pattern_.MergeFrom(from.pattern_); + if (from.type().size() > 0) { + _internal_set_type(from._internal_type()); + } + if (from.name_field().size() > 0) { + _internal_set_name_field(from._internal_name_field()); + } + if (from.plural().size() > 0) { + _internal_set_plural(from._internal_plural()); + } + if (from.singular().size() > 0) { + _internal_set_singular(from._internal_singular()); + } + if (from.history() != 0) { + _internal_set_history(from._internal_history()); + } +} + +void ResourceDescriptor::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:google.api.ResourceDescriptor) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void ResourceDescriptor::CopyFrom(const ResourceDescriptor& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:google.api.ResourceDescriptor) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ResourceDescriptor::IsInitialized() const { + return true; +} + +void ResourceDescriptor::InternalSwap(ResourceDescriptor* other) { + using std::swap; + _internal_metadata_.Swap(&other->_internal_metadata_); + pattern_.InternalSwap(&other->pattern_); + type_.Swap(&other->type_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); + name_field_.Swap(&other->name_field_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); + plural_.Swap(&other->plural_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); + singular_.Swap(&other->singular_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); + swap(history_, other->history_); +} + +::PROTOBUF_NAMESPACE_ID::Metadata ResourceDescriptor::GetMetadata() const { + return GetMetadataStatic(); +} + + +// =================================================================== + +void ResourceReference::InitAsDefaultInstance() { +} +class ResourceReference::_Internal { + public: +}; + +ResourceReference::ResourceReference() + : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.api.ResourceReference) +} +ResourceReference::ResourceReference(::PROTOBUF_NAMESPACE_ID::Arena* arena) + : ::PROTOBUF_NAMESPACE_ID::Message(), + _internal_metadata_(arena) { + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:google.api.ResourceReference) +} +ResourceReference::ResourceReference(const ResourceReference& from) + : ::PROTOBUF_NAMESPACE_ID::Message(), + _internal_metadata_(nullptr) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_type().empty()) { + type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_type(), + GetArenaNoVirtual()); + } + child_type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_child_type().empty()) { + child_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_child_type(), + GetArenaNoVirtual()); + } + // @@protoc_insertion_point(copy_constructor:google.api.ResourceReference) +} + +void ResourceReference::SharedCtor() { + ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_ResourceReference_google_2fapi_2fresource_2eproto.base); + type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + child_type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +ResourceReference::~ResourceReference() { + // @@protoc_insertion_point(destructor:google.api.ResourceReference) + SharedDtor(); +} + +void ResourceReference::SharedDtor() { + GOOGLE_DCHECK(GetArenaNoVirtual() == nullptr); + type_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + child_type_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void ResourceReference::ArenaDtor(void* object) { + ResourceReference* _this = reinterpret_cast< ResourceReference* >(object); + (void)_this; +} +void ResourceReference::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void ResourceReference::SetCachedSize(int size) const { + _cached_size_.Set(size); +} +const ResourceReference& ResourceReference::default_instance() { + ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_ResourceReference_google_2fapi_2fresource_2eproto.base); + return *internal_default_instance(); +} + + +void ResourceReference::Clear() { +// @@protoc_insertion_point(message_clear_start:google.api.ResourceReference) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + type_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); + child_type_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); + _internal_metadata_.Clear(); +} + +const char* ResourceReference::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + CHK_(ptr); + switch (tag >> 3) { + // string type = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + auto str = _internal_mutable_type(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.api.ResourceReference.type")); + CHK_(ptr); + } else goto handle_unusual; + continue; + // string child_type = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + auto str = _internal_mutable_child_type(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.api.ResourceReference.child_type")); + CHK_(ptr); + } 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_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* ResourceReference::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:google.api.ResourceReference) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // string type = 1; + if (this->type().size() > 0) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_type().data(), static_cast(this->_internal_type().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "google.api.ResourceReference.type"); + target = stream->WriteStringMaybeAliased( + 1, this->_internal_type(), target); + } + + // string child_type = 2; + if (this->child_type().size() > 0) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_child_type().data(), static_cast(this->_internal_child_type().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "google.api.ResourceReference.child_type"); + target = stream->WriteStringMaybeAliased( + 2, this->_internal_child_type(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields(), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.api.ResourceReference) + return target; +} + +size_t ResourceReference::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:google.api.ResourceReference) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // string type = 1; + if (this->type().size() > 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_type()); + } + + // string child_type = 2; + if (this->child_type().size() > 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_child_type()); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( + _internal_metadata_, total_size, &_cached_size_); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void ResourceReference::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:google.api.ResourceReference) + GOOGLE_DCHECK_NE(&from, this); + const ResourceReference* source = + ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( + &from); + if (source == nullptr) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.api.ResourceReference) + ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); + } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:google.api.ResourceReference) + MergeFrom(*source); + } +} + +void ResourceReference::MergeFrom(const ResourceReference& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:google.api.ResourceReference) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (from.type().size() > 0) { + _internal_set_type(from._internal_type()); + } + if (from.child_type().size() > 0) { + _internal_set_child_type(from._internal_child_type()); + } +} + +void ResourceReference::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:google.api.ResourceReference) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void ResourceReference::CopyFrom(const ResourceReference& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:google.api.ResourceReference) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ResourceReference::IsInitialized() const { + return true; +} + +void ResourceReference::InternalSwap(ResourceReference* other) { + using std::swap; + _internal_metadata_.Swap(&other->_internal_metadata_); + type_.Swap(&other->type_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); + child_type_.Swap(&other->child_type_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} + +::PROTOBUF_NAMESPACE_ID::Metadata ResourceReference::GetMetadata() const { + return GetMetadataStatic(); +} + +::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< ::google::protobuf::FieldOptions, + ::PROTOBUF_NAMESPACE_ID::internal::MessageTypeTraits< ::google::api::ResourceReference >, 11, false > + resource_reference(kResourceReferenceFieldNumber, *::google::api::ResourceReference::internal_default_instance()); +::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< ::google::protobuf::FileOptions, + ::PROTOBUF_NAMESPACE_ID::internal::RepeatedMessageTypeTraits< ::google::api::ResourceDescriptor >, 11, false > + resource_definition(kResourceDefinitionFieldNumber, *::google::api::ResourceDescriptor::internal_default_instance()); +::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< ::google::protobuf::MessageOptions, + ::PROTOBUF_NAMESPACE_ID::internal::MessageTypeTraits< ::google::api::ResourceDescriptor >, 11, false > + resource(kResourceFieldNumber, *::google::api::ResourceDescriptor::internal_default_instance()); + +// @@protoc_insertion_point(namespace_scope) +} // namespace api +} // namespace google +PROTOBUF_NAMESPACE_OPEN +template<> PROTOBUF_NOINLINE ::google::api::ResourceDescriptor* Arena::CreateMaybeMessage< ::google::api::ResourceDescriptor >(Arena* arena) { + return Arena::CreateMessageInternal< ::google::api::ResourceDescriptor >(arena); +} +template<> PROTOBUF_NOINLINE ::google::api::ResourceReference* Arena::CreateMaybeMessage< ::google::api::ResourceReference >(Arena* arena) { + return Arena::CreateMessageInternal< ::google::api::ResourceReference >(arena); +} +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) +#include diff --git a/Firestore/Protos/cpp/google/api/resource.pb.h b/Firestore/Protos/cpp/google/api/resource.pb.h new file mode 100644 index 00000000000..a3b90add025 --- /dev/null +++ b/Firestore/Protos/cpp/google/api/resource.pb.h @@ -0,0 +1,1266 @@ +/* + * Copyright 2022 Google LLC + * + * 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. + */ + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/resource.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_google_2fapi_2fresource_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_google_2fapi_2fresource_2eproto + +#include +#include + +#include +#if PROTOBUF_VERSION < 3011000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3011002 < 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 regenerate this file with a newer version of protoc. +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // IWYU pragma: export +#include // IWYU pragma: export +#include +#include +#include +// @@protoc_insertion_point(includes) +#include +#define PROTOBUF_INTERNAL_EXPORT_google_2fapi_2fresource_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE + +// Internal implementation detail -- do not use these members. +struct TableStruct_google_2fapi_2fresource_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[]; +}; +extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fapi_2fresource_2eproto; +namespace google { +namespace api { +class ResourceDescriptor; +class ResourceDescriptorDefaultTypeInternal; +extern ResourceDescriptorDefaultTypeInternal _ResourceDescriptor_default_instance_; +class ResourceReference; +class ResourceReferenceDefaultTypeInternal; +extern ResourceReferenceDefaultTypeInternal _ResourceReference_default_instance_; +} // namespace api +} // namespace google +PROTOBUF_NAMESPACE_OPEN +template<> ::google::api::ResourceDescriptor* Arena::CreateMaybeMessage<::google::api::ResourceDescriptor>(Arena*); +template<> ::google::api::ResourceReference* Arena::CreateMaybeMessage<::google::api::ResourceReference>(Arena*); +PROTOBUF_NAMESPACE_CLOSE +namespace google { +namespace api { + +enum ResourceDescriptor_History : int { + ResourceDescriptor_History_HISTORY_UNSPECIFIED = 0, + ResourceDescriptor_History_ORIGINALLY_SINGLE_PATTERN = 1, + ResourceDescriptor_History_FUTURE_MULTI_PATTERN = 2, + ResourceDescriptor_History_ResourceDescriptor_History_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(), + ResourceDescriptor_History_ResourceDescriptor_History_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max() +}; +bool ResourceDescriptor_History_IsValid(int value); +constexpr ResourceDescriptor_History ResourceDescriptor_History_History_MIN = ResourceDescriptor_History_HISTORY_UNSPECIFIED; +constexpr ResourceDescriptor_History ResourceDescriptor_History_History_MAX = ResourceDescriptor_History_FUTURE_MULTI_PATTERN; +constexpr int ResourceDescriptor_History_History_ARRAYSIZE = ResourceDescriptor_History_History_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* ResourceDescriptor_History_descriptor(); +template +inline const std::string& ResourceDescriptor_History_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function ResourceDescriptor_History_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + ResourceDescriptor_History_descriptor(), enum_t_value); +} +inline bool ResourceDescriptor_History_Parse( + const std::string& name, ResourceDescriptor_History* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + ResourceDescriptor_History_descriptor(), name, value); +} +// =================================================================== + +class ResourceDescriptor : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.api.ResourceDescriptor) */ { + public: + ResourceDescriptor(); + virtual ~ResourceDescriptor(); + + ResourceDescriptor(const ResourceDescriptor& from); + ResourceDescriptor(ResourceDescriptor&& from) noexcept + : ResourceDescriptor() { + *this = ::std::move(from); + } + + inline ResourceDescriptor& operator=(const ResourceDescriptor& from) { + CopyFrom(from); + return *this; + } + inline ResourceDescriptor& operator=(ResourceDescriptor&& from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArena() const final { + return GetArenaNoVirtual(); + } + inline void* GetMaybeArenaPointer() const final { + return MaybeArenaPtr(); + } + 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 ResourceDescriptor& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const ResourceDescriptor* internal_default_instance() { + return reinterpret_cast( + &_ResourceDescriptor_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(ResourceDescriptor& a, ResourceDescriptor& b) { + a.Swap(&b); + } + inline void Swap(ResourceDescriptor* other) { + if (other == this) return; + if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ResourceDescriptor* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline ResourceDescriptor* New() const final { + return CreateMaybeMessage(nullptr); + } + + ResourceDescriptor* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const ResourceDescriptor& from); + void MergeFrom(const ResourceDescriptor& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(ResourceDescriptor* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "google.api.ResourceDescriptor"; + } + protected: + explicit ResourceDescriptor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_google_2fapi_2fresource_2eproto); + return ::descriptor_table_google_2fapi_2fresource_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + typedef ResourceDescriptor_History History; + static constexpr History HISTORY_UNSPECIFIED = + ResourceDescriptor_History_HISTORY_UNSPECIFIED; + static constexpr History ORIGINALLY_SINGLE_PATTERN = + ResourceDescriptor_History_ORIGINALLY_SINGLE_PATTERN; + static constexpr History FUTURE_MULTI_PATTERN = + ResourceDescriptor_History_FUTURE_MULTI_PATTERN; + static inline bool History_IsValid(int value) { + return ResourceDescriptor_History_IsValid(value); + } + static constexpr History History_MIN = + ResourceDescriptor_History_History_MIN; + static constexpr History History_MAX = + ResourceDescriptor_History_History_MAX; + static constexpr int History_ARRAYSIZE = + ResourceDescriptor_History_History_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + History_descriptor() { + return ResourceDescriptor_History_descriptor(); + } + template + static inline const std::string& History_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function History_Name."); + return ResourceDescriptor_History_Name(enum_t_value); + } + static inline bool History_Parse(const std::string& name, + History* value) { + return ResourceDescriptor_History_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kPatternFieldNumber = 2, + kTypeFieldNumber = 1, + kNameFieldFieldNumber = 3, + kPluralFieldNumber = 5, + kSingularFieldNumber = 6, + kHistoryFieldNumber = 4, + }; + // repeated string pattern = 2; + int pattern_size() const; + private: + int _internal_pattern_size() const; + public: + void clear_pattern(); + const std::string& pattern(int index) const; + std::string* mutable_pattern(int index); + void set_pattern(int index, const std::string& value); + void set_pattern(int index, std::string&& value); + void set_pattern(int index, const char* value); + void set_pattern(int index, const char* value, size_t size); + std::string* add_pattern(); + void add_pattern(const std::string& value); + void add_pattern(std::string&& value); + void add_pattern(const char* value); + void add_pattern(const char* value, size_t size); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& pattern() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* mutable_pattern(); + private: + const std::string& _internal_pattern(int index) const; + std::string* _internal_add_pattern(); + public: + + // string type = 1; + void clear_type(); + const std::string& type() const; + void set_type(const std::string& value); + void set_type(std::string&& value); + void set_type(const char* value); + void set_type(const char* value, size_t size); + std::string* mutable_type(); + std::string* release_type(); + void set_allocated_type(std::string* type); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_type(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_type( + std::string* type); + private: + const std::string& _internal_type() const; + void _internal_set_type(const std::string& value); + std::string* _internal_mutable_type(); + public: + + // string name_field = 3; + void clear_name_field(); + const std::string& name_field() const; + void set_name_field(const std::string& value); + void set_name_field(std::string&& value); + void set_name_field(const char* value); + void set_name_field(const char* value, size_t size); + std::string* mutable_name_field(); + std::string* release_name_field(); + void set_allocated_name_field(std::string* name_field); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_name_field(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_name_field( + std::string* name_field); + private: + const std::string& _internal_name_field() const; + void _internal_set_name_field(const std::string& value); + std::string* _internal_mutable_name_field(); + public: + + // string plural = 5; + void clear_plural(); + const std::string& plural() const; + void set_plural(const std::string& value); + void set_plural(std::string&& value); + void set_plural(const char* value); + void set_plural(const char* value, size_t size); + std::string* mutable_plural(); + std::string* release_plural(); + void set_allocated_plural(std::string* plural); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_plural(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_plural( + std::string* plural); + private: + const std::string& _internal_plural() const; + void _internal_set_plural(const std::string& value); + std::string* _internal_mutable_plural(); + public: + + // string singular = 6; + void clear_singular(); + const std::string& singular() const; + void set_singular(const std::string& value); + void set_singular(std::string&& value); + void set_singular(const char* value); + void set_singular(const char* value, size_t size); + std::string* mutable_singular(); + std::string* release_singular(); + void set_allocated_singular(std::string* singular); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_singular(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_singular( + std::string* singular); + private: + const std::string& _internal_singular() const; + void _internal_set_singular(const std::string& value); + std::string* _internal_mutable_singular(); + public: + + // .google.api.ResourceDescriptor.History history = 4; + void clear_history(); + ::google::api::ResourceDescriptor_History history() const; + void set_history(::google::api::ResourceDescriptor_History value); + private: + ::google::api::ResourceDescriptor_History _internal_history() const; + void _internal_set_history(::google::api::ResourceDescriptor_History value); + public: + + // @@protoc_insertion_point(class_scope:google.api.ResourceDescriptor) + private: + class _Internal; + + ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_; + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField pattern_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr type_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_field_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr plural_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr singular_; + int history_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_google_2fapi_2fresource_2eproto; +}; +// ------------------------------------------------------------------- + +class ResourceReference : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.api.ResourceReference) */ { + public: + ResourceReference(); + virtual ~ResourceReference(); + + ResourceReference(const ResourceReference& from); + ResourceReference(ResourceReference&& from) noexcept + : ResourceReference() { + *this = ::std::move(from); + } + + inline ResourceReference& operator=(const ResourceReference& from) { + CopyFrom(from); + return *this; + } + inline ResourceReference& operator=(ResourceReference&& from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArena() const final { + return GetArenaNoVirtual(); + } + inline void* GetMaybeArenaPointer() const final { + return MaybeArenaPtr(); + } + 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 ResourceReference& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const ResourceReference* internal_default_instance() { + return reinterpret_cast( + &_ResourceReference_default_instance_); + } + static constexpr int kIndexInFileMessages = + 1; + + friend void swap(ResourceReference& a, ResourceReference& b) { + a.Swap(&b); + } + inline void Swap(ResourceReference* other) { + if (other == this) return; + if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ResourceReference* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline ResourceReference* New() const final { + return CreateMaybeMessage(nullptr); + } + + ResourceReference* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const ResourceReference& from); + void MergeFrom(const ResourceReference& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(ResourceReference* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "google.api.ResourceReference"; + } + protected: + explicit ResourceReference(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_google_2fapi_2fresource_2eproto); + return ::descriptor_table_google_2fapi_2fresource_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kTypeFieldNumber = 1, + kChildTypeFieldNumber = 2, + }; + // string type = 1; + void clear_type(); + const std::string& type() const; + void set_type(const std::string& value); + void set_type(std::string&& value); + void set_type(const char* value); + void set_type(const char* value, size_t size); + std::string* mutable_type(); + std::string* release_type(); + void set_allocated_type(std::string* type); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_type(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_type( + std::string* type); + private: + const std::string& _internal_type() const; + void _internal_set_type(const std::string& value); + std::string* _internal_mutable_type(); + public: + + // string child_type = 2; + void clear_child_type(); + const std::string& child_type() const; + void set_child_type(const std::string& value); + void set_child_type(std::string&& value); + void set_child_type(const char* value); + void set_child_type(const char* value, size_t size); + std::string* mutable_child_type(); + std::string* release_child_type(); + void set_allocated_child_type(std::string* child_type); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_child_type(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_child_type( + std::string* child_type); + private: + const std::string& _internal_child_type() const; + void _internal_set_child_type(const std::string& value); + std::string* _internal_mutable_child_type(); + public: + + // @@protoc_insertion_point(class_scope:google.api.ResourceReference) + private: + class _Internal; + + ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_; + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr type_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr child_type_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_google_2fapi_2fresource_2eproto; +}; +// =================================================================== + +static const int kResourceReferenceFieldNumber = 1055; +extern ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< ::google::protobuf::FieldOptions, + ::PROTOBUF_NAMESPACE_ID::internal::MessageTypeTraits< ::google::api::ResourceReference >, 11, false > + resource_reference; +static const int kResourceDefinitionFieldNumber = 1053; +extern ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< ::google::protobuf::FileOptions, + ::PROTOBUF_NAMESPACE_ID::internal::RepeatedMessageTypeTraits< ::google::api::ResourceDescriptor >, 11, false > + resource_definition; +static const int kResourceFieldNumber = 1053; +extern ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< ::google::protobuf::MessageOptions, + ::PROTOBUF_NAMESPACE_ID::internal::MessageTypeTraits< ::google::api::ResourceDescriptor >, 11, false > + resource; + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// ResourceDescriptor + +// string type = 1; +inline void ResourceDescriptor::clear_type() { + type_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); +} +inline const std::string& ResourceDescriptor::type() const { + // @@protoc_insertion_point(field_get:google.api.ResourceDescriptor.type) + return _internal_type(); +} +inline void ResourceDescriptor::set_type(const std::string& value) { + _internal_set_type(value); + // @@protoc_insertion_point(field_set:google.api.ResourceDescriptor.type) +} +inline std::string* ResourceDescriptor::mutable_type() { + // @@protoc_insertion_point(field_mutable:google.api.ResourceDescriptor.type) + return _internal_mutable_type(); +} +inline const std::string& ResourceDescriptor::_internal_type() const { + return type_.Get(); +} +inline void ResourceDescriptor::_internal_set_type(const std::string& value) { + + type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); +} +inline void ResourceDescriptor::set_type(std::string&& value) { + + type_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); + // @@protoc_insertion_point(field_set_rvalue:google.api.ResourceDescriptor.type) +} +inline void ResourceDescriptor::set_type(const char* value) { + GOOGLE_DCHECK(value != nullptr); + + type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); + // @@protoc_insertion_point(field_set_char:google.api.ResourceDescriptor.type) +} +inline void ResourceDescriptor::set_type(const char* value, + size_t size) { + + type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArenaNoVirtual()); + // @@protoc_insertion_point(field_set_pointer:google.api.ResourceDescriptor.type) +} +inline std::string* ResourceDescriptor::_internal_mutable_type() { + + return type_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); +} +inline std::string* ResourceDescriptor::release_type() { + // @@protoc_insertion_point(field_release:google.api.ResourceDescriptor.type) + + return type_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); +} +inline void ResourceDescriptor::set_allocated_type(std::string* type) { + if (type != nullptr) { + + } else { + + } + type_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), type, + GetArenaNoVirtual()); + // @@protoc_insertion_point(field_set_allocated:google.api.ResourceDescriptor.type) +} +inline std::string* ResourceDescriptor::unsafe_arena_release_type() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.api.ResourceDescriptor.type) + GOOGLE_DCHECK(GetArenaNoVirtual() != nullptr); + + return type_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void ResourceDescriptor::unsafe_arena_set_allocated_type( + std::string* type) { + GOOGLE_DCHECK(GetArenaNoVirtual() != nullptr); + if (type != nullptr) { + + } else { + + } + type_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + type, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.api.ResourceDescriptor.type) +} + +// repeated string pattern = 2; +inline int ResourceDescriptor::_internal_pattern_size() const { + return pattern_.size(); +} +inline int ResourceDescriptor::pattern_size() const { + return _internal_pattern_size(); +} +inline void ResourceDescriptor::clear_pattern() { + pattern_.Clear(); +} +inline std::string* ResourceDescriptor::add_pattern() { + // @@protoc_insertion_point(field_add_mutable:google.api.ResourceDescriptor.pattern) + return _internal_add_pattern(); +} +inline const std::string& ResourceDescriptor::_internal_pattern(int index) const { + return pattern_.Get(index); +} +inline const std::string& ResourceDescriptor::pattern(int index) const { + // @@protoc_insertion_point(field_get:google.api.ResourceDescriptor.pattern) + return _internal_pattern(index); +} +inline std::string* ResourceDescriptor::mutable_pattern(int index) { + // @@protoc_insertion_point(field_mutable:google.api.ResourceDescriptor.pattern) + return pattern_.Mutable(index); +} +inline void ResourceDescriptor::set_pattern(int index, const std::string& value) { + // @@protoc_insertion_point(field_set:google.api.ResourceDescriptor.pattern) + pattern_.Mutable(index)->assign(value); +} +inline void ResourceDescriptor::set_pattern(int index, std::string&& value) { + // @@protoc_insertion_point(field_set:google.api.ResourceDescriptor.pattern) + pattern_.Mutable(index)->assign(std::move(value)); +} +inline void ResourceDescriptor::set_pattern(int index, const char* value) { + GOOGLE_DCHECK(value != nullptr); + pattern_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:google.api.ResourceDescriptor.pattern) +} +inline void ResourceDescriptor::set_pattern(int index, const char* value, size_t size) { + pattern_.Mutable(index)->assign( + reinterpret_cast(value), size); + // @@protoc_insertion_point(field_set_pointer:google.api.ResourceDescriptor.pattern) +} +inline std::string* ResourceDescriptor::_internal_add_pattern() { + return pattern_.Add(); +} +inline void ResourceDescriptor::add_pattern(const std::string& value) { + pattern_.Add()->assign(value); + // @@protoc_insertion_point(field_add:google.api.ResourceDescriptor.pattern) +} +inline void ResourceDescriptor::add_pattern(std::string&& value) { + pattern_.Add(std::move(value)); + // @@protoc_insertion_point(field_add:google.api.ResourceDescriptor.pattern) +} +inline void ResourceDescriptor::add_pattern(const char* value) { + GOOGLE_DCHECK(value != nullptr); + pattern_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:google.api.ResourceDescriptor.pattern) +} +inline void ResourceDescriptor::add_pattern(const char* value, size_t size) { + pattern_.Add()->assign(reinterpret_cast(value), size); + // @@protoc_insertion_point(field_add_pointer:google.api.ResourceDescriptor.pattern) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& +ResourceDescriptor::pattern() const { + // @@protoc_insertion_point(field_list:google.api.ResourceDescriptor.pattern) + return pattern_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* +ResourceDescriptor::mutable_pattern() { + // @@protoc_insertion_point(field_mutable_list:google.api.ResourceDescriptor.pattern) + return &pattern_; +} + +// string name_field = 3; +inline void ResourceDescriptor::clear_name_field() { + name_field_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); +} +inline const std::string& ResourceDescriptor::name_field() const { + // @@protoc_insertion_point(field_get:google.api.ResourceDescriptor.name_field) + return _internal_name_field(); +} +inline void ResourceDescriptor::set_name_field(const std::string& value) { + _internal_set_name_field(value); + // @@protoc_insertion_point(field_set:google.api.ResourceDescriptor.name_field) +} +inline std::string* ResourceDescriptor::mutable_name_field() { + // @@protoc_insertion_point(field_mutable:google.api.ResourceDescriptor.name_field) + return _internal_mutable_name_field(); +} +inline const std::string& ResourceDescriptor::_internal_name_field() const { + return name_field_.Get(); +} +inline void ResourceDescriptor::_internal_set_name_field(const std::string& value) { + + name_field_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); +} +inline void ResourceDescriptor::set_name_field(std::string&& value) { + + name_field_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); + // @@protoc_insertion_point(field_set_rvalue:google.api.ResourceDescriptor.name_field) +} +inline void ResourceDescriptor::set_name_field(const char* value) { + GOOGLE_DCHECK(value != nullptr); + + name_field_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); + // @@protoc_insertion_point(field_set_char:google.api.ResourceDescriptor.name_field) +} +inline void ResourceDescriptor::set_name_field(const char* value, + size_t size) { + + name_field_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArenaNoVirtual()); + // @@protoc_insertion_point(field_set_pointer:google.api.ResourceDescriptor.name_field) +} +inline std::string* ResourceDescriptor::_internal_mutable_name_field() { + + return name_field_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); +} +inline std::string* ResourceDescriptor::release_name_field() { + // @@protoc_insertion_point(field_release:google.api.ResourceDescriptor.name_field) + + return name_field_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); +} +inline void ResourceDescriptor::set_allocated_name_field(std::string* name_field) { + if (name_field != nullptr) { + + } else { + + } + name_field_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name_field, + GetArenaNoVirtual()); + // @@protoc_insertion_point(field_set_allocated:google.api.ResourceDescriptor.name_field) +} +inline std::string* ResourceDescriptor::unsafe_arena_release_name_field() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.api.ResourceDescriptor.name_field) + GOOGLE_DCHECK(GetArenaNoVirtual() != nullptr); + + return name_field_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void ResourceDescriptor::unsafe_arena_set_allocated_name_field( + std::string* name_field) { + GOOGLE_DCHECK(GetArenaNoVirtual() != nullptr); + if (name_field != nullptr) { + + } else { + + } + name_field_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + name_field, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.api.ResourceDescriptor.name_field) +} + +// .google.api.ResourceDescriptor.History history = 4; +inline void ResourceDescriptor::clear_history() { + history_ = 0; +} +inline ::google::api::ResourceDescriptor_History ResourceDescriptor::_internal_history() const { + return static_cast< ::google::api::ResourceDescriptor_History >(history_); +} +inline ::google::api::ResourceDescriptor_History ResourceDescriptor::history() const { + // @@protoc_insertion_point(field_get:google.api.ResourceDescriptor.history) + return _internal_history(); +} +inline void ResourceDescriptor::_internal_set_history(::google::api::ResourceDescriptor_History value) { + + history_ = value; +} +inline void ResourceDescriptor::set_history(::google::api::ResourceDescriptor_History value) { + _internal_set_history(value); + // @@protoc_insertion_point(field_set:google.api.ResourceDescriptor.history) +} + +// string plural = 5; +inline void ResourceDescriptor::clear_plural() { + plural_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); +} +inline const std::string& ResourceDescriptor::plural() const { + // @@protoc_insertion_point(field_get:google.api.ResourceDescriptor.plural) + return _internal_plural(); +} +inline void ResourceDescriptor::set_plural(const std::string& value) { + _internal_set_plural(value); + // @@protoc_insertion_point(field_set:google.api.ResourceDescriptor.plural) +} +inline std::string* ResourceDescriptor::mutable_plural() { + // @@protoc_insertion_point(field_mutable:google.api.ResourceDescriptor.plural) + return _internal_mutable_plural(); +} +inline const std::string& ResourceDescriptor::_internal_plural() const { + return plural_.Get(); +} +inline void ResourceDescriptor::_internal_set_plural(const std::string& value) { + + plural_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); +} +inline void ResourceDescriptor::set_plural(std::string&& value) { + + plural_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); + // @@protoc_insertion_point(field_set_rvalue:google.api.ResourceDescriptor.plural) +} +inline void ResourceDescriptor::set_plural(const char* value) { + GOOGLE_DCHECK(value != nullptr); + + plural_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); + // @@protoc_insertion_point(field_set_char:google.api.ResourceDescriptor.plural) +} +inline void ResourceDescriptor::set_plural(const char* value, + size_t size) { + + plural_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArenaNoVirtual()); + // @@protoc_insertion_point(field_set_pointer:google.api.ResourceDescriptor.plural) +} +inline std::string* ResourceDescriptor::_internal_mutable_plural() { + + return plural_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); +} +inline std::string* ResourceDescriptor::release_plural() { + // @@protoc_insertion_point(field_release:google.api.ResourceDescriptor.plural) + + return plural_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); +} +inline void ResourceDescriptor::set_allocated_plural(std::string* plural) { + if (plural != nullptr) { + + } else { + + } + plural_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), plural, + GetArenaNoVirtual()); + // @@protoc_insertion_point(field_set_allocated:google.api.ResourceDescriptor.plural) +} +inline std::string* ResourceDescriptor::unsafe_arena_release_plural() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.api.ResourceDescriptor.plural) + GOOGLE_DCHECK(GetArenaNoVirtual() != nullptr); + + return plural_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void ResourceDescriptor::unsafe_arena_set_allocated_plural( + std::string* plural) { + GOOGLE_DCHECK(GetArenaNoVirtual() != nullptr); + if (plural != nullptr) { + + } else { + + } + plural_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + plural, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.api.ResourceDescriptor.plural) +} + +// string singular = 6; +inline void ResourceDescriptor::clear_singular() { + singular_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); +} +inline const std::string& ResourceDescriptor::singular() const { + // @@protoc_insertion_point(field_get:google.api.ResourceDescriptor.singular) + return _internal_singular(); +} +inline void ResourceDescriptor::set_singular(const std::string& value) { + _internal_set_singular(value); + // @@protoc_insertion_point(field_set:google.api.ResourceDescriptor.singular) +} +inline std::string* ResourceDescriptor::mutable_singular() { + // @@protoc_insertion_point(field_mutable:google.api.ResourceDescriptor.singular) + return _internal_mutable_singular(); +} +inline const std::string& ResourceDescriptor::_internal_singular() const { + return singular_.Get(); +} +inline void ResourceDescriptor::_internal_set_singular(const std::string& value) { + + singular_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); +} +inline void ResourceDescriptor::set_singular(std::string&& value) { + + singular_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); + // @@protoc_insertion_point(field_set_rvalue:google.api.ResourceDescriptor.singular) +} +inline void ResourceDescriptor::set_singular(const char* value) { + GOOGLE_DCHECK(value != nullptr); + + singular_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); + // @@protoc_insertion_point(field_set_char:google.api.ResourceDescriptor.singular) +} +inline void ResourceDescriptor::set_singular(const char* value, + size_t size) { + + singular_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArenaNoVirtual()); + // @@protoc_insertion_point(field_set_pointer:google.api.ResourceDescriptor.singular) +} +inline std::string* ResourceDescriptor::_internal_mutable_singular() { + + return singular_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); +} +inline std::string* ResourceDescriptor::release_singular() { + // @@protoc_insertion_point(field_release:google.api.ResourceDescriptor.singular) + + return singular_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); +} +inline void ResourceDescriptor::set_allocated_singular(std::string* singular) { + if (singular != nullptr) { + + } else { + + } + singular_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), singular, + GetArenaNoVirtual()); + // @@protoc_insertion_point(field_set_allocated:google.api.ResourceDescriptor.singular) +} +inline std::string* ResourceDescriptor::unsafe_arena_release_singular() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.api.ResourceDescriptor.singular) + GOOGLE_DCHECK(GetArenaNoVirtual() != nullptr); + + return singular_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void ResourceDescriptor::unsafe_arena_set_allocated_singular( + std::string* singular) { + GOOGLE_DCHECK(GetArenaNoVirtual() != nullptr); + if (singular != nullptr) { + + } else { + + } + singular_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + singular, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.api.ResourceDescriptor.singular) +} + +// ------------------------------------------------------------------- + +// ResourceReference + +// string type = 1; +inline void ResourceReference::clear_type() { + type_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); +} +inline const std::string& ResourceReference::type() const { + // @@protoc_insertion_point(field_get:google.api.ResourceReference.type) + return _internal_type(); +} +inline void ResourceReference::set_type(const std::string& value) { + _internal_set_type(value); + // @@protoc_insertion_point(field_set:google.api.ResourceReference.type) +} +inline std::string* ResourceReference::mutable_type() { + // @@protoc_insertion_point(field_mutable:google.api.ResourceReference.type) + return _internal_mutable_type(); +} +inline const std::string& ResourceReference::_internal_type() const { + return type_.Get(); +} +inline void ResourceReference::_internal_set_type(const std::string& value) { + + type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); +} +inline void ResourceReference::set_type(std::string&& value) { + + type_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); + // @@protoc_insertion_point(field_set_rvalue:google.api.ResourceReference.type) +} +inline void ResourceReference::set_type(const char* value) { + GOOGLE_DCHECK(value != nullptr); + + type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); + // @@protoc_insertion_point(field_set_char:google.api.ResourceReference.type) +} +inline void ResourceReference::set_type(const char* value, + size_t size) { + + type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArenaNoVirtual()); + // @@protoc_insertion_point(field_set_pointer:google.api.ResourceReference.type) +} +inline std::string* ResourceReference::_internal_mutable_type() { + + return type_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); +} +inline std::string* ResourceReference::release_type() { + // @@protoc_insertion_point(field_release:google.api.ResourceReference.type) + + return type_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); +} +inline void ResourceReference::set_allocated_type(std::string* type) { + if (type != nullptr) { + + } else { + + } + type_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), type, + GetArenaNoVirtual()); + // @@protoc_insertion_point(field_set_allocated:google.api.ResourceReference.type) +} +inline std::string* ResourceReference::unsafe_arena_release_type() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.api.ResourceReference.type) + GOOGLE_DCHECK(GetArenaNoVirtual() != nullptr); + + return type_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void ResourceReference::unsafe_arena_set_allocated_type( + std::string* type) { + GOOGLE_DCHECK(GetArenaNoVirtual() != nullptr); + if (type != nullptr) { + + } else { + + } + type_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + type, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.api.ResourceReference.type) +} + +// string child_type = 2; +inline void ResourceReference::clear_child_type() { + child_type_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); +} +inline const std::string& ResourceReference::child_type() const { + // @@protoc_insertion_point(field_get:google.api.ResourceReference.child_type) + return _internal_child_type(); +} +inline void ResourceReference::set_child_type(const std::string& value) { + _internal_set_child_type(value); + // @@protoc_insertion_point(field_set:google.api.ResourceReference.child_type) +} +inline std::string* ResourceReference::mutable_child_type() { + // @@protoc_insertion_point(field_mutable:google.api.ResourceReference.child_type) + return _internal_mutable_child_type(); +} +inline const std::string& ResourceReference::_internal_child_type() const { + return child_type_.Get(); +} +inline void ResourceReference::_internal_set_child_type(const std::string& value) { + + child_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); +} +inline void ResourceReference::set_child_type(std::string&& value) { + + child_type_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); + // @@protoc_insertion_point(field_set_rvalue:google.api.ResourceReference.child_type) +} +inline void ResourceReference::set_child_type(const char* value) { + GOOGLE_DCHECK(value != nullptr); + + child_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); + // @@protoc_insertion_point(field_set_char:google.api.ResourceReference.child_type) +} +inline void ResourceReference::set_child_type(const char* value, + size_t size) { + + child_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArenaNoVirtual()); + // @@protoc_insertion_point(field_set_pointer:google.api.ResourceReference.child_type) +} +inline std::string* ResourceReference::_internal_mutable_child_type() { + + return child_type_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); +} +inline std::string* ResourceReference::release_child_type() { + // @@protoc_insertion_point(field_release:google.api.ResourceReference.child_type) + + return child_type_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); +} +inline void ResourceReference::set_allocated_child_type(std::string* child_type) { + if (child_type != nullptr) { + + } else { + + } + child_type_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), child_type, + GetArenaNoVirtual()); + // @@protoc_insertion_point(field_set_allocated:google.api.ResourceReference.child_type) +} +inline std::string* ResourceReference::unsafe_arena_release_child_type() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.api.ResourceReference.child_type) + GOOGLE_DCHECK(GetArenaNoVirtual() != nullptr); + + return child_type_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void ResourceReference::unsafe_arena_set_allocated_child_type( + std::string* child_type) { + GOOGLE_DCHECK(GetArenaNoVirtual() != nullptr); + if (child_type != nullptr) { + + } else { + + } + child_type_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + child_type, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.api.ResourceReference.child_type) +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ +// ------------------------------------------------------------------- + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace api +} // namespace google + +PROTOBUF_NAMESPACE_OPEN + +template <> struct is_proto_enum< ::google::api::ResourceDescriptor_History> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::google::api::ResourceDescriptor_History>() { + return ::google::api::ResourceDescriptor_History_descriptor(); +} + +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) + +#include +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_google_2fapi_2fresource_2eproto diff --git a/Firestore/Protos/cpp/google/firestore/admin/index.pb.cc b/Firestore/Protos/cpp/google/firestore/admin/index.pb.cc new file mode 100644 index 00000000000..49e90252df9 --- /dev/null +++ b/Firestore/Protos/cpp/google/firestore/admin/index.pb.cc @@ -0,0 +1,867 @@ +/* + * Copyright 2022 Google LLC + * + * 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. + */ + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/firestore/admin/index.proto + +#include "google/firestore/admin/index.pb.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +// @@protoc_insertion_point(includes) +#include +extern PROTOBUF_INTERNAL_EXPORT_google_2ffirestore_2fadmin_2findex_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Index_IndexField_google_2ffirestore_2fadmin_2findex_2eproto; +namespace google { +namespace firestore { +namespace admin { +namespace v1 { +class Index_IndexFieldDefaultTypeInternal { + public: + ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; + int order_; + int array_config_; +} _Index_IndexField_default_instance_; +class IndexDefaultTypeInternal { + public: + ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; +} _Index_default_instance_; +} // namespace v1 +} // namespace admin +} // namespace firestore +} // namespace google +static void InitDefaultsscc_info_Index_google_2ffirestore_2fadmin_2findex_2eproto() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + + { + void* ptr = &::google::firestore::admin::v1::_Index_default_instance_; + new (ptr) ::google::firestore::admin::v1::Index(); + ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); + } + ::google::firestore::admin::v1::Index::InitAsDefaultInstance(); +} + +::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_Index_google_2ffirestore_2fadmin_2findex_2eproto = + {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_Index_google_2ffirestore_2fadmin_2findex_2eproto}, { + &scc_info_Index_IndexField_google_2ffirestore_2fadmin_2findex_2eproto.base,}}; + +static void InitDefaultsscc_info_Index_IndexField_google_2ffirestore_2fadmin_2findex_2eproto() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + + { + void* ptr = &::google::firestore::admin::v1::_Index_IndexField_default_instance_; + new (ptr) ::google::firestore::admin::v1::Index_IndexField(); + ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); + } + ::google::firestore::admin::v1::Index_IndexField::InitAsDefaultInstance(); +} + +::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Index_IndexField_google_2ffirestore_2fadmin_2findex_2eproto = + {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_Index_IndexField_google_2ffirestore_2fadmin_2findex_2eproto}, {}}; + +static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2ffirestore_2fadmin_2findex_2eproto[2]; +static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptors_google_2ffirestore_2fadmin_2findex_2eproto[4]; +static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2ffirestore_2fadmin_2findex_2eproto = nullptr; + +const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2ffirestore_2fadmin_2findex_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::google::firestore::admin::v1::Index_IndexField, _internal_metadata_), + ~0u, // no _extensions_ + PROTOBUF_FIELD_OFFSET(::google::firestore::admin::v1::Index_IndexField, _oneof_case_[0]), + ~0u, // no _weak_field_map_ + PROTOBUF_FIELD_OFFSET(::google::firestore::admin::v1::Index_IndexField, field_path_), + offsetof(::google::firestore::admin::v1::Index_IndexFieldDefaultTypeInternal, order_), + offsetof(::google::firestore::admin::v1::Index_IndexFieldDefaultTypeInternal, array_config_), + PROTOBUF_FIELD_OFFSET(::google::firestore::admin::v1::Index_IndexField, value_mode_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::google::firestore::admin::v1::Index, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + PROTOBUF_FIELD_OFFSET(::google::firestore::admin::v1::Index, name_), + PROTOBUF_FIELD_OFFSET(::google::firestore::admin::v1::Index, query_scope_), + PROTOBUF_FIELD_OFFSET(::google::firestore::admin::v1::Index, fields_), + PROTOBUF_FIELD_OFFSET(::google::firestore::admin::v1::Index, state_), +}; +static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + { 0, -1, sizeof(::google::firestore::admin::v1::Index_IndexField)}, + { 9, -1, sizeof(::google::firestore::admin::v1::Index)}, +}; + +static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { + reinterpret_cast(&::google::firestore::admin::v1::_Index_IndexField_default_instance_), + reinterpret_cast(&::google::firestore::admin::v1::_Index_default_instance_), +}; + +const char descriptor_table_protodef_google_2ffirestore_2fadmin_2findex_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = + "\n\"google/firestore/admin/index.proto\022\031go" + "ogle.firestore.admin.v1\032\031google/api/reso" + "urce.proto\032\034google/api/annotations.proto" + "\"\243\006\n\005Index\022\014\n\004name\030\001 \001(\t\022@\n\013query_scope\030" + "\002 \001(\0162+.google.firestore.admin.v1.Index." + "QueryScope\022;\n\006fields\030\003 \003(\0132+.google.fire" + "store.admin.v1.Index.IndexField\0225\n\005state" + "\030\004 \001(\0162&.google.firestore.admin.v1.Index" + ".State\032\275\002\n\nIndexField\022\022\n\nfield_path\030\001 \001(" + "\t\022B\n\005order\030\002 \001(\01621.google.firestore.admi" + "n.v1.Index.IndexField.OrderH\000\022O\n\014array_c" + "onfig\030\003 \001(\01627.google.firestore.admin.v1." + "Index.IndexField.ArrayConfigH\000\"=\n\005Order\022" + "\025\n\021ORDER_UNSPECIFIED\020\000\022\r\n\tASCENDING\020\001\022\016\n" + "\nDESCENDING\020\002\"9\n\013ArrayConfig\022\034\n\030ARRAY_CO" + "NFIG_UNSPECIFIED\020\000\022\014\n\010CONTAINS\020\001B\014\n\nvalu" + "e_mode\"O\n\nQueryScope\022\033\n\027QUERY_SCOPE_UNSP" + "ECIFIED\020\000\022\016\n\nCOLLECTION\020\001\022\024\n\020COLLECTION_" + "GROUP\020\002\"I\n\005State\022\025\n\021STATE_UNSPECIFIED\020\000\022" + "\014\n\010CREATING\020\001\022\t\n\005READY\020\002\022\020\n\014NEEDS_REPAIR" + "\020\003:z\352Aw\n\036firestore.googleapis.com/Index\022" + "Uprojects/{project}/databases/{database}" + "/collectionGroups/{collection}/indexes/{" + "index}B\336\001\n\035com.google.firestore.admin.v1" + "B\nIndexProtoP\001Z>google.golang.org/genpro" + "to/googleapis/firestore/admin/v1;admin\242\002" + "\004GCFS\252\002\037Google.Cloud.Firestore.Admin.V1\312" + "\002\037Google\\Cloud\\Firestore\\Admin\\V1\352\002#Goog" + "le::Cloud::Firestore::Admin::V1b\006proto3" + ; +static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_google_2ffirestore_2fadmin_2findex_2eproto_deps[2] = { + &::descriptor_table_google_2fapi_2fannotations_2eproto, + &::descriptor_table_google_2fapi_2fresource_2eproto, +}; +static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_google_2ffirestore_2fadmin_2findex_2eproto_sccs[2] = { + &scc_info_Index_google_2ffirestore_2fadmin_2findex_2eproto.base, + &scc_info_Index_IndexField_google_2ffirestore_2fadmin_2findex_2eproto.base, +}; +static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_google_2ffirestore_2fadmin_2findex_2eproto_once; +static bool descriptor_table_google_2ffirestore_2fadmin_2findex_2eproto_initialized = false; +const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2ffirestore_2fadmin_2findex_2eproto = { + &descriptor_table_google_2ffirestore_2fadmin_2findex_2eproto_initialized, descriptor_table_protodef_google_2ffirestore_2fadmin_2findex_2eproto, "google/firestore/admin/index.proto", 1159, + &descriptor_table_google_2ffirestore_2fadmin_2findex_2eproto_once, descriptor_table_google_2ffirestore_2fadmin_2findex_2eproto_sccs, descriptor_table_google_2ffirestore_2fadmin_2findex_2eproto_deps, 2, 2, + schemas, file_default_instances, TableStruct_google_2ffirestore_2fadmin_2findex_2eproto::offsets, + file_level_metadata_google_2ffirestore_2fadmin_2findex_2eproto, 2, file_level_enum_descriptors_google_2ffirestore_2fadmin_2findex_2eproto, file_level_service_descriptors_google_2ffirestore_2fadmin_2findex_2eproto, +}; + +// Force running AddDescriptors() at dynamic initialization time. +static bool dynamic_init_dummy_google_2ffirestore_2fadmin_2findex_2eproto = ( ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_google_2ffirestore_2fadmin_2findex_2eproto), true); +namespace google { +namespace firestore { +namespace admin { +namespace v1 { +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* Index_IndexField_Order_descriptor() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_google_2ffirestore_2fadmin_2findex_2eproto); + return file_level_enum_descriptors_google_2ffirestore_2fadmin_2findex_2eproto[0]; +} +bool Index_IndexField_Order_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + return true; + default: + return false; + } +} + +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) +constexpr Index_IndexField_Order Index_IndexField::ORDER_UNSPECIFIED; +constexpr Index_IndexField_Order Index_IndexField::ASCENDING; +constexpr Index_IndexField_Order Index_IndexField::DESCENDING; +constexpr Index_IndexField_Order Index_IndexField::Order_MIN; +constexpr Index_IndexField_Order Index_IndexField::Order_MAX; +constexpr int Index_IndexField::Order_ARRAYSIZE; +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* Index_IndexField_ArrayConfig_descriptor() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_google_2ffirestore_2fadmin_2findex_2eproto); + return file_level_enum_descriptors_google_2ffirestore_2fadmin_2findex_2eproto[1]; +} +bool Index_IndexField_ArrayConfig_IsValid(int value) { + switch (value) { + case 0: + case 1: + return true; + default: + return false; + } +} + +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) +constexpr Index_IndexField_ArrayConfig Index_IndexField::ARRAY_CONFIG_UNSPECIFIED; +constexpr Index_IndexField_ArrayConfig Index_IndexField::CONTAINS; +constexpr Index_IndexField_ArrayConfig Index_IndexField::ArrayConfig_MIN; +constexpr Index_IndexField_ArrayConfig Index_IndexField::ArrayConfig_MAX; +constexpr int Index_IndexField::ArrayConfig_ARRAYSIZE; +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* Index_QueryScope_descriptor() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_google_2ffirestore_2fadmin_2findex_2eproto); + return file_level_enum_descriptors_google_2ffirestore_2fadmin_2findex_2eproto[2]; +} +bool Index_QueryScope_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + return true; + default: + return false; + } +} + +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) +constexpr Index_QueryScope Index::QUERY_SCOPE_UNSPECIFIED; +constexpr Index_QueryScope Index::COLLECTION; +constexpr Index_QueryScope Index::COLLECTION_GROUP; +constexpr Index_QueryScope Index::QueryScope_MIN; +constexpr Index_QueryScope Index::QueryScope_MAX; +constexpr int Index::QueryScope_ARRAYSIZE; +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* Index_State_descriptor() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_google_2ffirestore_2fadmin_2findex_2eproto); + return file_level_enum_descriptors_google_2ffirestore_2fadmin_2findex_2eproto[3]; +} +bool Index_State_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + case 3: + return true; + default: + return false; + } +} + +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) +constexpr Index_State Index::STATE_UNSPECIFIED; +constexpr Index_State Index::CREATING; +constexpr Index_State Index::READY; +constexpr Index_State Index::NEEDS_REPAIR; +constexpr Index_State Index::State_MIN; +constexpr Index_State Index::State_MAX; +constexpr int Index::State_ARRAYSIZE; +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) + +// =================================================================== + +void Index_IndexField::InitAsDefaultInstance() { + ::google::firestore::admin::v1::_Index_IndexField_default_instance_.order_ = 0; + ::google::firestore::admin::v1::_Index_IndexField_default_instance_.array_config_ = 0; +} +class Index_IndexField::_Internal { + public: +}; + +Index_IndexField::Index_IndexField() + : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.firestore.admin.v1.Index.IndexField) +} +Index_IndexField::Index_IndexField(const Index_IndexField& from) + : ::PROTOBUF_NAMESPACE_ID::Message(), + _internal_metadata_(nullptr) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + field_path_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_field_path().empty()) { + field_path_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.field_path_); + } + clear_has_value_mode(); + switch (from.value_mode_case()) { + case kOrder: { + _internal_set_order(from._internal_order()); + break; + } + case kArrayConfig: { + _internal_set_array_config(from._internal_array_config()); + break; + } + case VALUE_MODE_NOT_SET: { + break; + } + } + // @@protoc_insertion_point(copy_constructor:google.firestore.admin.v1.Index.IndexField) +} + +void Index_IndexField::SharedCtor() { + ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_Index_IndexField_google_2ffirestore_2fadmin_2findex_2eproto.base); + field_path_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + clear_has_value_mode(); +} + +Index_IndexField::~Index_IndexField() { + // @@protoc_insertion_point(destructor:google.firestore.admin.v1.Index.IndexField) + SharedDtor(); +} + +void Index_IndexField::SharedDtor() { + field_path_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (has_value_mode()) { + clear_value_mode(); + } +} + +void Index_IndexField::SetCachedSize(int size) const { + _cached_size_.Set(size); +} +const Index_IndexField& Index_IndexField::default_instance() { + ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_Index_IndexField_google_2ffirestore_2fadmin_2findex_2eproto.base); + return *internal_default_instance(); +} + + +void Index_IndexField::clear_value_mode() { +// @@protoc_insertion_point(one_of_clear_start:google.firestore.admin.v1.Index.IndexField) + switch (value_mode_case()) { + case kOrder: { + // No need to clear + break; + } + case kArrayConfig: { + // No need to clear + break; + } + case VALUE_MODE_NOT_SET: { + break; + } + } + _oneof_case_[0] = VALUE_MODE_NOT_SET; +} + + +void Index_IndexField::Clear() { +// @@protoc_insertion_point(message_clear_start:google.firestore.admin.v1.Index.IndexField) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + field_path_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + clear_value_mode(); + _internal_metadata_.Clear(); +} + +const char* Index_IndexField::_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) { + // string field_path = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + auto str = _internal_mutable_field_path(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.firestore.admin.v1.Index.IndexField.field_path")); + CHK_(ptr); + } else goto handle_unusual; + continue; + // .google.firestore.admin.v1.Index.IndexField.Order order = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { + ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); + CHK_(ptr); + _internal_set_order(static_cast<::google::firestore::admin::v1::Index_IndexField_Order>(val)); + } else goto handle_unusual; + continue; + // .google.firestore.admin.v1.Index.IndexField.ArrayConfig array_config = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) { + ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); + CHK_(ptr); + _internal_set_array_config(static_cast<::google::firestore::admin::v1::Index_IndexField_ArrayConfig>(val)); + } 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_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* Index_IndexField::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:google.firestore.admin.v1.Index.IndexField) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // string field_path = 1; + if (this->field_path().size() > 0) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_field_path().data(), static_cast(this->_internal_field_path().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "google.firestore.admin.v1.Index.IndexField.field_path"); + target = stream->WriteStringMaybeAliased( + 1, this->_internal_field_path(), target); + } + + // .google.firestore.admin.v1.Index.IndexField.Order order = 2; + if (_internal_has_order()) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 2, this->_internal_order(), target); + } + + // .google.firestore.admin.v1.Index.IndexField.ArrayConfig array_config = 3; + if (_internal_has_array_config()) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 3, this->_internal_array_config(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields(), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.firestore.admin.v1.Index.IndexField) + return target; +} + +size_t Index_IndexField::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:google.firestore.admin.v1.Index.IndexField) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // string field_path = 1; + if (this->field_path().size() > 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_field_path()); + } + + switch (value_mode_case()) { + // .google.firestore.admin.v1.Index.IndexField.Order order = 2; + case kOrder: { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_order()); + break; + } + // .google.firestore.admin.v1.Index.IndexField.ArrayConfig array_config = 3; + case kArrayConfig: { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_array_config()); + break; + } + case VALUE_MODE_NOT_SET: { + break; + } + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( + _internal_metadata_, total_size, &_cached_size_); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void Index_IndexField::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:google.firestore.admin.v1.Index.IndexField) + GOOGLE_DCHECK_NE(&from, this); + const Index_IndexField* source = + ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( + &from); + if (source == nullptr) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.firestore.admin.v1.Index.IndexField) + ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); + } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:google.firestore.admin.v1.Index.IndexField) + MergeFrom(*source); + } +} + +void Index_IndexField::MergeFrom(const Index_IndexField& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:google.firestore.admin.v1.Index.IndexField) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (from.field_path().size() > 0) { + + field_path_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.field_path_); + } + switch (from.value_mode_case()) { + case kOrder: { + _internal_set_order(from._internal_order()); + break; + } + case kArrayConfig: { + _internal_set_array_config(from._internal_array_config()); + break; + } + case VALUE_MODE_NOT_SET: { + break; + } + } +} + +void Index_IndexField::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:google.firestore.admin.v1.Index.IndexField) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void Index_IndexField::CopyFrom(const Index_IndexField& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:google.firestore.admin.v1.Index.IndexField) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool Index_IndexField::IsInitialized() const { + return true; +} + +void Index_IndexField::InternalSwap(Index_IndexField* other) { + using std::swap; + _internal_metadata_.Swap(&other->_internal_metadata_); + field_path_.Swap(&other->field_path_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); + swap(value_mode_, other->value_mode_); + swap(_oneof_case_[0], other->_oneof_case_[0]); +} + +::PROTOBUF_NAMESPACE_ID::Metadata Index_IndexField::GetMetadata() const { + return GetMetadataStatic(); +} + + +// =================================================================== + +void Index::InitAsDefaultInstance() { +} +class Index::_Internal { + public: +}; + +Index::Index() + : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.firestore.admin.v1.Index) +} +Index::Index(const Index& from) + : ::PROTOBUF_NAMESPACE_ID::Message(), + _internal_metadata_(nullptr), + fields_(from.fields_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_name().empty()) { + name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name_); + } + ::memcpy(&query_scope_, &from.query_scope_, + static_cast(reinterpret_cast(&state_) - + reinterpret_cast(&query_scope_)) + sizeof(state_)); + // @@protoc_insertion_point(copy_constructor:google.firestore.admin.v1.Index) +} + +void Index::SharedCtor() { + ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_Index_google_2ffirestore_2fadmin_2findex_2eproto.base); + name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + ::memset(&query_scope_, 0, static_cast( + reinterpret_cast(&state_) - + reinterpret_cast(&query_scope_)) + sizeof(state_)); +} + +Index::~Index() { + // @@protoc_insertion_point(destructor:google.firestore.admin.v1.Index) + SharedDtor(); +} + +void Index::SharedDtor() { + name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void Index::SetCachedSize(int size) const { + _cached_size_.Set(size); +} +const Index& Index::default_instance() { + ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_Index_google_2ffirestore_2fadmin_2findex_2eproto.base); + return *internal_default_instance(); +} + + +void Index::Clear() { +// @@protoc_insertion_point(message_clear_start:google.firestore.admin.v1.Index) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + fields_.Clear(); + name_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + ::memset(&query_scope_, 0, static_cast( + reinterpret_cast(&state_) - + reinterpret_cast(&query_scope_)) + sizeof(state_)); + _internal_metadata_.Clear(); +} + +const char* Index::_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) { + // string name = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + auto str = _internal_mutable_name(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.firestore.admin.v1.Index.name")); + CHK_(ptr); + } else goto handle_unusual; + continue; + // .google.firestore.admin.v1.Index.QueryScope query_scope = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { + ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); + CHK_(ptr); + _internal_set_query_scope(static_cast<::google::firestore::admin::v1::Index_QueryScope>(val)); + } else goto handle_unusual; + continue; + // repeated .google.firestore.admin.v1.Index.IndexField fields = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { + ptr -= 1; + do { + ptr += 1; + ptr = ctx->ParseMessage(_internal_add_fields(), ptr); + CHK_(ptr); + if (!ctx->DataAvailable(ptr)) break; + } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<26>(ptr)); + } else goto handle_unusual; + continue; + // .google.firestore.admin.v1.Index.State state = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) { + ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); + CHK_(ptr); + _internal_set_state(static_cast<::google::firestore::admin::v1::Index_State>(val)); + } 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_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* Index::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:google.firestore.admin.v1.Index) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // string name = 1; + if (this->name().size() > 0) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_name().data(), static_cast(this->_internal_name().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "google.firestore.admin.v1.Index.name"); + target = stream->WriteStringMaybeAliased( + 1, this->_internal_name(), target); + } + + // .google.firestore.admin.v1.Index.QueryScope query_scope = 2; + if (this->query_scope() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 2, this->_internal_query_scope(), target); + } + + // repeated .google.firestore.admin.v1.Index.IndexField fields = 3; + for (unsigned int i = 0, + n = static_cast(this->_internal_fields_size()); i < n; i++) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(3, this->_internal_fields(i), target, stream); + } + + // .google.firestore.admin.v1.Index.State state = 4; + if (this->state() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 4, this->_internal_state(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields(), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.firestore.admin.v1.Index) + return target; +} + +size_t Index::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:google.firestore.admin.v1.Index) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // repeated .google.firestore.admin.v1.Index.IndexField fields = 3; + total_size += 1UL * this->_internal_fields_size(); + for (const auto& msg : this->fields_) { + total_size += + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); + } + + // string name = 1; + if (this->name().size() > 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_name()); + } + + // .google.firestore.admin.v1.Index.QueryScope query_scope = 2; + if (this->query_scope() != 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_query_scope()); + } + + // .google.firestore.admin.v1.Index.State state = 4; + if (this->state() != 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_state()); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( + _internal_metadata_, total_size, &_cached_size_); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void Index::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:google.firestore.admin.v1.Index) + GOOGLE_DCHECK_NE(&from, this); + const Index* source = + ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( + &from); + if (source == nullptr) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.firestore.admin.v1.Index) + ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); + } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:google.firestore.admin.v1.Index) + MergeFrom(*source); + } +} + +void Index::MergeFrom(const Index& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:google.firestore.admin.v1.Index) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + fields_.MergeFrom(from.fields_); + if (from.name().size() > 0) { + + name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name_); + } + if (from.query_scope() != 0) { + _internal_set_query_scope(from._internal_query_scope()); + } + if (from.state() != 0) { + _internal_set_state(from._internal_state()); + } +} + +void Index::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:google.firestore.admin.v1.Index) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void Index::CopyFrom(const Index& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:google.firestore.admin.v1.Index) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool Index::IsInitialized() const { + return true; +} + +void Index::InternalSwap(Index* other) { + using std::swap; + _internal_metadata_.Swap(&other->_internal_metadata_); + fields_.InternalSwap(&other->fields_); + name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); + swap(query_scope_, other->query_scope_); + swap(state_, other->state_); +} + +::PROTOBUF_NAMESPACE_ID::Metadata Index::GetMetadata() const { + return GetMetadataStatic(); +} + + +// @@protoc_insertion_point(namespace_scope) +} // namespace v1 +} // namespace admin +} // namespace firestore +} // namespace google +PROTOBUF_NAMESPACE_OPEN +template<> PROTOBUF_NOINLINE ::google::firestore::admin::v1::Index_IndexField* Arena::CreateMaybeMessage< ::google::firestore::admin::v1::Index_IndexField >(Arena* arena) { + return Arena::CreateInternal< ::google::firestore::admin::v1::Index_IndexField >(arena); +} +template<> PROTOBUF_NOINLINE ::google::firestore::admin::v1::Index* Arena::CreateMaybeMessage< ::google::firestore::admin::v1::Index >(Arena* arena) { + return Arena::CreateInternal< ::google::firestore::admin::v1::Index >(arena); +} +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) +#include diff --git a/Firestore/Protos/cpp/google/firestore/admin/index.pb.h b/Firestore/Protos/cpp/google/firestore/admin/index.pb.h new file mode 100644 index 00000000000..54c29ad8e75 --- /dev/null +++ b/Firestore/Protos/cpp/google/firestore/admin/index.pb.h @@ -0,0 +1,1025 @@ +/* + * Copyright 2022 Google LLC + * + * 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. + */ + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/firestore/admin/index.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_google_2ffirestore_2fadmin_2findex_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_google_2ffirestore_2fadmin_2findex_2eproto + +#include +#include + +#include +#if PROTOBUF_VERSION < 3011000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3011002 < 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 regenerate this file with a newer version of protoc. +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // IWYU pragma: export +#include // IWYU pragma: export +#include +#include +#include "google/api/resource.pb.h" +#include "google/api/annotations.pb.h" +// @@protoc_insertion_point(includes) +#include +#define PROTOBUF_INTERNAL_EXPORT_google_2ffirestore_2fadmin_2findex_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE + +// Internal implementation detail -- do not use these members. +struct TableStruct_google_2ffirestore_2fadmin_2findex_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[]; +}; +extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2ffirestore_2fadmin_2findex_2eproto; +namespace google { +namespace firestore { +namespace admin { +namespace v1 { +class Index; +class IndexDefaultTypeInternal; +extern IndexDefaultTypeInternal _Index_default_instance_; +class Index_IndexField; +class Index_IndexFieldDefaultTypeInternal; +extern Index_IndexFieldDefaultTypeInternal _Index_IndexField_default_instance_; +} // namespace v1 +} // namespace admin +} // namespace firestore +} // namespace google +PROTOBUF_NAMESPACE_OPEN +template<> ::google::firestore::admin::v1::Index* Arena::CreateMaybeMessage<::google::firestore::admin::v1::Index>(Arena*); +template<> ::google::firestore::admin::v1::Index_IndexField* Arena::CreateMaybeMessage<::google::firestore::admin::v1::Index_IndexField>(Arena*); +PROTOBUF_NAMESPACE_CLOSE +namespace google { +namespace firestore { +namespace admin { +namespace v1 { + +enum Index_IndexField_Order : int { + Index_IndexField_Order_ORDER_UNSPECIFIED = 0, + Index_IndexField_Order_ASCENDING = 1, + Index_IndexField_Order_DESCENDING = 2, + Index_IndexField_Order_Index_IndexField_Order_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(), + Index_IndexField_Order_Index_IndexField_Order_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max() +}; +bool Index_IndexField_Order_IsValid(int value); +constexpr Index_IndexField_Order Index_IndexField_Order_Order_MIN = Index_IndexField_Order_ORDER_UNSPECIFIED; +constexpr Index_IndexField_Order Index_IndexField_Order_Order_MAX = Index_IndexField_Order_DESCENDING; +constexpr int Index_IndexField_Order_Order_ARRAYSIZE = Index_IndexField_Order_Order_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* Index_IndexField_Order_descriptor(); +template +inline const std::string& Index_IndexField_Order_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function Index_IndexField_Order_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + Index_IndexField_Order_descriptor(), enum_t_value); +} +inline bool Index_IndexField_Order_Parse( + const std::string& name, Index_IndexField_Order* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + Index_IndexField_Order_descriptor(), name, value); +} +enum Index_IndexField_ArrayConfig : int { + Index_IndexField_ArrayConfig_ARRAY_CONFIG_UNSPECIFIED = 0, + Index_IndexField_ArrayConfig_CONTAINS = 1, + Index_IndexField_ArrayConfig_Index_IndexField_ArrayConfig_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(), + Index_IndexField_ArrayConfig_Index_IndexField_ArrayConfig_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max() +}; +bool Index_IndexField_ArrayConfig_IsValid(int value); +constexpr Index_IndexField_ArrayConfig Index_IndexField_ArrayConfig_ArrayConfig_MIN = Index_IndexField_ArrayConfig_ARRAY_CONFIG_UNSPECIFIED; +constexpr Index_IndexField_ArrayConfig Index_IndexField_ArrayConfig_ArrayConfig_MAX = Index_IndexField_ArrayConfig_CONTAINS; +constexpr int Index_IndexField_ArrayConfig_ArrayConfig_ARRAYSIZE = Index_IndexField_ArrayConfig_ArrayConfig_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* Index_IndexField_ArrayConfig_descriptor(); +template +inline const std::string& Index_IndexField_ArrayConfig_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function Index_IndexField_ArrayConfig_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + Index_IndexField_ArrayConfig_descriptor(), enum_t_value); +} +inline bool Index_IndexField_ArrayConfig_Parse( + const std::string& name, Index_IndexField_ArrayConfig* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + Index_IndexField_ArrayConfig_descriptor(), name, value); +} +enum Index_QueryScope : int { + Index_QueryScope_QUERY_SCOPE_UNSPECIFIED = 0, + Index_QueryScope_COLLECTION = 1, + Index_QueryScope_COLLECTION_GROUP = 2, + Index_QueryScope_Index_QueryScope_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(), + Index_QueryScope_Index_QueryScope_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max() +}; +bool Index_QueryScope_IsValid(int value); +constexpr Index_QueryScope Index_QueryScope_QueryScope_MIN = Index_QueryScope_QUERY_SCOPE_UNSPECIFIED; +constexpr Index_QueryScope Index_QueryScope_QueryScope_MAX = Index_QueryScope_COLLECTION_GROUP; +constexpr int Index_QueryScope_QueryScope_ARRAYSIZE = Index_QueryScope_QueryScope_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* Index_QueryScope_descriptor(); +template +inline const std::string& Index_QueryScope_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function Index_QueryScope_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + Index_QueryScope_descriptor(), enum_t_value); +} +inline bool Index_QueryScope_Parse( + const std::string& name, Index_QueryScope* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + Index_QueryScope_descriptor(), name, value); +} +enum Index_State : int { + Index_State_STATE_UNSPECIFIED = 0, + Index_State_CREATING = 1, + Index_State_READY = 2, + Index_State_NEEDS_REPAIR = 3, + Index_State_Index_State_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(), + Index_State_Index_State_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max() +}; +bool Index_State_IsValid(int value); +constexpr Index_State Index_State_State_MIN = Index_State_STATE_UNSPECIFIED; +constexpr Index_State Index_State_State_MAX = Index_State_NEEDS_REPAIR; +constexpr int Index_State_State_ARRAYSIZE = Index_State_State_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* Index_State_descriptor(); +template +inline const std::string& Index_State_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function Index_State_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + Index_State_descriptor(), enum_t_value); +} +inline bool Index_State_Parse( + const std::string& name, Index_State* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + Index_State_descriptor(), name, value); +} +// =================================================================== + +class Index_IndexField : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.firestore.admin.v1.Index.IndexField) */ { + public: + Index_IndexField(); + virtual ~Index_IndexField(); + + Index_IndexField(const Index_IndexField& from); + Index_IndexField(Index_IndexField&& from) noexcept + : Index_IndexField() { + *this = ::std::move(from); + } + + inline Index_IndexField& operator=(const Index_IndexField& from) { + CopyFrom(from); + return *this; + } + inline Index_IndexField& operator=(Index_IndexField&& from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + 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 Index_IndexField& default_instance(); + + enum ValueModeCase { + kOrder = 2, + kArrayConfig = 3, + VALUE_MODE_NOT_SET = 0, + }; + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const Index_IndexField* internal_default_instance() { + return reinterpret_cast( + &_Index_IndexField_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(Index_IndexField& a, Index_IndexField& b) { + a.Swap(&b); + } + inline void Swap(Index_IndexField* other) { + if (other == this) return; + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline Index_IndexField* New() const final { + return CreateMaybeMessage(nullptr); + } + + Index_IndexField* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const Index_IndexField& from); + void MergeFrom(const Index_IndexField& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(Index_IndexField* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "google.firestore.admin.v1.Index.IndexField"; + } + private: + inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const { + return nullptr; + } + inline void* MaybeArenaPtr() const { + return nullptr; + } + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_google_2ffirestore_2fadmin_2findex_2eproto); + return ::descriptor_table_google_2ffirestore_2fadmin_2findex_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + typedef Index_IndexField_Order Order; + static constexpr Order ORDER_UNSPECIFIED = + Index_IndexField_Order_ORDER_UNSPECIFIED; + static constexpr Order ASCENDING = + Index_IndexField_Order_ASCENDING; + static constexpr Order DESCENDING = + Index_IndexField_Order_DESCENDING; + static inline bool Order_IsValid(int value) { + return Index_IndexField_Order_IsValid(value); + } + static constexpr Order Order_MIN = + Index_IndexField_Order_Order_MIN; + static constexpr Order Order_MAX = + Index_IndexField_Order_Order_MAX; + static constexpr int Order_ARRAYSIZE = + Index_IndexField_Order_Order_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + Order_descriptor() { + return Index_IndexField_Order_descriptor(); + } + template + static inline const std::string& Order_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function Order_Name."); + return Index_IndexField_Order_Name(enum_t_value); + } + static inline bool Order_Parse(const std::string& name, + Order* value) { + return Index_IndexField_Order_Parse(name, value); + } + + typedef Index_IndexField_ArrayConfig ArrayConfig; + static constexpr ArrayConfig ARRAY_CONFIG_UNSPECIFIED = + Index_IndexField_ArrayConfig_ARRAY_CONFIG_UNSPECIFIED; + static constexpr ArrayConfig CONTAINS = + Index_IndexField_ArrayConfig_CONTAINS; + static inline bool ArrayConfig_IsValid(int value) { + return Index_IndexField_ArrayConfig_IsValid(value); + } + static constexpr ArrayConfig ArrayConfig_MIN = + Index_IndexField_ArrayConfig_ArrayConfig_MIN; + static constexpr ArrayConfig ArrayConfig_MAX = + Index_IndexField_ArrayConfig_ArrayConfig_MAX; + static constexpr int ArrayConfig_ARRAYSIZE = + Index_IndexField_ArrayConfig_ArrayConfig_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + ArrayConfig_descriptor() { + return Index_IndexField_ArrayConfig_descriptor(); + } + template + static inline const std::string& ArrayConfig_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function ArrayConfig_Name."); + return Index_IndexField_ArrayConfig_Name(enum_t_value); + } + static inline bool ArrayConfig_Parse(const std::string& name, + ArrayConfig* value) { + return Index_IndexField_ArrayConfig_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kFieldPathFieldNumber = 1, + kOrderFieldNumber = 2, + kArrayConfigFieldNumber = 3, + }; + // string field_path = 1; + void clear_field_path(); + const std::string& field_path() const; + void set_field_path(const std::string& value); + void set_field_path(std::string&& value); + void set_field_path(const char* value); + void set_field_path(const char* value, size_t size); + std::string* mutable_field_path(); + std::string* release_field_path(); + void set_allocated_field_path(std::string* field_path); + private: + const std::string& _internal_field_path() const; + void _internal_set_field_path(const std::string& value); + std::string* _internal_mutable_field_path(); + public: + + // .google.firestore.admin.v1.Index.IndexField.Order order = 2; + private: + bool _internal_has_order() const; + public: + void clear_order(); + ::google::firestore::admin::v1::Index_IndexField_Order order() const; + void set_order(::google::firestore::admin::v1::Index_IndexField_Order value); + private: + ::google::firestore::admin::v1::Index_IndexField_Order _internal_order() const; + void _internal_set_order(::google::firestore::admin::v1::Index_IndexField_Order value); + public: + + // .google.firestore.admin.v1.Index.IndexField.ArrayConfig array_config = 3; + private: + bool _internal_has_array_config() const; + public: + void clear_array_config(); + ::google::firestore::admin::v1::Index_IndexField_ArrayConfig array_config() const; + void set_array_config(::google::firestore::admin::v1::Index_IndexField_ArrayConfig value); + private: + ::google::firestore::admin::v1::Index_IndexField_ArrayConfig _internal_array_config() const; + void _internal_set_array_config(::google::firestore::admin::v1::Index_IndexField_ArrayConfig value); + public: + + void clear_value_mode(); + ValueModeCase value_mode_case() const; + // @@protoc_insertion_point(class_scope:google.firestore.admin.v1.Index.IndexField) + private: + class _Internal; + void set_has_order(); + void set_has_array_config(); + + inline bool has_value_mode() const; + inline void clear_has_value_mode(); + + ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr field_path_; + union ValueModeUnion { + ValueModeUnion() {} + int order_; + int array_config_; + } value_mode_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::uint32 _oneof_case_[1]; + + friend struct ::TableStruct_google_2ffirestore_2fadmin_2findex_2eproto; +}; +// ------------------------------------------------------------------- + +class Index : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.firestore.admin.v1.Index) */ { + public: + Index(); + virtual ~Index(); + + Index(const Index& from); + Index(Index&& from) noexcept + : Index() { + *this = ::std::move(from); + } + + inline Index& operator=(const Index& from) { + CopyFrom(from); + return *this; + } + inline Index& operator=(Index&& from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + 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 Index& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const Index* internal_default_instance() { + return reinterpret_cast( + &_Index_default_instance_); + } + static constexpr int kIndexInFileMessages = + 1; + + friend void swap(Index& a, Index& b) { + a.Swap(&b); + } + inline void Swap(Index* other) { + if (other == this) return; + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline Index* New() const final { + return CreateMaybeMessage(nullptr); + } + + Index* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const Index& from); + void MergeFrom(const Index& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(Index* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "google.firestore.admin.v1.Index"; + } + private: + inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const { + return nullptr; + } + inline void* MaybeArenaPtr() const { + return nullptr; + } + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_google_2ffirestore_2fadmin_2findex_2eproto); + return ::descriptor_table_google_2ffirestore_2fadmin_2findex_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + typedef Index_IndexField IndexField; + + typedef Index_QueryScope QueryScope; + static constexpr QueryScope QUERY_SCOPE_UNSPECIFIED = + Index_QueryScope_QUERY_SCOPE_UNSPECIFIED; + static constexpr QueryScope COLLECTION = + Index_QueryScope_COLLECTION; + static constexpr QueryScope COLLECTION_GROUP = + Index_QueryScope_COLLECTION_GROUP; + static inline bool QueryScope_IsValid(int value) { + return Index_QueryScope_IsValid(value); + } + static constexpr QueryScope QueryScope_MIN = + Index_QueryScope_QueryScope_MIN; + static constexpr QueryScope QueryScope_MAX = + Index_QueryScope_QueryScope_MAX; + static constexpr int QueryScope_ARRAYSIZE = + Index_QueryScope_QueryScope_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + QueryScope_descriptor() { + return Index_QueryScope_descriptor(); + } + template + static inline const std::string& QueryScope_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function QueryScope_Name."); + return Index_QueryScope_Name(enum_t_value); + } + static inline bool QueryScope_Parse(const std::string& name, + QueryScope* value) { + return Index_QueryScope_Parse(name, value); + } + + typedef Index_State State; + static constexpr State STATE_UNSPECIFIED = + Index_State_STATE_UNSPECIFIED; + static constexpr State CREATING = + Index_State_CREATING; + static constexpr State READY = + Index_State_READY; + static constexpr State NEEDS_REPAIR = + Index_State_NEEDS_REPAIR; + static inline bool State_IsValid(int value) { + return Index_State_IsValid(value); + } + static constexpr State State_MIN = + Index_State_State_MIN; + static constexpr State State_MAX = + Index_State_State_MAX; + static constexpr int State_ARRAYSIZE = + Index_State_State_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + State_descriptor() { + return Index_State_descriptor(); + } + template + static inline const std::string& State_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function State_Name."); + return Index_State_Name(enum_t_value); + } + static inline bool State_Parse(const std::string& name, + State* value) { + return Index_State_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kFieldsFieldNumber = 3, + kNameFieldNumber = 1, + kQueryScopeFieldNumber = 2, + kStateFieldNumber = 4, + }; + // repeated .google.firestore.admin.v1.Index.IndexField fields = 3; + int fields_size() const; + private: + int _internal_fields_size() const; + public: + void clear_fields(); + ::google::firestore::admin::v1::Index_IndexField* mutable_fields(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::google::firestore::admin::v1::Index_IndexField >* + mutable_fields(); + private: + const ::google::firestore::admin::v1::Index_IndexField& _internal_fields(int index) const; + ::google::firestore::admin::v1::Index_IndexField* _internal_add_fields(); + public: + const ::google::firestore::admin::v1::Index_IndexField& fields(int index) const; + ::google::firestore::admin::v1::Index_IndexField* add_fields(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::google::firestore::admin::v1::Index_IndexField >& + fields() const; + + // string name = 1; + void clear_name(); + const std::string& name() const; + void set_name(const std::string& value); + void set_name(std::string&& value); + void set_name(const char* value); + void set_name(const char* value, size_t size); + std::string* mutable_name(); + std::string* release_name(); + void set_allocated_name(std::string* name); + private: + const std::string& _internal_name() const; + void _internal_set_name(const std::string& value); + std::string* _internal_mutable_name(); + public: + + // .google.firestore.admin.v1.Index.QueryScope query_scope = 2; + void clear_query_scope(); + ::google::firestore::admin::v1::Index_QueryScope query_scope() const; + void set_query_scope(::google::firestore::admin::v1::Index_QueryScope value); + private: + ::google::firestore::admin::v1::Index_QueryScope _internal_query_scope() const; + void _internal_set_query_scope(::google::firestore::admin::v1::Index_QueryScope value); + public: + + // .google.firestore.admin.v1.Index.State state = 4; + void clear_state(); + ::google::firestore::admin::v1::Index_State state() const; + void set_state(::google::firestore::admin::v1::Index_State value); + private: + ::google::firestore::admin::v1::Index_State _internal_state() const; + void _internal_set_state(::google::firestore::admin::v1::Index_State value); + public: + + // @@protoc_insertion_point(class_scope:google.firestore.admin.v1.Index) + private: + class _Internal; + + ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::google::firestore::admin::v1::Index_IndexField > fields_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; + int query_scope_; + int state_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_google_2ffirestore_2fadmin_2findex_2eproto; +}; +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// Index_IndexField + +// string field_path = 1; +inline void Index_IndexField::clear_field_path() { + field_path_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} +inline const std::string& Index_IndexField::field_path() const { + // @@protoc_insertion_point(field_get:google.firestore.admin.v1.Index.IndexField.field_path) + return _internal_field_path(); +} +inline void Index_IndexField::set_field_path(const std::string& value) { + _internal_set_field_path(value); + // @@protoc_insertion_point(field_set:google.firestore.admin.v1.Index.IndexField.field_path) +} +inline std::string* Index_IndexField::mutable_field_path() { + // @@protoc_insertion_point(field_mutable:google.firestore.admin.v1.Index.IndexField.field_path) + return _internal_mutable_field_path(); +} +inline const std::string& Index_IndexField::_internal_field_path() const { + return field_path_.GetNoArena(); +} +inline void Index_IndexField::_internal_set_field_path(const std::string& value) { + + field_path_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); +} +inline void Index_IndexField::set_field_path(std::string&& value) { + + field_path_.SetNoArena( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:google.firestore.admin.v1.Index.IndexField.field_path) +} +inline void Index_IndexField::set_field_path(const char* value) { + GOOGLE_DCHECK(value != nullptr); + + field_path_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.firestore.admin.v1.Index.IndexField.field_path) +} +inline void Index_IndexField::set_field_path(const char* value, size_t size) { + + field_path_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.firestore.admin.v1.Index.IndexField.field_path) +} +inline std::string* Index_IndexField::_internal_mutable_field_path() { + + return field_path_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} +inline std::string* Index_IndexField::release_field_path() { + // @@protoc_insertion_point(field_release:google.firestore.admin.v1.Index.IndexField.field_path) + + return field_path_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} +inline void Index_IndexField::set_allocated_field_path(std::string* field_path) { + if (field_path != nullptr) { + + } else { + + } + field_path_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), field_path); + // @@protoc_insertion_point(field_set_allocated:google.firestore.admin.v1.Index.IndexField.field_path) +} + +// .google.firestore.admin.v1.Index.IndexField.Order order = 2; +inline bool Index_IndexField::_internal_has_order() const { + return value_mode_case() == kOrder; +} +inline void Index_IndexField::set_has_order() { + _oneof_case_[0] = kOrder; +} +inline void Index_IndexField::clear_order() { + if (_internal_has_order()) { + value_mode_.order_ = 0; + clear_has_value_mode(); + } +} +inline ::google::firestore::admin::v1::Index_IndexField_Order Index_IndexField::_internal_order() const { + if (_internal_has_order()) { + return static_cast< ::google::firestore::admin::v1::Index_IndexField_Order >(value_mode_.order_); + } + return static_cast< ::google::firestore::admin::v1::Index_IndexField_Order >(0); +} +inline ::google::firestore::admin::v1::Index_IndexField_Order Index_IndexField::order() const { + // @@protoc_insertion_point(field_get:google.firestore.admin.v1.Index.IndexField.order) + return _internal_order(); +} +inline void Index_IndexField::_internal_set_order(::google::firestore::admin::v1::Index_IndexField_Order value) { + if (!_internal_has_order()) { + clear_value_mode(); + set_has_order(); + } + value_mode_.order_ = value; +} +inline void Index_IndexField::set_order(::google::firestore::admin::v1::Index_IndexField_Order value) { + // @@protoc_insertion_point(field_set:google.firestore.admin.v1.Index.IndexField.order) + _internal_set_order(value); +} + +// .google.firestore.admin.v1.Index.IndexField.ArrayConfig array_config = 3; +inline bool Index_IndexField::_internal_has_array_config() const { + return value_mode_case() == kArrayConfig; +} +inline void Index_IndexField::set_has_array_config() { + _oneof_case_[0] = kArrayConfig; +} +inline void Index_IndexField::clear_array_config() { + if (_internal_has_array_config()) { + value_mode_.array_config_ = 0; + clear_has_value_mode(); + } +} +inline ::google::firestore::admin::v1::Index_IndexField_ArrayConfig Index_IndexField::_internal_array_config() const { + if (_internal_has_array_config()) { + return static_cast< ::google::firestore::admin::v1::Index_IndexField_ArrayConfig >(value_mode_.array_config_); + } + return static_cast< ::google::firestore::admin::v1::Index_IndexField_ArrayConfig >(0); +} +inline ::google::firestore::admin::v1::Index_IndexField_ArrayConfig Index_IndexField::array_config() const { + // @@protoc_insertion_point(field_get:google.firestore.admin.v1.Index.IndexField.array_config) + return _internal_array_config(); +} +inline void Index_IndexField::_internal_set_array_config(::google::firestore::admin::v1::Index_IndexField_ArrayConfig value) { + if (!_internal_has_array_config()) { + clear_value_mode(); + set_has_array_config(); + } + value_mode_.array_config_ = value; +} +inline void Index_IndexField::set_array_config(::google::firestore::admin::v1::Index_IndexField_ArrayConfig value) { + // @@protoc_insertion_point(field_set:google.firestore.admin.v1.Index.IndexField.array_config) + _internal_set_array_config(value); +} + +inline bool Index_IndexField::has_value_mode() const { + return value_mode_case() != VALUE_MODE_NOT_SET; +} +inline void Index_IndexField::clear_has_value_mode() { + _oneof_case_[0] = VALUE_MODE_NOT_SET; +} +inline Index_IndexField::ValueModeCase Index_IndexField::value_mode_case() const { + return Index_IndexField::ValueModeCase(_oneof_case_[0]); +} +// ------------------------------------------------------------------- + +// Index + +// string name = 1; +inline void Index::clear_name() { + name_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} +inline const std::string& Index::name() const { + // @@protoc_insertion_point(field_get:google.firestore.admin.v1.Index.name) + return _internal_name(); +} +inline void Index::set_name(const std::string& value) { + _internal_set_name(value); + // @@protoc_insertion_point(field_set:google.firestore.admin.v1.Index.name) +} +inline std::string* Index::mutable_name() { + // @@protoc_insertion_point(field_mutable:google.firestore.admin.v1.Index.name) + return _internal_mutable_name(); +} +inline const std::string& Index::_internal_name() const { + return name_.GetNoArena(); +} +inline void Index::_internal_set_name(const std::string& value) { + + name_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); +} +inline void Index::set_name(std::string&& value) { + + name_.SetNoArena( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:google.firestore.admin.v1.Index.name) +} +inline void Index::set_name(const char* value) { + GOOGLE_DCHECK(value != nullptr); + + name_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.firestore.admin.v1.Index.name) +} +inline void Index::set_name(const char* value, size_t size) { + + name_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.firestore.admin.v1.Index.name) +} +inline std::string* Index::_internal_mutable_name() { + + return name_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} +inline std::string* Index::release_name() { + // @@protoc_insertion_point(field_release:google.firestore.admin.v1.Index.name) + + return name_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} +inline void Index::set_allocated_name(std::string* name) { + if (name != nullptr) { + + } else { + + } + name_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name); + // @@protoc_insertion_point(field_set_allocated:google.firestore.admin.v1.Index.name) +} + +// .google.firestore.admin.v1.Index.QueryScope query_scope = 2; +inline void Index::clear_query_scope() { + query_scope_ = 0; +} +inline ::google::firestore::admin::v1::Index_QueryScope Index::_internal_query_scope() const { + return static_cast< ::google::firestore::admin::v1::Index_QueryScope >(query_scope_); +} +inline ::google::firestore::admin::v1::Index_QueryScope Index::query_scope() const { + // @@protoc_insertion_point(field_get:google.firestore.admin.v1.Index.query_scope) + return _internal_query_scope(); +} +inline void Index::_internal_set_query_scope(::google::firestore::admin::v1::Index_QueryScope value) { + + query_scope_ = value; +} +inline void Index::set_query_scope(::google::firestore::admin::v1::Index_QueryScope value) { + _internal_set_query_scope(value); + // @@protoc_insertion_point(field_set:google.firestore.admin.v1.Index.query_scope) +} + +// repeated .google.firestore.admin.v1.Index.IndexField fields = 3; +inline int Index::_internal_fields_size() const { + return fields_.size(); +} +inline int Index::fields_size() const { + return _internal_fields_size(); +} +inline void Index::clear_fields() { + fields_.Clear(); +} +inline ::google::firestore::admin::v1::Index_IndexField* Index::mutable_fields(int index) { + // @@protoc_insertion_point(field_mutable:google.firestore.admin.v1.Index.fields) + return fields_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::google::firestore::admin::v1::Index_IndexField >* +Index::mutable_fields() { + // @@protoc_insertion_point(field_mutable_list:google.firestore.admin.v1.Index.fields) + return &fields_; +} +inline const ::google::firestore::admin::v1::Index_IndexField& Index::_internal_fields(int index) const { + return fields_.Get(index); +} +inline const ::google::firestore::admin::v1::Index_IndexField& Index::fields(int index) const { + // @@protoc_insertion_point(field_get:google.firestore.admin.v1.Index.fields) + return _internal_fields(index); +} +inline ::google::firestore::admin::v1::Index_IndexField* Index::_internal_add_fields() { + return fields_.Add(); +} +inline ::google::firestore::admin::v1::Index_IndexField* Index::add_fields() { + // @@protoc_insertion_point(field_add:google.firestore.admin.v1.Index.fields) + return _internal_add_fields(); +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::google::firestore::admin::v1::Index_IndexField >& +Index::fields() const { + // @@protoc_insertion_point(field_list:google.firestore.admin.v1.Index.fields) + return fields_; +} + +// .google.firestore.admin.v1.Index.State state = 4; +inline void Index::clear_state() { + state_ = 0; +} +inline ::google::firestore::admin::v1::Index_State Index::_internal_state() const { + return static_cast< ::google::firestore::admin::v1::Index_State >(state_); +} +inline ::google::firestore::admin::v1::Index_State Index::state() const { + // @@protoc_insertion_point(field_get:google.firestore.admin.v1.Index.state) + return _internal_state(); +} +inline void Index::_internal_set_state(::google::firestore::admin::v1::Index_State value) { + + state_ = value; +} +inline void Index::set_state(::google::firestore::admin::v1::Index_State value) { + _internal_set_state(value); + // @@protoc_insertion_point(field_set:google.firestore.admin.v1.Index.state) +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ +// ------------------------------------------------------------------- + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace v1 +} // namespace admin +} // namespace firestore +} // namespace google + +PROTOBUF_NAMESPACE_OPEN + +template <> struct is_proto_enum< ::google::firestore::admin::v1::Index_IndexField_Order> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::google::firestore::admin::v1::Index_IndexField_Order>() { + return ::google::firestore::admin::v1::Index_IndexField_Order_descriptor(); +} +template <> struct is_proto_enum< ::google::firestore::admin::v1::Index_IndexField_ArrayConfig> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::google::firestore::admin::v1::Index_IndexField_ArrayConfig>() { + return ::google::firestore::admin::v1::Index_IndexField_ArrayConfig_descriptor(); +} +template <> struct is_proto_enum< ::google::firestore::admin::v1::Index_QueryScope> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::google::firestore::admin::v1::Index_QueryScope>() { + return ::google::firestore::admin::v1::Index_QueryScope_descriptor(); +} +template <> struct is_proto_enum< ::google::firestore::admin::v1::Index_State> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::google::firestore::admin::v1::Index_State>() { + return ::google::firestore::admin::v1::Index_State_descriptor(); +} + +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) + +#include +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_google_2ffirestore_2fadmin_2findex_2eproto diff --git a/Firestore/Protos/nanopb/google/api/resource.nanopb.cc b/Firestore/Protos/nanopb/google/api/resource.nanopb.cc new file mode 100644 index 00000000000..1f676d83785 --- /dev/null +++ b/Firestore/Protos/nanopb/google/api/resource.nanopb.cc @@ -0,0 +1,135 @@ +/* + * Copyright 2022 Google LLC + * + * 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. + */ + +/* Automatically generated nanopb constant definitions */ +/* Generated by nanopb-0.3.9.8 */ + +#include "resource.nanopb.h" + +#include "Firestore/core/src/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. +#endif + + + +const pb_field_t google_api_ResourceDescriptor_fields[7] = { + PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_api_ResourceDescriptor, type, type, 0), + PB_FIELD( 2, BYTES , REPEATED, POINTER , OTHER, google_api_ResourceDescriptor, pattern, type, 0), + PB_FIELD( 3, BYTES , SINGULAR, POINTER , OTHER, google_api_ResourceDescriptor, name_field, pattern, 0), + PB_FIELD( 4, UENUM , SINGULAR, STATIC , OTHER, google_api_ResourceDescriptor, history, name_field, 0), + PB_FIELD( 5, BYTES , SINGULAR, POINTER , OTHER, google_api_ResourceDescriptor, plural, history, 0), + PB_FIELD( 6, BYTES , SINGULAR, POINTER , OTHER, google_api_ResourceDescriptor, singular, plural, 0), + PB_LAST_FIELD +}; + +const pb_field_t google_api_ResourceReference_fields[3] = { + PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_api_ResourceReference, type, type, 0), + PB_FIELD( 2, BYTES , SINGULAR, POINTER , OTHER, google_api_ResourceReference, child_type, type, 0), + PB_LAST_FIELD +}; + + + + + + +/* Check that field information fits in pb_field_t */ +#if !defined(PB_FIELD_32BIT) +/* If you get an error here, it means that you need to define PB_FIELD_32BIT + * compile-time option. You can do that in pb.h or on compiler command line. + * + * The reason you need to do this is that some of your messages contain tag + * numbers or field sizes that are larger than what can fit in 8 or 16 bit + * field descriptors. + */ +PB_STATIC_ASSERT((pb_membersize(google_api_resource_reference_struct, resource_reference) < 65536 && pb_membersize(google_api_resource_struct, resource) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_google_api_ResourceDescriptor_google_api_ResourceReference) +#endif + +#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT) +#error Field descriptor for google_api_resource_reference_struct.resource_reference is too large. Define PB_FIELD_16BIT to fix this. +#endif + + +const char* EnumToString( + google_api_ResourceDescriptor_History value) { + switch (value) { + case google_api_ResourceDescriptor_History_HISTORY_UNSPECIFIED: + return "HISTORY_UNSPECIFIED"; + case google_api_ResourceDescriptor_History_ORIGINALLY_SINGLE_PATTERN: + return "ORIGINALLY_SINGLE_PATTERN"; + case google_api_ResourceDescriptor_History_FUTURE_MULTI_PATTERN: + return "FUTURE_MULTI_PATTERN"; + } + return ""; +} + +std::string google_api_ResourceDescriptor::ToString(int indent) const { + std::string header = PrintHeader(indent, "ResourceDescriptor", this); + std::string result; + + result += PrintPrimitiveField("type: ", type, indent + 1, false); + for (pb_size_t i = 0; i != pattern_count; ++i) { + result += PrintPrimitiveField("pattern: ", + pattern[i], indent + 1, true); + } + result += PrintPrimitiveField("name_field: ", + name_field, indent + 1, false); + result += PrintEnumField("history: ", history, indent + 1, false); + result += PrintPrimitiveField("plural: ", plural, indent + 1, false); + result += PrintPrimitiveField("singular: ", singular, 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_ResourceReference::ToString(int indent) const { + std::string header = PrintHeader(indent, "ResourceReference", this); + std::string result; + + result += PrintPrimitiveField("type: ", type, indent + 1, false); + result += PrintPrimitiveField("child_type: ", + child_type, 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 + +/* @@protoc_insertion_point(eof) */ diff --git a/Firestore/Protos/nanopb/google/api/resource.nanopb.h b/Firestore/Protos/nanopb/google/api/resource.nanopb.h new file mode 100644 index 00000000000..ab75b90599f --- /dev/null +++ b/Firestore/Protos/nanopb/google/api/resource.nanopb.h @@ -0,0 +1,118 @@ +/* + * Copyright 2022 Google LLC + * + * 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. + */ + +/* Automatically generated nanopb header */ +/* Generated by nanopb-0.3.9.8 */ + +#ifndef PB_GOOGLE_API_RESOURCE_NANOPB_H_INCLUDED +#define PB_GOOGLE_API_RESOURCE_NANOPB_H_INCLUDED +#include + +#include + +namespace firebase { +namespace firestore { + +/* @@protoc_insertion_point(includes) */ +#if PB_PROTO_HEADER_VERSION != 30 +#error Regenerate this file with the current version of nanopb generator. +#endif + + +/* Enum definitions */ +typedef enum _google_api_ResourceDescriptor_History { + google_api_ResourceDescriptor_History_HISTORY_UNSPECIFIED = 0, + google_api_ResourceDescriptor_History_ORIGINALLY_SINGLE_PATTERN = 1, + google_api_ResourceDescriptor_History_FUTURE_MULTI_PATTERN = 2 +} google_api_ResourceDescriptor_History; +#define _google_api_ResourceDescriptor_History_MIN google_api_ResourceDescriptor_History_HISTORY_UNSPECIFIED +#define _google_api_ResourceDescriptor_History_MAX google_api_ResourceDescriptor_History_FUTURE_MULTI_PATTERN +#define _google_api_ResourceDescriptor_History_ARRAYSIZE ((google_api_ResourceDescriptor_History)(google_api_ResourceDescriptor_History_FUTURE_MULTI_PATTERN+1)) + +/* Struct definitions */ +typedef struct _google_api_ResourceReference { + pb_bytes_array_t *type; + pb_bytes_array_t *child_type; + + std::string ToString(int indent = 0) const; +/* @@protoc_insertion_point(struct:google_api_ResourceReference) */ +} google_api_ResourceReference; + +typedef struct _google_api_ResourceDescriptor { + pb_bytes_array_t *type; + pb_size_t pattern_count; + pb_bytes_array_t **pattern; + pb_bytes_array_t *name_field; + google_api_ResourceDescriptor_History history; + pb_bytes_array_t *plural; + pb_bytes_array_t *singular; + + std::string ToString(int indent = 0) const; +/* @@protoc_insertion_point(struct:google_api_ResourceDescriptor) */ +} google_api_ResourceDescriptor; + +/* Extensions */ +/* Extension field google_api_resource_reference was skipped because only "optional" + type of extension fields is currently supported. */ +/* Extension field google_api_resource_definition was skipped because only "optional" + type of extension fields is currently supported. */ +/* Extension field google_api_resource was skipped because only "optional" + type of extension fields is currently supported. */ + +/* Default values for struct fields */ + +/* Initializer values for message structs */ +#define google_api_ResourceDescriptor_init_default {NULL, 0, NULL, NULL, _google_api_ResourceDescriptor_History_MIN, NULL, NULL} +#define google_api_ResourceReference_init_default {NULL, NULL} +#define google_api_ResourceDescriptor_init_zero {NULL, 0, NULL, NULL, _google_api_ResourceDescriptor_History_MIN, NULL, NULL} +#define google_api_ResourceReference_init_zero {NULL, NULL} + +/* Field tags (for use in manual encoding/decoding) */ +#define google_api_ResourceReference_type_tag 1 +#define google_api_ResourceReference_child_type_tag 2 +#define google_api_ResourceDescriptor_type_tag 1 +#define google_api_ResourceDescriptor_pattern_tag 2 +#define google_api_ResourceDescriptor_name_field_tag 3 +#define google_api_ResourceDescriptor_history_tag 4 +#define google_api_ResourceDescriptor_plural_tag 5 +#define google_api_ResourceDescriptor_singular_tag 6 +#define google_api_resource_reference_tag 1055 +#define google_api_resource_definition_tag 1053 +#define google_api_resource_tag 1053 + +/* Struct field encoding specification for nanopb */ +extern const pb_field_t google_api_ResourceDescriptor_fields[7]; +extern const pb_field_t google_api_ResourceReference_fields[3]; + +/* Maximum encoded size of messages (where known) */ +/* google_api_ResourceDescriptor_size depends on runtime parameters */ +/* google_api_ResourceReference_size depends on runtime parameters */ + +/* Message IDs (where set with "msgid" option) */ +#ifdef PB_MSGID + +#define RESOURCE_MESSAGES \ + + +#endif + +const char* EnumToString(google_api_ResourceDescriptor_History value); +} // namespace firestore +} // namespace firebase + +/* @@protoc_insertion_point(eof) */ + +#endif diff --git a/Firestore/Protos/nanopb/google/firestore/admin/index.nanopb.cc b/Firestore/Protos/nanopb/google/firestore/admin/index.nanopb.cc new file mode 100644 index 00000000000..0ca3df2a573 --- /dev/null +++ b/Firestore/Protos/nanopb/google/firestore/admin/index.nanopb.cc @@ -0,0 +1,160 @@ +/* + * Copyright 2022 Google LLC + * + * 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. + */ + +/* Automatically generated nanopb constant definitions */ +/* Generated by nanopb-0.3.9.8 */ + +#include "index.nanopb.h" + +#include "Firestore/core/src/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. +#endif + + + +const pb_field_t google_firestore_admin_v1_Index_fields[5] = { + PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_admin_v1_Index, name, name, 0), + PB_FIELD( 2, UENUM , SINGULAR, STATIC , OTHER, google_firestore_admin_v1_Index, query_scope, name, 0), + PB_FIELD( 3, MESSAGE , REPEATED, POINTER , OTHER, google_firestore_admin_v1_Index, fields, query_scope, &google_firestore_admin_v1_Index_IndexField_fields), + PB_FIELD( 4, UENUM , SINGULAR, STATIC , OTHER, google_firestore_admin_v1_Index, state, fields, 0), + PB_LAST_FIELD +}; + +const pb_field_t google_firestore_admin_v1_Index_IndexField_fields[4] = { + PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_admin_v1_Index_IndexField, field_path, field_path, 0), + PB_ANONYMOUS_ONEOF_FIELD(value_mode, 2, UENUM , ONEOF, STATIC , OTHER, google_firestore_admin_v1_Index_IndexField, order, field_path, 0), + PB_ANONYMOUS_ONEOF_FIELD(value_mode, 3, UENUM , ONEOF, STATIC , UNION, google_firestore_admin_v1_Index_IndexField, array_config, field_path, 0), + PB_LAST_FIELD +}; + + + + + + +const char* EnumToString( + google_firestore_admin_v1_Index_QueryScope value) { + switch (value) { + case google_firestore_admin_v1_Index_QueryScope_QUERY_SCOPE_UNSPECIFIED: + return "QUERY_SCOPE_UNSPECIFIED"; + case google_firestore_admin_v1_Index_QueryScope_COLLECTION: + return "COLLECTION"; + case google_firestore_admin_v1_Index_QueryScope_COLLECTION_GROUP: + return "COLLECTION_GROUP"; + } + return ""; +} + +const char* EnumToString( + google_firestore_admin_v1_Index_State value) { + switch (value) { + case google_firestore_admin_v1_Index_State_STATE_UNSPECIFIED: + return "STATE_UNSPECIFIED"; + case google_firestore_admin_v1_Index_State_CREATING: + return "CREATING"; + case google_firestore_admin_v1_Index_State_READY: + return "READY"; + case google_firestore_admin_v1_Index_State_NEEDS_REPAIR: + return "NEEDS_REPAIR"; + } + return ""; +} + +const char* EnumToString( + google_firestore_admin_v1_Index_IndexField_Order value) { + switch (value) { + case google_firestore_admin_v1_Index_IndexField_Order_ORDER_UNSPECIFIED: + return "ORDER_UNSPECIFIED"; + case google_firestore_admin_v1_Index_IndexField_Order_ASCENDING: + return "ASCENDING"; + case google_firestore_admin_v1_Index_IndexField_Order_DESCENDING: + return "DESCENDING"; + } + return ""; +} + +const char* EnumToString( + google_firestore_admin_v1_Index_IndexField_ArrayConfig value) { + switch (value) { + case google_firestore_admin_v1_Index_IndexField_ArrayConfig_ARRAY_CONFIG_UNSPECIFIED: + return "ARRAY_CONFIG_UNSPECIFIED"; + case google_firestore_admin_v1_Index_IndexField_ArrayConfig_CONTAINS: + return "CONTAINS"; + } + return ""; +} + +std::string google_firestore_admin_v1_Index::ToString(int indent) const { + std::string header = PrintHeader(indent, "Index", this); + std::string result; + + result += PrintPrimitiveField("name: ", name, indent + 1, false); + result += PrintEnumField("query_scope: ", query_scope, indent + 1, false); + for (pb_size_t i = 0; i != fields_count; ++i) { + result += PrintMessageField("fields ", fields[i], indent + 1, true); + } + result += PrintEnumField("state: ", state, 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_admin_v1_Index_IndexField::ToString(int indent) const { + std::string header = PrintHeader(indent, "IndexField", this); + std::string result; + + result += PrintPrimitiveField("field_path: ", + field_path, indent + 1, false); + switch (which_value_mode) { + case google_firestore_admin_v1_Index_IndexField_order_tag: + result += PrintEnumField("order: ", order, indent + 1, true); + break; + case google_firestore_admin_v1_Index_IndexField_array_config_tag: + result += PrintEnumField("array_config: ", + array_config, 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 + +/* @@protoc_insertion_point(eof) */ diff --git a/Firestore/Protos/nanopb/google/firestore/admin/index.nanopb.h b/Firestore/Protos/nanopb/google/firestore/admin/index.nanopb.h new file mode 100644 index 00000000000..a03cc71d6b3 --- /dev/null +++ b/Firestore/Protos/nanopb/google/firestore/admin/index.nanopb.h @@ -0,0 +1,144 @@ +/* + * Copyright 2022 Google LLC + * + * 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. + */ + +/* Automatically generated nanopb header */ +/* Generated by nanopb-0.3.9.8 */ + +#ifndef PB_GOOGLE_FIRESTORE_ADMIN_V1_INDEX_NANOPB_H_INCLUDED +#define PB_GOOGLE_FIRESTORE_ADMIN_V1_INDEX_NANOPB_H_INCLUDED +#include + +#include "google/api/resource.nanopb.h" + +#include "google/api/annotations.nanopb.h" + +#include + +namespace firebase { +namespace firestore { + +/* @@protoc_insertion_point(includes) */ +#if PB_PROTO_HEADER_VERSION != 30 +#error Regenerate this file with the current version of nanopb generator. +#endif + + +/* Enum definitions */ +typedef enum _google_firestore_admin_v1_Index_QueryScope { + google_firestore_admin_v1_Index_QueryScope_QUERY_SCOPE_UNSPECIFIED = 0, + google_firestore_admin_v1_Index_QueryScope_COLLECTION = 1, + google_firestore_admin_v1_Index_QueryScope_COLLECTION_GROUP = 2 +} google_firestore_admin_v1_Index_QueryScope; +#define _google_firestore_admin_v1_Index_QueryScope_MIN google_firestore_admin_v1_Index_QueryScope_QUERY_SCOPE_UNSPECIFIED +#define _google_firestore_admin_v1_Index_QueryScope_MAX google_firestore_admin_v1_Index_QueryScope_COLLECTION_GROUP +#define _google_firestore_admin_v1_Index_QueryScope_ARRAYSIZE ((google_firestore_admin_v1_Index_QueryScope)(google_firestore_admin_v1_Index_QueryScope_COLLECTION_GROUP+1)) + +typedef enum _google_firestore_admin_v1_Index_State { + google_firestore_admin_v1_Index_State_STATE_UNSPECIFIED = 0, + google_firestore_admin_v1_Index_State_CREATING = 1, + google_firestore_admin_v1_Index_State_READY = 2, + google_firestore_admin_v1_Index_State_NEEDS_REPAIR = 3 +} google_firestore_admin_v1_Index_State; +#define _google_firestore_admin_v1_Index_State_MIN google_firestore_admin_v1_Index_State_STATE_UNSPECIFIED +#define _google_firestore_admin_v1_Index_State_MAX google_firestore_admin_v1_Index_State_NEEDS_REPAIR +#define _google_firestore_admin_v1_Index_State_ARRAYSIZE ((google_firestore_admin_v1_Index_State)(google_firestore_admin_v1_Index_State_NEEDS_REPAIR+1)) + +typedef enum _google_firestore_admin_v1_Index_IndexField_Order { + google_firestore_admin_v1_Index_IndexField_Order_ORDER_UNSPECIFIED = 0, + google_firestore_admin_v1_Index_IndexField_Order_ASCENDING = 1, + google_firestore_admin_v1_Index_IndexField_Order_DESCENDING = 2 +} google_firestore_admin_v1_Index_IndexField_Order; +#define _google_firestore_admin_v1_Index_IndexField_Order_MIN google_firestore_admin_v1_Index_IndexField_Order_ORDER_UNSPECIFIED +#define _google_firestore_admin_v1_Index_IndexField_Order_MAX google_firestore_admin_v1_Index_IndexField_Order_DESCENDING +#define _google_firestore_admin_v1_Index_IndexField_Order_ARRAYSIZE ((google_firestore_admin_v1_Index_IndexField_Order)(google_firestore_admin_v1_Index_IndexField_Order_DESCENDING+1)) + +typedef enum _google_firestore_admin_v1_Index_IndexField_ArrayConfig { + google_firestore_admin_v1_Index_IndexField_ArrayConfig_ARRAY_CONFIG_UNSPECIFIED = 0, + google_firestore_admin_v1_Index_IndexField_ArrayConfig_CONTAINS = 1 +} google_firestore_admin_v1_Index_IndexField_ArrayConfig; +#define _google_firestore_admin_v1_Index_IndexField_ArrayConfig_MIN google_firestore_admin_v1_Index_IndexField_ArrayConfig_ARRAY_CONFIG_UNSPECIFIED +#define _google_firestore_admin_v1_Index_IndexField_ArrayConfig_MAX google_firestore_admin_v1_Index_IndexField_ArrayConfig_CONTAINS +#define _google_firestore_admin_v1_Index_IndexField_ArrayConfig_ARRAYSIZE ((google_firestore_admin_v1_Index_IndexField_ArrayConfig)(google_firestore_admin_v1_Index_IndexField_ArrayConfig_CONTAINS+1)) + +/* Struct definitions */ +typedef struct _google_firestore_admin_v1_Index { + pb_bytes_array_t *name; + google_firestore_admin_v1_Index_QueryScope query_scope; + pb_size_t fields_count; + struct _google_firestore_admin_v1_Index_IndexField *fields; + google_firestore_admin_v1_Index_State state; + + std::string ToString(int indent = 0) const; +/* @@protoc_insertion_point(struct:google_firestore_admin_v1_Index) */ +} google_firestore_admin_v1_Index; + +typedef struct _google_firestore_admin_v1_Index_IndexField { + pb_bytes_array_t *field_path; + pb_size_t which_value_mode; + union { + google_firestore_admin_v1_Index_IndexField_Order order; + google_firestore_admin_v1_Index_IndexField_ArrayConfig array_config; + }; + + std::string ToString(int indent = 0) const; +/* @@protoc_insertion_point(struct:google_firestore_admin_v1_Index_IndexField) */ +} google_firestore_admin_v1_Index_IndexField; + +/* Default values for struct fields */ + +/* Initializer values for message structs */ +#define google_firestore_admin_v1_Index_init_default {NULL, _google_firestore_admin_v1_Index_QueryScope_MIN, 0, NULL, _google_firestore_admin_v1_Index_State_MIN} +#define google_firestore_admin_v1_Index_IndexField_init_default {NULL, 0, {_google_firestore_admin_v1_Index_IndexField_Order_MIN}} +#define google_firestore_admin_v1_Index_init_zero {NULL, _google_firestore_admin_v1_Index_QueryScope_MIN, 0, NULL, _google_firestore_admin_v1_Index_State_MIN} +#define google_firestore_admin_v1_Index_IndexField_init_zero {NULL, 0, {_google_firestore_admin_v1_Index_IndexField_Order_MIN}} + +/* Field tags (for use in manual encoding/decoding) */ +#define google_firestore_admin_v1_Index_name_tag 1 +#define google_firestore_admin_v1_Index_query_scope_tag 2 +#define google_firestore_admin_v1_Index_fields_tag 3 +#define google_firestore_admin_v1_Index_state_tag 4 +#define google_firestore_admin_v1_Index_IndexField_order_tag 2 +#define google_firestore_admin_v1_Index_IndexField_array_config_tag 3 +#define google_firestore_admin_v1_Index_IndexField_field_path_tag 1 + +/* Struct field encoding specification for nanopb */ +extern const pb_field_t google_firestore_admin_v1_Index_fields[5]; +extern const pb_field_t google_firestore_admin_v1_Index_IndexField_fields[4]; + +/* Maximum encoded size of messages (where known) */ +/* google_firestore_admin_v1_Index_size depends on runtime parameters */ +/* google_firestore_admin_v1_Index_IndexField_size depends on runtime parameters */ + +/* Message IDs (where set with "msgid" option) */ +#ifdef PB_MSGID + +#define INDEX_MESSAGES \ + + +#endif + +const char* EnumToString(google_firestore_admin_v1_Index_QueryScope value); +const char* EnumToString(google_firestore_admin_v1_Index_State value); +const char* EnumToString( + google_firestore_admin_v1_Index_IndexField_Order value); +const char* EnumToString( + google_firestore_admin_v1_Index_IndexField_ArrayConfig value); +} // namespace firestore +} // namespace firebase + +/* @@protoc_insertion_point(eof) */ + +#endif diff --git a/Firestore/Protos/protos/google/api/resource.proto b/Firestore/Protos/protos/google/api/resource.proto new file mode 100644 index 00000000000..2a52e61aa2a --- /dev/null +++ b/Firestore/Protos/protos/google/api/resource.proto @@ -0,0 +1,264 @@ +// Copyright 2019 Google LLC. +// +// 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. +// + +syntax = "proto3"; + +package google.api; + +import "google/protobuf/descriptor.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; +option java_multiple_files = true; +option java_outer_classname = "ResourceProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +extend google.protobuf.FieldOptions { + // An annotation that describes a resource reference, see + // [ResourceReference][]. + google.api.ResourceReference resource_reference = 1055; +} + +extend google.protobuf.FileOptions { + // An annotation that describes a resource definition without a corresponding + // message; see [ResourceDescriptor][]. + repeated google.api.ResourceDescriptor resource_definition = 1053; +} + +extend google.protobuf.MessageOptions { + // An annotation that describes a resource definition, see + // [ResourceDescriptor][]. + google.api.ResourceDescriptor resource = 1053; +} + +// A simple descriptor of a resource type. +// +// ResourceDescriptor annotates a resource message (either by means of a +// protobuf annotation or use in the service config), and associates the +// resource's schema, the resource type, and the pattern of the resource name. +// +// Example: +// +// message Topic { +// // Indicates this message defines a resource schema. +// // Declares the resource type in the format of {service}/{kind}. +// // For Kubernetes resources, the format is {api group}/{kind}. +// option (google.api.resource) = { +// type: "pubsub.googleapis.com/Topic" +// name_descriptor: { +// pattern: "projects/{project}/topics/{topic}" +// parent_type: "cloudresourcemanager.googleapis.com/Project" +// parent_name_extractor: "projects/{project}" +// } +// }; +// } +// +// The ResourceDescriptor Yaml config will look like: +// +// resources: +// - type: "pubsub.googleapis.com/Topic" +// name_descriptor: +// - pattern: "projects/{project}/topics/{topic}" +// parent_type: "cloudresourcemanager.googleapis.com/Project" +// parent_name_extractor: "projects/{project}" +// +// Sometimes, resources have multiple patterns, typically because they can +// live under multiple parents. +// +// Example: +// +// message LogEntry { +// option (google.api.resource) = { +// type: "logging.googleapis.com/LogEntry" +// name_descriptor: { +// pattern: "projects/{project}/logs/{log}" +// parent_type: "cloudresourcemanager.googleapis.com/Project" +// parent_name_extractor: "projects/{project}" +// } +// name_descriptor: { +// pattern: "folders/{folder}/logs/{log}" +// parent_type: "cloudresourcemanager.googleapis.com/Folder" +// parent_name_extractor: "folders/{folder}" +// } +// name_descriptor: { +// pattern: "organizations/{organization}/logs/{log}" +// parent_type: "cloudresourcemanager.googleapis.com/Organization" +// parent_name_extractor: "organizations/{organization}" +// } +// name_descriptor: { +// pattern: "billingAccounts/{billing_account}/logs/{log}" +// parent_type: "billing.googleapis.com/BillingAccount" +// parent_name_extractor: "billingAccounts/{billing_account}" +// } +// }; +// } +// +// The ResourceDescriptor Yaml config will look like: +// +// resources: +// - type: 'logging.googleapis.com/LogEntry' +// name_descriptor: +// - pattern: "projects/{project}/logs/{log}" +// parent_type: "cloudresourcemanager.googleapis.com/Project" +// parent_name_extractor: "projects/{project}" +// - pattern: "folders/{folder}/logs/{log}" +// parent_type: "cloudresourcemanager.googleapis.com/Folder" +// parent_name_extractor: "folders/{folder}" +// - pattern: "organizations/{organization}/logs/{log}" +// parent_type: "cloudresourcemanager.googleapis.com/Organization" +// parent_name_extractor: "organizations/{organization}" +// - pattern: "billingAccounts/{billing_account}/logs/{log}" +// parent_type: "billing.googleapis.com/BillingAccount" +// parent_name_extractor: "billingAccounts/{billing_account}" +// +// For flexible resources, the resource name doesn't contain parent names, but +// the resource itself has parents for policy evaluation. +// +// Example: +// +// message Shelf { +// option (google.api.resource) = { +// type: "library.googleapis.com/Shelf" +// name_descriptor: { +// pattern: "shelves/{shelf}" +// parent_type: "cloudresourcemanager.googleapis.com/Project" +// } +// name_descriptor: { +// pattern: "shelves/{shelf}" +// parent_type: "cloudresourcemanager.googleapis.com/Folder" +// } +// }; +// } +// +// The ResourceDescriptor Yaml config will look like: +// +// resources: +// - type: 'library.googleapis.com/Shelf' +// name_descriptor: +// - pattern: "shelves/{shelf}" +// parent_type: "cloudresourcemanager.googleapis.com/Project" +// - pattern: "shelves/{shelf}" +// parent_type: "cloudresourcemanager.googleapis.com/Folder" +message ResourceDescriptor { + // A description of the historical or future-looking state of the + // resource pattern. + enum History { + // The "unset" value. + HISTORY_UNSPECIFIED = 0; + + // The resource originally had one pattern and launched as such, and + // additional patterns were added later. + ORIGINALLY_SINGLE_PATTERN = 1; + + // The resource has one pattern, but the API owner expects to add more + // later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents + // that from being necessary once there are multiple patterns.) + FUTURE_MULTI_PATTERN = 2; + } + + // The resource type. It must be in the format of + // {service_name}/{resource_type_kind}. The `resource_type_kind` must be + // singular and must not include version numbers. + // + // Example: `storage.googleapis.com/Bucket` + // + // The value of the resource_type_kind must follow the regular expression + // /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and + // should use PascalCase (UpperCamelCase). The maximum number of + // characters allowed for the `resource_type_kind` is 100. + string type = 1; + + // Optional. The relative resource name pattern associated with this resource + // type. The DNS prefix of the full resource name shouldn't be specified here. + // + // The path pattern must follow the syntax, which aligns with HTTP binding + // syntax: + // + // Template = Segment { "/" Segment } ; + // Segment = LITERAL | Variable ; + // Variable = "{" LITERAL "}" ; + // + // Examples: + // + // - "projects/{project}/topics/{topic}" + // - "projects/{project}/knowledgeBases/{knowledge_base}" + // + // The components in braces correspond to the IDs for each resource in the + // hierarchy. It is expected that, if multiple patterns are provided, + // the same component name (e.g. "project") refers to IDs of the same + // type of resource. + repeated string pattern = 2; + + // Optional. The field on the resource that designates the resource name + // field. If omitted, this is assumed to be "name". + string name_field = 3; + + // Optional. The historical or future-looking state of the resource pattern. + // + // Example: + // + // // The InspectTemplate message originally only supported resource + // // names with organization, and project was added later. + // message InspectTemplate { + // option (google.api.resource) = { + // type: "dlp.googleapis.com/InspectTemplate" + // pattern: + // "organizations/{organization}/inspectTemplates/{inspect_template}" + // pattern: "projects/{project}/inspectTemplates/{inspect_template}" + // history: ORIGINALLY_SINGLE_PATTERN + // }; + // } + History history = 4; + + // The plural name used in the resource name, such as 'projects' for + // the name of 'projects/{project}'. It is the same concept of the `plural` + // field in k8s CRD spec + // https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ + string plural = 5; + + // The same concept of the `singular` field in k8s CRD spec + // https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ + // Such as "project" for the `resourcemanager.googleapis.com/Project` type. + string singular = 6; +} + +// Defines a proto annotation that describes a string field that refers to +// an API resource. +message ResourceReference { + // The resource type that the annotated field references. + // + // Example: + // + // message Subscription { + // string topic = 2 [(google.api.resource_reference) = { + // type: "pubsub.googleapis.com/Topic" + // }]; + // } + string type = 1; + + // The resource type of a child collection that the annotated field + // references. This is useful for annotating the `parent` field that + // doesn't have a fixed resource type. + // + // Example: + // + // message ListLogEntriesRequest { + // string parent = 1 [(google.api.resource_reference) = { + // child_type: "logging.googleapis.com/LogEntry" + // }; + // } + string child_type = 2; +} diff --git a/Firestore/Protos/protos/google/firestore/admin/index.proto b/Firestore/Protos/protos/google/firestore/admin/index.proto new file mode 100644 index 00000000000..e27686be4b6 --- /dev/null +++ b/Firestore/Protos/protos/google/firestore/admin/index.proto @@ -0,0 +1,158 @@ +// Copyright 2019 Google LLC. +// +// 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. +// + +syntax = "proto3"; + +package google.firestore.admin.v1; + +import "google/api/resource.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.Admin.V1"; +option go_package = "google.golang.org/genproto/googleapis/firestore/admin/v1;admin"; +option java_multiple_files = true; +option java_outer_classname = "IndexProto"; +option java_package = "com.google.firestore.admin.v1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1"; +option ruby_package = "Google::Cloud::Firestore::Admin::V1"; + +// Cloud Firestore indexes enable simple and complex queries against +// documents in a database. +message Index { + option (google.api.resource) = { + type: "firestore.googleapis.com/Index" + pattern: "projects/{project}/databases/{database}/collectionGroups/{collection}/indexes/{index}" + }; + + // A field in an index. + // The field_path describes which field is indexed, the value_mode describes + // how the field value is indexed. + message IndexField { + // The supported orderings. + enum Order { + // The ordering is unspecified. Not a valid option. + ORDER_UNSPECIFIED = 0; + + // The field is ordered by ascending field value. + ASCENDING = 1; + + // The field is ordered by descending field value. + DESCENDING = 2; + } + + // The supported array value configurations. + enum ArrayConfig { + // The index does not support additional array queries. + ARRAY_CONFIG_UNSPECIFIED = 0; + + // The index supports array containment queries. + CONTAINS = 1; + } + + // Can be __name__. + // For single field indexes, this must match the name of the field or may + // be omitted. + string field_path = 1; + + // How the field value is indexed. + oneof value_mode { + // Indicates that this field supports ordering by the specified order or + // comparing using =, <, <=, >, >=. + Order order = 2; + + // Indicates that this field supports operations on `array_value`s. + ArrayConfig array_config = 3; + } + } + + // Query Scope defines the scope at which a query is run. This is specified on + // a StructuredQuery's `from` field. + enum QueryScope { + // The query scope is unspecified. Not a valid option. + QUERY_SCOPE_UNSPECIFIED = 0; + + // Indexes with a collection query scope specified allow queries + // against a collection that is the child of a specific document, specified + // at query time, and that has the collection id specified by the index. + COLLECTION = 1; + + // Indexes with a collection group query scope specified allow queries + // against all collections that has the collection id specified by the + // index. + COLLECTION_GROUP = 2; + } + + // The state of an index. During index creation, an index will be in the + // `CREATING` state. If the index is created successfully, it will transition + // to the `READY` state. If the index creation encounters a problem, the index + // will transition to the `NEEDS_REPAIR` state. + enum State { + // The state is unspecified. + STATE_UNSPECIFIED = 0; + + // The index is being created. + // There is an active long-running operation for the index. + // The index is updated when writing a document. + // Some index data may exist. + CREATING = 1; + + // The index is ready to be used. + // The index is updated when writing a document. + // The index is fully populated from all stored documents it applies to. + READY = 2; + + // The index was being created, but something went wrong. + // There is no active long-running operation for the index, + // and the most recently finished long-running operation failed. + // The index is not updated when writing a document. + // Some index data may exist. + // Use the google.longrunning.Operations API to determine why the operation + // that last attempted to create this index failed, then re-create the + // index. + NEEDS_REPAIR = 3; + } + + // Output only. A server defined name for this index. + // The form of this name for composite indexes will be: + // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{composite_index_id}` + // For single field indexes, this field will be empty. + string name = 1; + + // Indexes with a collection query scope specified allow queries + // against a collection that is the child of a specific document, specified at + // query time, and that has the same collection id. + // + // Indexes with a collection group query scope specified allow queries against + // all collections descended from a specific document, specified at query + // time, and that have the same collection id as this index. + QueryScope query_scope = 2; + + // The fields supported by this index. + // + // For composite indexes, this is always 2 or more fields. + // The last field entry is always for the field path `__name__`. If, on + // creation, `__name__` was not specified as the last field, it will be added + // automatically with the same direction as that of the last field defined. If + // the final field in a composite index is not directional, the `__name__` + // will be ordered ASCENDING (unless explicitly specified). + // + // For single field indexes, this will always be exactly one entry with a + // field path equal to the field path of the associated field. + repeated IndexField fields = 3; + + // Output only. The serving state of the index. + State state = 4; +} From 6e079c816509c55604e43730981c595cb99dcd2a Mon Sep 17 00:00:00 2001 From: Wu-Hui Date: Fri, 11 Feb 2022 10:35:40 -0500 Subject: [PATCH 02/10] temp commit --- Firestore/core/src/local/index_manager.h | 63 ++++++++ .../core/src/local/leveldb_index_manager.cc | 142 ++++++++++++++++++ .../core/src/local/leveldb_index_manager.h | 32 ++++ .../core/src/local/memory_index_manager.cc | 47 ++++++ .../core/src/local/memory_index_manager.h | 20 +++ 5 files changed, 304 insertions(+) diff --git a/Firestore/core/src/local/index_manager.h b/Firestore/core/src/local/index_manager.h index c0fe9401b60..0a71e64552f 100644 --- a/Firestore/core/src/local/index_manager.h +++ b/Firestore/core/src/local/index_manager.h @@ -20,10 +20,20 @@ #include #include +#include "Firestore/core/src/model/model_fwd.h" + namespace firebase { namespace firestore { +namespace core { +class Target; +class SortedMap; +} // namespace model + namespace model { +class DocumentKey; +class FieldIndex; +class IndexOffset; class ResourcePath; } // namespace model @@ -39,6 +49,9 @@ class IndexManager { public: virtual ~IndexManager() = default; + /** Initializes the IndexManager. */ + virtual void Start(); + /** * Creates an index entry mapping the collection_id (last segment of the path) * to the parent path (either the containing document location or the empty @@ -58,6 +71,56 @@ class IndexManager { */ virtual std::vector GetCollectionParents( const std::string& collection_id) = 0; + + /** + * Adds a field path index. + * + * Values for this index are persisted asynchronously. The index will only be + * used for query execution once values are persisted. + */ + virtual void AddFieldIndex(model::FieldIndex index); + + /** Removes the given field index and deletes all index values. */ + virtual void DeleteFieldIndex(model::FieldIndex index); + + /** + * Returns a list of field indexes that correspond to the specified collection + * group. + */ + virtual std::vector GetFieldIndexes(const std::string& collection_group); + + /** Returns all configured field indexes. */ + virtual std::vector GetFieldIndexes(); + + /** + * Returns an index that can be used to serve the provided target. Returns + * `nullopt` if no index is configured. + */ + virtual absl::optional GetFieldIndex(core::Target target); + + /** Returns the documents that match the given target based on the provided index. */ + virtual std::vector GetDocumentsMatchingTarget(model::FieldIndex fieldIndex, core::Target target); + + /** + * Returns the next collection group to update. Returns `nullopt` if no + * group exists. + */ + virtual absl::optional GetNextCollectionGroupToUpdate(); + + /** + * Sets the collection group's latest read time. + * + * This method updates the index offset for all field indices for the + * collection group and increments their sequence number. + * + * Subsequent calls to `getNextCollectionGroupToUpdate()` will return a + * different collection group (unless only one collection group is + * configured). + */ + virtual void UpdateCollectionGroup(const std::string& collection_group, model::IndexOffset offset); + + /** Updates the index entries for the provided documents. */ + virtual void UpdateIndexEntries(model::DocumentMap documents); }; } // namespace local diff --git a/Firestore/core/src/local/leveldb_index_manager.cc b/Firestore/core/src/local/leveldb_index_manager.cc index 9cbf11eb1e8..95d06bbfb2d 100644 --- a/Firestore/core/src/local/leveldb_index_manager.cc +++ b/Firestore/core/src/local/leveldb_index_manager.cc @@ -22,15 +22,54 @@ #include "Firestore/core/src/local/leveldb_key.h" #include "Firestore/core/src/local/leveldb_persistence.h" #include "Firestore/core/src/local/memory_index_manager.h" +#include "Firestore/core/src/model/field_index.h" #include "Firestore/core/src/model/resource_path.h" #include "Firestore/core/src/util/hard_assert.h" +#include "Firestore/third_party/nlohmann_json/json.hpp" #include "absl/strings/match.h" namespace firebase { namespace firestore { namespace local { +using model::DocumentKey; +using model::IndexState; using model::ResourcePath; +using model::SnapshotVersion; +using nlohmann::json; + +namespace { + +struct DbIndexState { + int64_t seconds; + int32_t nanos; + std::string key; + model::ListenSequenceNumber sequence_number; +}; + +void to_json(json& j, const DbIndexState& s) { + j = json{{"seconds", s.seconds}, {"nanos", s.nanos}, + {"key", s.key}, {"seq_num", s.sequence_number}}; +} + +void from_json(const json& j, DbIndexState& s) { + j.at("seconds").get_to(s.seconds); + j.at("nanos").get_to(s.nanos); + j.at("key").get_to(s.key); + j.at("seq_num").get_to(s.sequence_number); +} + +IndexState DecodeIndexState(const std::string& encoded) { + auto j = json::parse(encoded.begin(), encoded.end(), /*callback=*/nullptr, + /*allow_exceptions=*/false); + auto db_state = j.get(); + return {db_state.sequence_number, + SnapshotVersion(Timestamp(db_state.seconds, + db_state.nanos)), + DocumentKey::FromPathString(db_state.key)}; +} + +} // namespace LevelDbIndexManager::LevelDbIndexManager(LevelDbPersistence* db) : db_(db) { } @@ -71,6 +110,109 @@ std::vector LevelDbIndexManager::GetCollectionParents( return results; } +void LevelDbIndexManager::Start() { + std::unordered_map index_states; + + // Fetch all index states if persisted for the user. These states contain per user information + // on how up to date the index is. + { + auto state_iter = db_->current_transaction()->NewIterator(); + auto state_key_prefix = LevelDbIndexStateKey::KeyPrefix(); + LevelDbIndexStateKey state_key; + for (state_iter->Seek(state_key_prefix); state_iter->Valid(); + state_iter->Next()) { + if (!absl::StartsWith(state_iter->key(), state_key_prefix) || + !state_key.Decode(state_iter->key())) { + break; + } + + if (state_key.user_id() != uid_) { + continue; + } + + index_states.insert( + {state_key.index_id(), DecodeIndexState(state_iter->value())}); + } + } + + // Fetch all indices and combine with user's index state if available. + { + auto config_iter = db_->current_transaction()->NewIterator(); + auto config_key_prefix = LevelDbIndexConfigurationKey::KeyPrefix(); + LevelDbIndexConfigurationKey config_key; + for (config_iter->Seek(config_key_prefix); config_iter->Valid(); + config_iter->Next()) { + if (!absl::StartsWith(config_iter->key(), config_key_prefix) || + !config_key.Decode(config_iter->key())) { + break; + } + + static_cast<>(config_key) + } + } + + db.query("SELECT index_id, collection_group, index_proto FROM index_configuration") + .forEach( + row -> { + try { + int indexId = row.getInt(0); + String collectionGroup = row.getString(1); + List segments = + serializer.decodeFieldIndexSegments(Index.parseFrom(row.getBlob(2))); + + // If we fetched an index state for the user above, combine it with this index. + // We use the default state if we don't have an index state (e.g. the index was + // created while a different user as logged in). + FieldIndex.IndexState indexState = + indexStates.containsKey(indexId) + ? indexStates.get(indexId) + : FieldIndex.INITIAL_STATE; + FieldIndex fieldIndex = + FieldIndex.create(indexId, collectionGroup, segments, indexState); + + // Store the index and update `memoizedMaxIndexId` and `memoizedMaxSequenceNumber`. + memoizeIndex(fieldIndex); + } catch (InvalidProtocolBufferException e) { + throw fail("Failed to decode index: " + e); + } + }); + + started_ = true; +} + +void LevelDbIndexManager::AddFieldIndex(model::FieldIndex index) { + IndexManager::AddFieldIndex(index); +} +void LevelDbIndexManager::DeleteFieldIndex(model::FieldIndex index) { + IndexManager::DeleteFieldIndex(index); +} +std::vector LevelDbIndexManager::GetFieldIndexes( + const std::string& collection_group) { + return IndexManager::GetFieldIndexes(collection_group); +} +std::vector LevelDbIndexManager::GetFieldIndexes() { + return IndexManager::GetFieldIndexes(); +} +absl::optional LevelDbIndexManager::GetFieldIndex( + core::Target target) { + return IndexManager::GetFieldIndex(target); +} +std::vector LevelDbIndexManager::GetDocumentsMatchingTarget( + model::FieldIndex fieldIndex, core::Target target) { + return IndexManager::GetDocumentsMatchingTarget(fieldIndex, target); +} +absl::optional +LevelDbIndexManager::GetNextCollectionGroupToUpdate() { + return IndexManager::GetNextCollectionGroupToUpdate(); +} +void LevelDbIndexManager::UpdateCollectionGroup( + const std::string& collection_group, model::IndexOffset offset) { + IndexManager::UpdateCollectionGroup(collection_group, offset); +} +void LevelDbIndexManager::UpdateIndexEntries(model::DocumentMap documents) { + IndexManager::UpdateIndexEntries(documents); +} + } // namespace local } // namespace firestore } // namespace firebase diff --git a/Firestore/core/src/local/leveldb_index_manager.h b/Firestore/core/src/local/leveldb_index_manager.h index 233b8dd58b8..f2f6b72b69b 100644 --- a/Firestore/core/src/local/leveldb_index_manager.h +++ b/Firestore/core/src/local/leveldb_index_manager.h @@ -34,12 +34,32 @@ class LevelDbIndexManager : public IndexManager { public: explicit LevelDbIndexManager(LevelDbPersistence* db); + void Start() override; + void AddToCollectionParentIndex( const model::ResourcePath& collection_path) override; std::vector GetCollectionParents( const std::string& collection_id) override; + void AddFieldIndex(model::FieldIndex index) override; + + void DeleteFieldIndex(model::FieldIndex index) override; + + std::vector GetFieldIndexes(const std::string& collection_group) override; + + std::vector GetFieldIndexes() override; + + absl::optional GetFieldIndex(core::Target target) override; + + std::vector GetDocumentsMatchingTarget(model::FieldIndex fieldIndex, core::Target target) override; + + absl::optional GetNextCollectionGroupToUpdate() override; + + void UpdateCollectionGroup(const std::string& collection_group, model::IndexOffset offset) override; + + void UpdateIndexEntries(model::DocumentMap documents) override; + private: // The LevelDbIndexManager is owned by LevelDbPersistence. LevelDbPersistence* db_; @@ -52,6 +72,18 @@ class LevelDbIndexManager : public IndexManager { * be used to satisfy reads. */ MemoryCollectionParentIndex collection_parents_cache_; + + /** + * An in-memory map from collection group to a map of indexes associated with + * the collection groups. + * + * The map is indexes is keyed off index ids. + */ + std::unordered_map> memoized_indexes_; + + bool started_ = false; + + std::string uid_; }; } // namespace local diff --git a/Firestore/core/src/local/memory_index_manager.cc b/Firestore/core/src/local/memory_index_manager.cc index d8ec923249c..22a5ba0c3d2 100644 --- a/Firestore/core/src/local/memory_index_manager.cc +++ b/Firestore/core/src/local/memory_index_manager.cc @@ -21,6 +21,9 @@ #include #include +#include "Firestore/core/src/core/target.h" +#include "Firestore/core/src/model/field_index.h" +#include "Firestore/core/src/model/model_fwd.h" #include "Firestore/core/src/model/resource_path.h" #include "Firestore/core/src/util/hard_assert.h" @@ -62,6 +65,50 @@ std::vector MemoryIndexManager::GetCollectionParents( return collection_parents_index_.GetEntries(collection_id); } +// Below methods are only stubs because field indices are not supported with +// memory persistence. + +void MemoryIndexManager::Start() { +} + +void MemoryIndexManager::AddFieldIndex(model::FieldIndex index) { +} + +void MemoryIndexManager::DeleteFieldIndex(model::FieldIndex index) { +} + +std::vector MemoryIndexManager::GetFieldIndexes( + const std::string& collection_group) { + return {}; +} + +std::vector MemoryIndexManager::GetFieldIndexes() { + return {}; +} + +absl::optional MemoryIndexManager::GetFieldIndex( + core::Target target) { + return absl::nullopt; +} + +std::vector MemoryIndexManager::GetDocumentsMatchingTarget( + model::FieldIndex fieldIndex, core::Target target) { + return {}; +} + +absl::optional +MemoryIndexManager::GetNextCollectionGroupToUpdate() { + return absl::nullopt; +} + +void MemoryIndexManager::UpdateCollectionGroup( + const std::string& collection_group, model::IndexOffset offset) { +} + +void MemoryIndexManager::UpdateIndexEntries(model::DocumentMap documents) { + (void)documents; +} + } // namespace local } // namespace firestore } // namespace firebase diff --git a/Firestore/core/src/local/memory_index_manager.h b/Firestore/core/src/local/memory_index_manager.h index f3f7bef0b23..a982ebfe59a 100644 --- a/Firestore/core/src/local/memory_index_manager.h +++ b/Firestore/core/src/local/memory_index_manager.h @@ -48,12 +48,32 @@ class MemoryCollectionParentIndex { /** An in-memory implementation of IndexManager. */ class MemoryIndexManager : public IndexManager { public: + void Start() override; + void AddToCollectionParentIndex( const model::ResourcePath& collection_path) override; std::vector GetCollectionParents( const std::string& collection_id) override; +void AddFieldIndex(model::FieldIndex index) override; + + void DeleteFieldIndex(model::FieldIndex index) override; + + std::vector GetFieldIndexes(const std::string& collection_group) override; + + std::vector GetFieldIndexes() override; + + absl::optional GetFieldIndex(core::Target target) override; + + std::vector GetDocumentsMatchingTarget(model::FieldIndex fieldIndex, core::Target target) override; + + absl::optional GetNextCollectionGroupToUpdate() override; + + void UpdateCollectionGroup(const std::string& collection_group, model::IndexOffset offset) override; + + void UpdateIndexEntries(model::DocumentMap documents) override; + private: MemoryCollectionParentIndex collection_parents_index_; }; From 1b60b0f0befb0e601ead4aef68f01dff251f1983 Mon Sep 17 00:00:00 2001 From: Wu-Hui Date: Tue, 15 Feb 2022 12:56:48 -0500 Subject: [PATCH 03/10] Configureation CRUD. --- Firestore/core/src/local/index_manager.h | 31 ++- .../core/src/local/leveldb_index_manager.cc | 244 +++++++++++++----- .../core/src/local/leveldb_index_manager.h | 46 +++- Firestore/core/src/local/leveldb_key.cc | 34 ++- Firestore/core/src/local/leveldb_key.h | 14 +- .../core/src/local/leveldb_persistence.cc | 2 +- Firestore/core/src/local/local_serializer.cc | 75 ++++++ Firestore/core/src/local/local_serializer.h | 8 + .../core/src/local/memory_index_manager.cc | 15 +- .../core/src/local/memory_index_manager.h | 16 +- Firestore/core/src/nanopb/fields_array.h | 6 + .../unit/local/leveldb_index_manager_test.cc | 75 ++++++ .../core/test/unit/local/leveldb_key_test.cc | 46 +++- Firestore/core/test/unit/testutil/testutil.cc | 11 + Firestore/core/test/unit/testutil/testutil.h | 5 + 15 files changed, 523 insertions(+), 105 deletions(-) diff --git a/Firestore/core/src/local/index_manager.h b/Firestore/core/src/local/index_manager.h index 0a71e64552f..0352d5ec8fa 100644 --- a/Firestore/core/src/local/index_manager.h +++ b/Firestore/core/src/local/index_manager.h @@ -28,7 +28,7 @@ namespace firestore { namespace core { class Target; class SortedMap; -} // namespace model +} // namespace core namespace model { class DocumentKey; @@ -50,7 +50,7 @@ class IndexManager { virtual ~IndexManager() = default; /** Initializes the IndexManager. */ - virtual void Start(); + virtual void Start() = 0; /** * Creates an index entry mapping the collection_id (last segment of the path) @@ -78,34 +78,38 @@ class IndexManager { * Values for this index are persisted asynchronously. The index will only be * used for query execution once values are persisted. */ - virtual void AddFieldIndex(model::FieldIndex index); + virtual void AddFieldIndex(const model::FieldIndex& index) = 0; /** Removes the given field index and deletes all index values. */ - virtual void DeleteFieldIndex(model::FieldIndex index); + virtual void DeleteFieldIndex(const model::FieldIndex& index) = 0; /** * Returns a list of field indexes that correspond to the specified collection * group. */ - virtual std::vector GetFieldIndexes(const std::string& collection_group); + virtual std::vector GetFieldIndexes( + const std::string& collection_group) = 0; /** Returns all configured field indexes. */ - virtual std::vector GetFieldIndexes(); + virtual std::vector GetFieldIndexes() = 0; /** * Returns an index that can be used to serve the provided target. Returns * `nullopt` if no index is configured. */ - virtual absl::optional GetFieldIndex(core::Target target); + virtual absl::optional GetFieldIndex( + core::Target target) = 0; - /** Returns the documents that match the given target based on the provided index. */ - virtual std::vector GetDocumentsMatchingTarget(model::FieldIndex fieldIndex, core::Target target); + /** Returns the documents that match the given target based on the provided + * index. */ + virtual std::vector GetDocumentsMatchingTarget( + model::FieldIndex fieldIndex, core::Target target) = 0; /** * Returns the next collection group to update. Returns `nullopt` if no * group exists. */ - virtual absl::optional GetNextCollectionGroupToUpdate(); + virtual absl::optional GetNextCollectionGroupToUpdate() = 0; /** * Sets the collection group's latest read time. @@ -113,14 +117,15 @@ class IndexManager { * This method updates the index offset for all field indices for the * collection group and increments their sequence number. * - * Subsequent calls to `getNextCollectionGroupToUpdate()` will return a + * Subsequent calls to `GetNextCollectionGroupToUpdate()` will return a * different collection group (unless only one collection group is * configured). */ - virtual void UpdateCollectionGroup(const std::string& collection_group, model::IndexOffset offset); + virtual void UpdateCollectionGroup(const std::string& collection_group, + model::IndexOffset offset) = 0; /** Updates the index entries for the provided documents. */ - virtual void UpdateIndexEntries(model::DocumentMap documents); + virtual void UpdateIndexEntries(const model::DocumentMap& documents) = 0; }; } // namespace local diff --git a/Firestore/core/src/local/leveldb_index_manager.cc b/Firestore/core/src/local/leveldb_index_manager.cc index 95d06bbfb2d..8bbcb6d494e 100644 --- a/Firestore/core/src/local/leveldb_index_manager.cc +++ b/Firestore/core/src/local/leveldb_index_manager.cc @@ -16,13 +16,16 @@ #include "Firestore/core/src/local/leveldb_index_manager.h" +#include #include +#include #include #include "Firestore/core/src/local/leveldb_key.h" #include "Firestore/core/src/local/leveldb_persistence.h" -#include "Firestore/core/src/local/memory_index_manager.h" +#include "Firestore/core/src/local/local_serializer.h" #include "Firestore/core/src/model/field_index.h" +#include "Firestore/core/src/model/model_fwd.h" #include "Firestore/core/src/model/resource_path.h" #include "Firestore/core/src/util/hard_assert.h" #include "Firestore/third_party/nlohmann_json/json.hpp" @@ -33,6 +36,7 @@ namespace firestore { namespace local { using model::DocumentKey; +using model::FieldIndex; using model::IndexState; using model::ResourcePath; using model::SnapshotVersion; @@ -47,13 +51,16 @@ struct DbIndexState { model::ListenSequenceNumber sequence_number; }; -void to_json(json& j, const DbIndexState& s) { - j = json{{"seconds", s.seconds}, {"nanos", s.nanos}, - {"key", s.key}, {"seq_num", s.sequence_number}}; -} +// TODO(wuandy): Uncomment this when needed. +// void to_json(json& j, const DbIndexState& s) { +// j = json{{"seconds", s.seconds}, +// {"nanos", s.nanos}, +// {"key", s.key}, +// {"seq_num", s.sequence_number}}; +//} void from_json(const json& j, DbIndexState& s) { - j.at("seconds").get_to(s.seconds); + j.at("seconds").get_to(s.seconds); j.at("nanos").get_to(s.nanos); j.at("key").get_to(s.key); j.at("seq_num").get_to(s.sequence_number); @@ -61,17 +68,25 @@ void from_json(const json& j, DbIndexState& s) { IndexState DecodeIndexState(const std::string& encoded) { auto j = json::parse(encoded.begin(), encoded.end(), /*callback=*/nullptr, - /*allow_exceptions=*/false); + /*allow_exceptions=*/false); auto db_state = j.get(); return {db_state.sequence_number, - SnapshotVersion(Timestamp(db_state.seconds, - db_state.nanos)), - DocumentKey::FromPathString(db_state.key)}; + SnapshotVersion(Timestamp(db_state.seconds, db_state.nanos)), + DocumentKey::FromPathString(db_state.key)}; } -} // namespace +} // namespace -LevelDbIndexManager::LevelDbIndexManager(LevelDbPersistence* db) : db_(db) { +LevelDbIndexManager::LevelDbIndexManager(LevelDbPersistence* db, + LocalSerializer* serializer) + : db_(db), serializer_(serializer) { + auto cmp = [](FieldIndex* left, FieldIndex* right) { + return left->index_state().sequence_number() < + right->index_state().sequence_number(); + }; + next_index_to_update_ = std::priority_queue< + FieldIndex*, std::vector, + std::function>(cmp); } void LevelDbIndexManager::AddToCollectionParentIndex( @@ -113,8 +128,8 @@ std::vector LevelDbIndexManager::GetCollectionParents( void LevelDbIndexManager::Start() { std::unordered_map index_states; - // Fetch all index states if persisted for the user. These states contain per user information - // on how up to date the index is. + // Fetch all index states if persisted for the user. These states contain per + // user information on how up to date the index is. { auto state_iter = db_->current_transaction()->NewIterator(); auto state_key_prefix = LevelDbIndexStateKey::KeyPrefix(); @@ -147,70 +162,179 @@ void LevelDbIndexManager::Start() { break; } - static_cast<>(config_key) + nanopb::StringReader reader{config_iter->value()}; + auto message = + nanopb::Message::TryParse(&reader); + if (!reader.ok()) { + HARD_FAIL("Index proto failed to parse: %s", + reader.status().ToString()); + } + + auto segments = serializer_->DecodeFieldIndexSegments(&reader, *message); + if (!reader.ok()) { + HARD_FAIL("Index proto failed to decode: %s", + reader.status().ToString()); + } + + // If we fetched an index state for the user above, combine it with this + // index. We use the default state if we don't have an index state (e.g. + // the index was created while a different user as logged in). + auto iter = index_states.find(config_key.index_id()); + IndexState state = iter != index_states.end() + ? iter->second + : FieldIndex::InitialState(); + + // Store the index and update `memoizedMaxIndexId` and + // `memoizedMaxSequenceNumber`. + MemoizeIndex(FieldIndex(config_key.index_id(), + config_key.collection_group(), + std::move(segments), state)); + } + } + + started_ = true; +} + +void LevelDbIndexManager::DeleteFromUpdateQueue(FieldIndex* index_ptr) { + // Pop and save `FieldIndex*` until index_ptr is found, then pushed what are + // popped out back to `next_index_to_update_` except for `index_ptr`. + std::vector popped_out; + while (!next_index_to_update_.empty()) { + auto* top = next_index_to_update_.top(); + next_index_to_update_.pop(); + if (top == index_ptr) { + break; + } else { + popped_out.push_back(top); + } + } + + for (auto* index : popped_out) { + next_index_to_update_.push(index); + } +} + +void LevelDbIndexManager::MemoizeIndex(FieldIndex index) { + auto& existing_indexes = memoized_indexes_[index.collection_group()]; + + // Copy some value out because `index` will be moved to `existing_index_` + // later. + auto index_id = index.index_id(); + auto sequence_number = index.index_state().sequence_number(); + + auto existing_index_iter = existing_indexes.find(index_id); + + // Pop and save `FieldIndex*` until existing_index_iter->second is found. + // This is essentially deleting existing_index_iter->second from the queue + // because `popped_out` will be pushed back to `next_index_to_update_` later. + if (existing_index_iter != existing_indexes.end()) { + DeleteFromUpdateQueue(&existing_index_iter->second); + } + + // Moves `index` into `existing_indexes`. + existing_indexes.insert({index_id, std::move(index)}); + // next_index_to_update_ holds a pointer to Index owned by `existing_indexes`. + next_index_to_update_.push(&existing_indexes.find(index_id)->second); + memoized_max_index_id_ = std::max(memoized_max_index_id_, index_id); + memoized_max_sequence_number_ = + std::max(memoized_max_sequence_number_, sequence_number); +} + +void LevelDbIndexManager::AddFieldIndex(const FieldIndex& index) { + HARD_ASSERT(started_, "IndexManager not started"); + + int next_index_id = memoized_max_index_id_ + 1; + FieldIndex new_index(next_index_id, index.collection_group(), + index.segments(), index.index_state()); + + auto config_key = LevelDbIndexConfigurationKey::Key( + new_index.index_id(), new_index.collection_group()); + db_->current_transaction()->Put( + config_key, serializer_->EncodeFieldIndexSegments(new_index.segments())); + + MemoizeIndex(std::move(new_index)); +} + +void LevelDbIndexManager::DeleteFieldIndex(const FieldIndex& index) { + HARD_ASSERT(started_, "IndexManager not started"); + + db_->current_transaction()->Delete(LevelDbIndexConfigurationKey::Key( + index.index_id(), index.collection_group())); + + db_->current_transaction()->Delete( + LevelDbIndexStateKey::Key(index.index_id(), uid_)); + + auto entry_prefix = LevelDbIndexEntryKey::KeyPrefix(index.index_id(), uid_); + auto iter = db_->current_transaction()->NewIterator(); + for (iter->Seek(entry_prefix); iter->Valid(); iter->Next()) { + if (!absl::StartsWith(iter->key(), entry_prefix)) { + break; + } + db_->current_transaction()->Delete(iter->key()); + } + + auto group_index_iter = memoized_indexes_.find(index.collection_group()); + if (group_index_iter != memoized_indexes_.end()) { + auto& index_map = group_index_iter->second; + auto index_iter = index_map.find(index.index_id()); + if (index_iter != index_map.end()) { + DeleteFromUpdateQueue(&index_iter->second); + index_map.erase(index.index_id()); } } +} - db.query("SELECT index_id, collection_group, index_proto FROM index_configuration") - .forEach( - row -> { - try { - int indexId = row.getInt(0); - String collectionGroup = row.getString(1); - List segments = - serializer.decodeFieldIndexSegments(Index.parseFrom(row.getBlob(2))); - - // If we fetched an index state for the user above, combine it with this index. - // We use the default state if we don't have an index state (e.g. the index was - // created while a different user as logged in). - FieldIndex.IndexState indexState = - indexStates.containsKey(indexId) - ? indexStates.get(indexId) - : FieldIndex.INITIAL_STATE; - FieldIndex fieldIndex = - FieldIndex.create(indexId, collectionGroup, segments, indexState); - - // Store the index and update `memoizedMaxIndexId` and `memoizedMaxSequenceNumber`. - memoizeIndex(fieldIndex); - } catch (InvalidProtocolBufferException e) { - throw fail("Failed to decode index: " + e); - } - }); - - started_ = true; -} - -void LevelDbIndexManager::AddFieldIndex(model::FieldIndex index) { - IndexManager::AddFieldIndex(index); -} -void LevelDbIndexManager::DeleteFieldIndex(model::FieldIndex index) { - IndexManager::DeleteFieldIndex(index); -} -std::vector LevelDbIndexManager::GetFieldIndexes( +std::vector LevelDbIndexManager::GetFieldIndexes( const std::string& collection_group) { - return IndexManager::GetFieldIndexes(collection_group); + HARD_ASSERT(started_, "IndexManager not started"); + + std::vector result; + const auto& indexes = memoized_indexes_[collection_group]; + for (const auto& entry : indexes) { + result.push_back(entry.second); + } + + return result; } + std::vector LevelDbIndexManager::GetFieldIndexes() { - return IndexManager::GetFieldIndexes(); + std::vector result; + for (const auto& entry : memoized_indexes_) { + for (const auto& id_index_entry : entry.second) { + result.push_back(id_index_entry.second); + } + } + + return result; } + absl::optional LevelDbIndexManager::GetFieldIndex( core::Target target) { - return IndexManager::GetFieldIndex(target); + (void)target; + return {}; } + std::vector LevelDbIndexManager::GetDocumentsMatchingTarget( - model::FieldIndex fieldIndex, core::Target target) { - return IndexManager::GetDocumentsMatchingTarget(fieldIndex, target); + model::FieldIndex field_index, core::Target target) { + (void)field_index; + (void)target; + return {}; } + absl::optional LevelDbIndexManager::GetNextCollectionGroupToUpdate() { - return IndexManager::GetNextCollectionGroupToUpdate(); + return {}; } + void LevelDbIndexManager::UpdateCollectionGroup( const std::string& collection_group, model::IndexOffset offset) { - IndexManager::UpdateCollectionGroup(collection_group, offset); + (void)collection_group; + (void)offset; } -void LevelDbIndexManager::UpdateIndexEntries(model::DocumentMap documents) { - IndexManager::UpdateIndexEntries(documents); + +void LevelDbIndexManager::UpdateIndexEntries( + const model::DocumentMap& documents) { + (void)documents; } } // namespace local diff --git a/Firestore/core/src/local/leveldb_index_manager.h b/Firestore/core/src/local/leveldb_index_manager.h index f2f6b72b69b..2eef79c3fbb 100644 --- a/Firestore/core/src/local/leveldb_index_manager.h +++ b/Firestore/core/src/local/leveldb_index_manager.h @@ -17,7 +17,9 @@ #ifndef FIRESTORE_CORE_SRC_LOCAL_LEVELDB_INDEX_MANAGER_H_ #define FIRESTORE_CORE_SRC_LOCAL_LEVELDB_INDEX_MANAGER_H_ +#include #include +#include #include #include "Firestore/core/src/local/index_manager.h" @@ -28,11 +30,13 @@ namespace firestore { namespace local { class LevelDbPersistence; +class LocalSerializer; /** A persisted implementation of IndexManager. */ class LevelDbIndexManager : public IndexManager { public: - explicit LevelDbIndexManager(LevelDbPersistence* db); + explicit LevelDbIndexManager(LevelDbPersistence* db, + LocalSerializer* serializer); void Start() override; @@ -42,25 +46,42 @@ class LevelDbIndexManager : public IndexManager { std::vector GetCollectionParents( const std::string& collection_id) override; - void AddFieldIndex(model::FieldIndex index) override; + void AddFieldIndex(const model::FieldIndex& index) override; - void DeleteFieldIndex(model::FieldIndex index) override; + void DeleteFieldIndex(const model::FieldIndex& index) override; - std::vector GetFieldIndexes(const std::string& collection_group) override; + std::vector GetFieldIndexes( + const std::string& collection_group) override; std::vector GetFieldIndexes() override; absl::optional GetFieldIndex(core::Target target) override; - std::vector GetDocumentsMatchingTarget(model::FieldIndex fieldIndex, core::Target target) override; + std::vector GetDocumentsMatchingTarget( + model::FieldIndex fieldIndex, core::Target target) override; absl::optional GetNextCollectionGroupToUpdate() override; - void UpdateCollectionGroup(const std::string& collection_group, model::IndexOffset offset) override; + void UpdateCollectionGroup(const std::string& collection_group, + model::IndexOffset offset) override; - void UpdateIndexEntries(model::DocumentMap documents) override; + void UpdateIndexEntries(const model::DocumentMap& documents) override; private: + using QueueForNextIndexToUpdate = std::priority_queue< + model::FieldIndex*, + std::vector, + std::function>; + + /** + * Stores the index in the memoized indexes table and updates + * `next_index_to_update_` `memoized_max_index_id_` and + * `memoized_max_sequence_number_`. + */ + void MemoizeIndex(model::FieldIndex index); + + void DeleteFromUpdateQueue(model::FieldIndex* index); + // The LevelDbIndexManager is owned by LevelDbPersistence. LevelDbPersistence* db_; @@ -79,7 +100,16 @@ class LevelDbIndexManager : public IndexManager { * * The map is indexes is keyed off index ids. */ - std::unordered_map> memoized_indexes_; + std::unordered_map> + memoized_indexes_; + + QueueForNextIndexToUpdate next_index_to_update_; + int32_t memoized_max_index_id_ = -1; + int64_t memoized_max_sequence_number_ = -1; + + /* Owned by LevelDbPersistence. */ + LocalSerializer* serializer_ = nullptr; bool started_ = false; diff --git a/Firestore/core/src/local/leveldb_key.cc b/Firestore/core/src/local/leveldb_key.cc index 1fd75958f63..2eca0264343 100644 --- a/Firestore/core/src/local/leveldb_key.cc +++ b/Firestore/core/src/local/leveldb_key.cc @@ -127,6 +127,9 @@ enum ComponentLabel { /** A component containing a directional index value. */ IndexDirectionalValue = 21, + /** A component containing a collection group name. */ + CollectionGroup = 22, + /** * A path segment describes just a single segment in a resource path. Path * segments that occur sequentially in a key represent successive segments in @@ -217,6 +220,10 @@ class Reader { return ReadLabeledInt32(ComponentLabel::IndexId); } + std::string ReadCollectionGroup() { + return ReadLabeledString(ComponentLabel::CollectionGroup); + } + std::string ReadIndexArrayValue() { return ReadLabeledString(ComponentLabel::IndexArrayValue); } @@ -596,6 +603,11 @@ std::string Reader::Describe() { if (ok_) { absl::StrAppend(&description, " index_id=", index_id); } + } else if (label == ComponentLabel::CollectionGroup) { + auto group = ReadCollectionGroup(); + if (ok_) { + absl::StrAppend(&description, " collection_group=", group); + } } else if (label == ComponentLabel::IndexArrayValue) { std::string value = ReadIndexArrayValue(); if (ok_) { @@ -693,6 +705,10 @@ class Writer { WriteLabeledInt32(ComponentLabel::IndexId, id); } + void WriteCollectionGroup(absl::string_view collection_group) { + WriteLabeledString(ComponentLabel::CollectionGroup, collection_group); + } + void WriteIndexArrayValue(absl::string_view value) { WriteLabeledString(ComponentLabel::IndexArrayValue, value); } @@ -1151,10 +1167,12 @@ std::string LevelDbIndexConfigurationKey::KeyPrefix() { return writer.result(); } -std::string LevelDbIndexConfigurationKey::Key(int32_t id) { +std::string LevelDbIndexConfigurationKey::Key( + int32_t id, absl::string_view collection_group) { Writer writer; writer.WriteTableName(kIndexConfigurationTable); writer.WriteIndexId(id); + writer.WriteCollectionGroup(collection_group); writer.WriteTerminator(); return writer.result(); } @@ -1163,6 +1181,7 @@ bool LevelDbIndexConfigurationKey::Decode(absl::string_view key) { Reader reader{key}; reader.ReadTableNameMatching(kIndexConfigurationTable); index_id_ = reader.ReadIndexId(); + collection_group_ = reader.ReadCollectionGroup(); reader.ReadTerminator(); return reader.ok(); } @@ -1198,17 +1217,26 @@ std::string LevelDbIndexEntryKey::KeyPrefix() { return writer.result(); } +std::string LevelDbIndexEntryKey::KeyPrefix(int32_t index_id, + absl::string_view user_id) { + Writer writer; + writer.WriteTableName(kIndexEntriesTable); + writer.WriteIndexId(index_id); + writer.WriteUserId(user_id); + return writer.result(); +} + std::string LevelDbIndexEntryKey::Key(int32_t index_id, absl::string_view user_id, absl::string_view array_value, - absl::string_view dicrectional_value, + absl::string_view directional_value, absl::string_view document_key) { Writer writer; writer.WriteTableName(kIndexEntriesTable); writer.WriteIndexId(index_id); writer.WriteUserId(user_id); writer.WriteIndexArrayValue(array_value); - writer.WriteIndexDirectionalValue(dicrectional_value); + writer.WriteIndexDirectionalValue(directional_value); writer.WriteDocumentId(document_key); writer.WriteTerminator(); return writer.result(); diff --git a/Firestore/core/src/local/leveldb_key.h b/Firestore/core/src/local/leveldb_key.h index be071e859cc..35ded2d60ec 100644 --- a/Firestore/core/src/local/leveldb_key.h +++ b/Firestore/core/src/local/leveldb_key.h @@ -744,7 +744,7 @@ class LevelDbIndexConfigurationKey { /** * Creates a key that points to the key for the given index id. */ - static std::string Key(int32_t id); + static std::string Key(int32_t id, absl::string_view collection_group); /** * Decodes the given complete key, storing the decoded values in this @@ -762,8 +762,14 @@ class LevelDbIndexConfigurationKey { return index_id_; } + /** The collection group for this index. */ + const std::string& collection_group() const { + return collection_group_; + } + private: int32_t index_id_; + std::string collection_group_; }; /** @@ -821,6 +827,12 @@ class LevelDbIndexEntryKey { */ static std::string KeyPrefix(); + /** + * Creates a key prefix that points the first entry of a given index_id for + * a user. + */ + static std::string KeyPrefix(int32_t index_id, absl::string_view user_id); + /** * Creates a key that points to the key for the given index entry fields. */ diff --git a/Firestore/core/src/local/leveldb_persistence.cc b/Firestore/core/src/local/leveldb_persistence.cc index 6df368f85c8..f62e3629a1c 100644 --- a/Firestore/core/src/local/leveldb_persistence.cc +++ b/Firestore/core/src/local/leveldb_persistence.cc @@ -114,7 +114,7 @@ LevelDbPersistence::LevelDbPersistence(std::unique_ptr db, target_cache_ = absl::make_unique(this, &serializer_); document_cache_ = absl::make_unique(this, &serializer_); - index_manager_ = absl::make_unique(this); + index_manager_ = absl::make_unique(this, &serializer_); reference_delegate_ = absl::make_unique(this, lru_params); bundle_cache_ = absl::make_unique(this, &serializer_); diff --git a/Firestore/core/src/local/local_serializer.cc b/Firestore/core/src/local/local_serializer.cc index 770c5d9474b..735c88bdab9 100644 --- a/Firestore/core/src/local/local_serializer.cc +++ b/Firestore/core/src/local/local_serializer.cc @@ -26,11 +26,13 @@ #include "Firestore/Protos/nanopb/firestore/local/maybe_document.nanopb.h" #include "Firestore/Protos/nanopb/firestore/local/mutation.nanopb.h" #include "Firestore/Protos/nanopb/firestore/local/target.nanopb.h" +#include "Firestore/Protos/nanopb/google/firestore/admin/index.nanopb.h" #include "Firestore/Protos/nanopb/google/firestore/v1/document.nanopb.h" #include "Firestore/core/src/bundle/bundle_metadata.h" #include "Firestore/core/src/bundle/named_query.h" #include "Firestore/core/src/core/query.h" #include "Firestore/core/src/local/target_data.h" +#include "Firestore/core/src/model/field_path.h" #include "Firestore/core/src/model/mutable_document.h" #include "Firestore/core/src/model/mutation_batch.h" #include "Firestore/core/src/model/snapshot_version.h" @@ -38,6 +40,7 @@ #include "Firestore/core/src/nanopb/message.h" #include "Firestore/core/src/nanopb/nanopb_util.h" #include "Firestore/core/src/util/hard_assert.h" +#include "Firestore/core/src/util/statusor.h" #include "Firestore/core/src/util/string_format.h" #include "absl/types/span.h" @@ -51,11 +54,13 @@ using bundle::BundleMetadata; using bundle::NamedQuery; using core::Target; using model::DeepClone; +using model::FieldPath; using model::FieldTransform; using model::MutableDocument; using model::Mutation; using model::MutationBatch; using model::ObjectValue; +using model::Segment; using model::SnapshotVersion; using nanopb::ByteString; using nanopb::CheckedSize; @@ -453,6 +458,76 @@ BundledQuery LocalSerializer::DecodeBundledQuery( limit_type); } +std::vector LocalSerializer::DecodeFieldIndexSegments( + nanopb::Reader* reader, google_firestore_admin_v1_Index& index) const { + std::vector result; + for (size_t i = 0; i < index.fields_count; ++i) { + const auto& field = index.fields[i]; + + util::StatusOr field_path = + FieldPath::FromServerFormat(nanopb::MakeString(field.field_path)); + if (!field_path.ok()) { + reader->Fail( + StringFormat("Failed to read field path for index segment: %s", + nanopb::MakeString(field.field_path))); + return {}; + } + + Segment::Kind kind = Segment::Kind::kContains; + if (field.which_value_mode != + google_firestore_admin_v1_Index_IndexField_array_config_tag) { + if (field.order == + google_firestore_admin_v1_Index_IndexField_Order_ASCENDING) { + kind = Segment::Kind::kAscending; + } else { + kind = Segment::Kind::kDescending; + } + } + + result.push_back({field_path.ValueOrDie(), kind}); + } + + return result; +} + +nanopb::Message +LocalSerializer::EncodeFieldIndexSegments( + const std::vector& segments) const { + Message result; + + result->query_scope = + google_firestore_admin_v1_Index_QueryScope_COLLECTION_GROUP; + + result->fields_count = segments.size(); + result->fields = + MakeArray(segments.size()); + int i = 0; + for (const auto& segment : segments) { + google_firestore_admin_v1_Index_IndexField field; + field.field_path = + nanopb::MakeBytesArray(segment.field_path().CanonicalString()); + if (segment.kind() == model::Segment::kContains) { + field.which_value_mode = + google_firestore_admin_v1_Index_IndexField_array_config_tag; + field.array_config = + google_firestore_admin_v1_Index_IndexField_ArrayConfig_CONTAINS; + } else if (segment.kind() == model::Segment::kAscending) { + field.which_value_mode = + google_firestore_admin_v1_Index_IndexField_order_tag; + field.order = google_firestore_admin_v1_Index_IndexField_Order_ASCENDING; + } else { + field.which_value_mode = + google_firestore_admin_v1_Index_IndexField_order_tag; + field.order = google_firestore_admin_v1_Index_IndexField_Order_DESCENDING; + } + + result->fields[i] = std::move(field); + ++i; + } + + return result; +} + } // namespace local } // namespace firestore } // namespace firebase diff --git a/Firestore/core/src/local/local_serializer.h b/Firestore/core/src/local/local_serializer.h index 2a7396ec685..d129ffe5d32 100644 --- a/Firestore/core/src/local/local_serializer.h +++ b/Firestore/core/src/local/local_serializer.h @@ -21,6 +21,7 @@ #include #include +#include "Firestore/core/src/model/field_index.h" #include "Firestore/core/src/model/model_fwd.h" #include "Firestore/core/src/model/types.h" #include "Firestore/core/src/remote/serializer.h" @@ -38,6 +39,7 @@ typedef struct _firestore_client_Target firestore_client_Target; typedef struct _firestore_client_UnknownDocument firestore_client_UnknownDocument; typedef struct _firestore_client_WriteBatch firestore_client_WriteBatch; +typedef struct _google_firestore_admin_v1_Index google_firestore_admin_v1_Index; namespace nanopb { template @@ -148,6 +150,12 @@ class LocalSerializer { bundle::NamedQuery DecodeNamedQuery(nanopb::Reader* reader, firestore_NamedQuery& proto) const; + nanopb::Message EncodeFieldIndexSegments( + const std::vector& segments) const; + + std::vector DecodeFieldIndexSegments( + nanopb::Reader* reader, google_firestore_admin_v1_Index& index) const; + private: /** * Encodes a Document for local storage. This differs from the v1 RPC diff --git a/Firestore/core/src/local/memory_index_manager.cc b/Firestore/core/src/local/memory_index_manager.cc index 22a5ba0c3d2..c65cbfcb003 100644 --- a/Firestore/core/src/local/memory_index_manager.cc +++ b/Firestore/core/src/local/memory_index_manager.cc @@ -71,14 +71,17 @@ std::vector MemoryIndexManager::GetCollectionParents( void MemoryIndexManager::Start() { } -void MemoryIndexManager::AddFieldIndex(model::FieldIndex index) { +void MemoryIndexManager::AddFieldIndex(const model::FieldIndex& index) { + (void)index; } -void MemoryIndexManager::DeleteFieldIndex(model::FieldIndex index) { +void MemoryIndexManager::DeleteFieldIndex(const model::FieldIndex& index) { + (void)index; } std::vector MemoryIndexManager::GetFieldIndexes( const std::string& collection_group) { + (void)collection_group; return {}; } @@ -88,11 +91,14 @@ std::vector MemoryIndexManager::GetFieldIndexes() { absl::optional MemoryIndexManager::GetFieldIndex( core::Target target) { + (void)target; return absl::nullopt; } std::vector MemoryIndexManager::GetDocumentsMatchingTarget( model::FieldIndex fieldIndex, core::Target target) { + (void)fieldIndex; + (void)target; return {}; } @@ -103,9 +109,12 @@ MemoryIndexManager::GetNextCollectionGroupToUpdate() { void MemoryIndexManager::UpdateCollectionGroup( const std::string& collection_group, model::IndexOffset offset) { + (void)collection_group; + (void)offset; } -void MemoryIndexManager::UpdateIndexEntries(model::DocumentMap documents) { +void MemoryIndexManager::UpdateIndexEntries( + const model::DocumentMap& documents) { (void)documents; } diff --git a/Firestore/core/src/local/memory_index_manager.h b/Firestore/core/src/local/memory_index_manager.h index a982ebfe59a..6ecd4ce9e59 100644 --- a/Firestore/core/src/local/memory_index_manager.h +++ b/Firestore/core/src/local/memory_index_manager.h @@ -48,6 +48,7 @@ class MemoryCollectionParentIndex { /** An in-memory implementation of IndexManager. */ class MemoryIndexManager : public IndexManager { public: + MemoryIndexManager() = default; void Start() override; void AddToCollectionParentIndex( @@ -56,23 +57,26 @@ class MemoryIndexManager : public IndexManager { std::vector GetCollectionParents( const std::string& collection_id) override; -void AddFieldIndex(model::FieldIndex index) override; + void AddFieldIndex(const model::FieldIndex& index) override; - void DeleteFieldIndex(model::FieldIndex index) override; + void DeleteFieldIndex(const model::FieldIndex& index) override; - std::vector GetFieldIndexes(const std::string& collection_group) override; + std::vector GetFieldIndexes( + const std::string& collection_group) override; std::vector GetFieldIndexes() override; absl::optional GetFieldIndex(core::Target target) override; - std::vector GetDocumentsMatchingTarget(model::FieldIndex fieldIndex, core::Target target) override; + std::vector GetDocumentsMatchingTarget( + model::FieldIndex fieldIndex, core::Target target) override; absl::optional GetNextCollectionGroupToUpdate() override; - void UpdateCollectionGroup(const std::string& collection_group, model::IndexOffset offset) override; + void UpdateCollectionGroup(const std::string& collection_group, + model::IndexOffset offset) override; - void UpdateIndexEntries(model::DocumentMap documents) override; + void UpdateIndexEntries(const model::DocumentMap& documents) override; private: MemoryCollectionParentIndex collection_parents_index_; diff --git a/Firestore/core/src/nanopb/fields_array.h b/Firestore/core/src/nanopb/fields_array.h index 15849d4d0ab..9c8c45c7ebf 100644 --- a/Firestore/core/src/nanopb/fields_array.h +++ b/Firestore/core/src/nanopb/fields_array.h @@ -21,6 +21,7 @@ #include "Firestore/Protos/nanopb/firestore/local/maybe_document.nanopb.h" #include "Firestore/Protos/nanopb/firestore/local/mutation.nanopb.h" #include "Firestore/Protos/nanopb/firestore/local/target.nanopb.h" +#include "Firestore/Protos/nanopb/google/firestore/admin/index.nanopb.h" #include "Firestore/Protos/nanopb/google/firestore/v1/document.nanopb.h" #include "Firestore/Protos/nanopb/google/firestore/v1/firestore.nanopb.h" #include "Firestore/Protos/nanopb/google/type/latlng.nanopb.h" @@ -179,6 +180,11 @@ inline const pb_field_t* FieldsArray() { return firestore_NamedQuery_fields; } +template <> +inline const pb_field_t* FieldsArray() { + return google_protobuf_Empty_fields; +} + template <> inline const pb_field_t* FieldsArray() { return google_protobuf_Empty_fields; diff --git a/Firestore/core/test/unit/local/leveldb_index_manager_test.cc b/Firestore/core/test/unit/local/leveldb_index_manager_test.cc index 2a0ca188a02..4e4c3324490 100644 --- a/Firestore/core/test/unit/local/leveldb_index_manager_test.cc +++ b/Firestore/core/test/unit/local/leveldb_index_manager_test.cc @@ -19,6 +19,7 @@ #include "Firestore/core/src/local/leveldb_index_manager.h" #include "Firestore/core/src/local/leveldb_persistence.h" #include "Firestore/core/test/unit/local/persistence_testing.h" +#include "Firestore/core/test/unit/testutil/testutil.h" #include "absl/memory/memory.h" #include "gtest/gtest.h" @@ -28,6 +29,11 @@ namespace local { namespace { +using model::FieldIndex; +using model::ResourcePath; +using model::Segment; +using testutil::MakeFieldIndex; + std::unique_ptr PersistenceFactory() { return LevelDbPersistenceForTesting(); } @@ -38,6 +44,75 @@ INSTANTIATE_TEST_SUITE_P(LevelDbIndexManagerTest, IndexManagerTest, ::testing::Values(PersistenceFactory)); +class LevelDbIndexManagerTest : public ::testing::Test { + public: + // `GetParam()` must return a factory function. + LevelDbIndexManagerTest() : persistence{PersistenceFactory()} { + } + + std::unique_ptr persistence; +}; + +TEST_F(LevelDbIndexManagerTest, CreateReadFieldsIndexes) { + persistence->Run("CreateReadDeleteFieldsIndexes", [&]() { + IndexManager* index_manager = persistence->index_manager(); + index_manager->Start(); + + index_manager->AddFieldIndex( + MakeFieldIndex("coll1", 1, model::FieldIndex::InitialState(), "value", + model::Segment::kAscending)); + index_manager->AddFieldIndex( + MakeFieldIndex("coll2", 2, model::FieldIndex::InitialState(), "value", + model::Segment::kContains)); + + { + auto indexes = index_manager->GetFieldIndexes("coll1"); + EXPECT_EQ(indexes.size(), 1); + // Note index_id() is 0 because index manager rewrites it using its + // internal id. + EXPECT_EQ(indexes[0].index_id(), 0); + EXPECT_EQ(indexes[0].collection_group(), "coll1"); + } + + index_manager->AddFieldIndex( + MakeFieldIndex("coll1", 3, model::FieldIndex::InitialState(), + "newValue", model::Segment::kContains)); + { + auto indexes = index_manager->GetFieldIndexes("coll1"); + EXPECT_EQ(indexes.size(), 2); + EXPECT_EQ(indexes[0].collection_group(), "coll1"); + EXPECT_EQ(indexes[1].collection_group(), "coll1"); + } + + { + auto indexes = index_manager->GetFieldIndexes("coll2"); + EXPECT_EQ(indexes.size(), 1); + EXPECT_EQ(indexes[0].collection_group(), "coll2"); + } + }); +} + +TEST_F(LevelDbIndexManagerTest, DeleteFieldsIndexeRemovesAllMetadata) { + persistence->Run("CreateReadDeleteFieldsIndexes", [&]() { + IndexManager* index_manager = persistence->index_manager(); + index_manager->Start(); + + auto index = MakeFieldIndex("coll1", 0, model::FieldIndex::InitialState(), + "value", model::Segment::kAscending); + index_manager->AddFieldIndex(index); + { + auto indexes = index_manager->GetFieldIndexes("coll1"); + EXPECT_EQ(indexes.size(), 1); + } + + index_manager->DeleteFieldIndex(index); + { + auto indexes = index_manager->GetFieldIndexes("coll1"); + EXPECT_EQ(indexes.size(), 0); + } + }); +} + } // namespace local } // namespace firestore } // namespace firebase diff --git a/Firestore/core/test/unit/local/leveldb_key_test.cc b/Firestore/core/test/unit/local/leveldb_key_test.cc index 21494ca4983..76092d0a4e5 100644 --- a/Firestore/core/test/unit/local/leveldb_key_test.cc +++ b/Firestore/core/test/unit/local/leveldb_key_test.cc @@ -16,6 +16,7 @@ #include "Firestore/core/src/local/leveldb_key.h" +#include "Firestore/core/src/util/autoid.h" #include "Firestore/core/src/util/string_util.h" #include "Firestore/core/test/unit/testutil/testutil.h" #include "absl/strings/match.h" @@ -494,33 +495,50 @@ TEST(IndexConfigurationKeyTest, Prefixing) { auto table_key = LevelDbIndexConfigurationKey::KeyPrefix(); ASSERT_TRUE( - absl::StartsWith(LevelDbIndexConfigurationKey::Key(0), table_key)); + absl::StartsWith(LevelDbIndexConfigurationKey::Key(0, ""), table_key)); - ASSERT_FALSE(absl::StartsWith(LevelDbIndexConfigurationKey::Key(1), - LevelDbIndexConfigurationKey::Key(2))); + ASSERT_FALSE(absl::StartsWith(LevelDbIndexConfigurationKey::Key(1, ""), + LevelDbIndexConfigurationKey::Key(2, ""))); + + ASSERT_FALSE(absl::StartsWith(LevelDbIndexConfigurationKey::Key(1, "g"), + LevelDbIndexConfigurationKey::Key(1, "ag"))); } TEST(IndexConfigurationKeyTest, Ordering) { - ASSERT_LT(LevelDbIndexConfigurationKey::Key(0), - LevelDbIndexConfigurationKey::Key(1)); - ASSERT_EQ(LevelDbIndexConfigurationKey::Key(1), - LevelDbIndexConfigurationKey::Key(1)); + ASSERT_LT(LevelDbIndexConfigurationKey::Key(0, ""), + LevelDbIndexConfigurationKey::Key(1, "")); + ASSERT_EQ(LevelDbIndexConfigurationKey::Key(1, ""), + LevelDbIndexConfigurationKey::Key(1, "")); + ASSERT_LT(LevelDbIndexConfigurationKey::Key(0, "a"), + LevelDbIndexConfigurationKey::Key(0, "b")); + ASSERT_EQ(LevelDbIndexConfigurationKey::Key(1, "a"), + LevelDbIndexConfigurationKey::Key(1, "a")); } TEST(IndexConfigurationKeyTest, EncodeDecodeCycle) { LevelDbIndexConfigurationKey key; + std::vector groups = { + "", + "ab", + "12", + ",867t-b", + "汉语; traditional Chinese: 漢語; pinyin: Hànyǔ[b]", + "اَلْعَرَبِيَّةُ, al-ʿarabiyyah "}; for (int32_t id = -5; id < 10; ++id) { - auto encoded = LevelDbIndexConfigurationKey::Key(id); + auto s = groups[(id + 5) % groups.size()]; + auto encoded = LevelDbIndexConfigurationKey::Key(id, s); bool ok = key.Decode(encoded); ASSERT_TRUE(ok); ASSERT_EQ(id, key.index_id()); + ASSERT_EQ(s, key.collection_group()); } } TEST(IndexConfigurationKeyTest, Description) { - AssertExpectedKeyDescription("[index_configuration: index_id=8]", - LevelDbIndexConfigurationKey::Key(8)); + AssertExpectedKeyDescription( + "[index_configuration: index_id=8 collection_group=group]", + LevelDbIndexConfigurationKey::Key(8, "group")); } TEST(IndexStateKeyTest, Prefixing) { @@ -570,6 +588,14 @@ TEST(IndexEntryKeyTest, Prefixing) { "directional_value_encoded", "document_id_99"), table_key)); + ASSERT_TRUE( + absl::StartsWith(LevelDbIndexEntryKey::Key(0, "user_id", "", "", ""), + LevelDbIndexEntryKey::KeyPrefix(0, "user_id"))); + + ASSERT_FALSE( + absl::StartsWith(LevelDbIndexEntryKey::Key(0, "user_id", "", "", ""), + LevelDbIndexEntryKey::KeyPrefix(0, "user_iz"))); + ASSERT_FALSE(absl::StartsWith(LevelDbIndexEntryKey::Key(0, "", "", "", ""), LevelDbIndexEntryKey::Key(1, "", "", "", ""))); } diff --git a/Firestore/core/test/unit/testutil/testutil.cc b/Firestore/core/test/unit/testutil/testutil.cc index b69962b40aa..63d6fabc4d8 100644 --- a/Firestore/core/test/unit/testutil/testutil.cc +++ b/Firestore/core/test/unit/testutil/testutil.cc @@ -524,6 +524,17 @@ model::FieldIndex MakeFieldIndex(const std::string& collection_group, model::FieldIndex::InitialState()}; } +model::FieldIndex MakeFieldIndex(const std::string& collection_group, + int32_t index_id, + model::IndexState state, + const std::string& field_1, + model::Segment::Kind kind_1) { + return {index_id, + collection_group, + {model::Segment{Field(field_1), kind_1}}, + state}; +} + } // namespace testutil } // namespace firestore } // namespace firebase diff --git a/Firestore/core/test/unit/testutil/testutil.h b/Firestore/core/test/unit/testutil/testutil.h index 09adb32d6db..6cd92ef4071 100644 --- a/Firestore/core/test/unit/testutil/testutil.h +++ b/Firestore/core/test/unit/testutil/testutil.h @@ -459,6 +459,11 @@ model::FieldIndex MakeFieldIndex(const std::string& collection_group, model::Segment::Kind kind_1, const std::string& field_2, model::Segment::Kind kind_2); +model::FieldIndex MakeFieldIndex(const std::string& collection_group, + int32_t index_id, + model::IndexState state, + const std::string& field_1, + model::Segment::Kind kind_1); } // namespace testutil } // namespace firestore From 40a443e65f2857ee997cbff8e86da9bbfaf4b2b9 Mon Sep 17 00:00:00 2001 From: Wu-Hui Date: Tue, 15 Feb 2022 14:54:06 -0500 Subject: [PATCH 04/10] Add include --- Firestore/core/src/local/leveldb_index_manager.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Firestore/core/src/local/leveldb_index_manager.h b/Firestore/core/src/local/leveldb_index_manager.h index 2eef79c3fbb..e1d6901e670 100644 --- a/Firestore/core/src/local/leveldb_index_manager.h +++ b/Firestore/core/src/local/leveldb_index_manager.h @@ -22,6 +22,7 @@ #include #include +#include "Firestore/core/src/model/field_index.h" #include "Firestore/core/src/local/index_manager.h" #include "Firestore/core/src/local/memory_index_manager.h" From 972e495fd7fda277ea199a873ce8b19227bd2bc5 Mon Sep 17 00:00:00 2001 From: Wu-Hui Date: Tue, 15 Feb 2022 15:03:49 -0500 Subject: [PATCH 05/10] Reorder --- Firestore/core/src/local/leveldb_index_manager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firestore/core/src/local/leveldb_index_manager.h b/Firestore/core/src/local/leveldb_index_manager.h index e1d6901e670..407ac0b9780 100644 --- a/Firestore/core/src/local/leveldb_index_manager.h +++ b/Firestore/core/src/local/leveldb_index_manager.h @@ -22,9 +22,9 @@ #include #include -#include "Firestore/core/src/model/field_index.h" #include "Firestore/core/src/local/index_manager.h" #include "Firestore/core/src/local/memory_index_manager.h" +#include "Firestore/core/src/model/field_index.h" namespace firebase { namespace firestore { From da931655f7322f2c4446ad8066fda0dcbce88fb4 Mon Sep 17 00:00:00 2001 From: Wu-Hui Date: Wed, 16 Feb 2022 15:04:56 -0500 Subject: [PATCH 06/10] Address feedback --- Firestore/core/src/local/index_manager.h | 16 ++++-- .../core/src/local/leveldb_index_manager.cc | 57 +++++++++++-------- .../core/src/local/leveldb_index_manager.h | 4 +- Firestore/core/src/local/leveldb_key.cc | 19 ++++--- Firestore/core/src/local/leveldb_key.h | 25 ++++---- Firestore/core/src/local/local_serializer.cc | 41 ++++++++----- .../core/src/local/memory_index_manager.cc | 5 +- .../core/src/local/memory_index_manager.h | 3 +- .../core/test/unit/local/leveldb_key_test.cc | 34 +++++------ 9 files changed, 119 insertions(+), 85 deletions(-) diff --git a/Firestore/core/src/local/index_manager.h b/Firestore/core/src/local/index_manager.h index 0352d5ec8fa..5a2377fd108 100644 --- a/Firestore/core/src/local/index_manager.h +++ b/Firestore/core/src/local/index_manager.h @@ -75,8 +75,9 @@ class IndexManager { /** * Adds a field path index. * - * Values for this index are persisted asynchronously. The index will only be - * used for query execution once values are persisted. + * The actual entries for this index will be created and persisted + * in the background by the SDK, and the index will be used for query + * execution once values are persisted. */ virtual void AddFieldIndex(const model::FieldIndex& index) = 0; @@ -100,10 +101,13 @@ class IndexManager { virtual absl::optional GetFieldIndex( core::Target target) = 0; - /** Returns the documents that match the given target based on the provided - * index. */ - virtual std::vector GetDocumentsMatchingTarget( - model::FieldIndex fieldIndex, core::Target target) = 0; + /** + * Returns the documents that match the given target based on the provided + * index, or `nullopt` if the query cannot be served from an index. + */ + virtual absl::optional> + GetDocumentsMatchingTarget(model::FieldIndex fieldIndex, + core::Target target) = 0; /** * Returns the next collection group to update. Returns `nullopt` if no diff --git a/Firestore/core/src/local/leveldb_index_manager.cc b/Firestore/core/src/local/leveldb_index_manager.cc index 8bbcb6d494e..f895f39ff33 100644 --- a/Firestore/core/src/local/leveldb_index_manager.cc +++ b/Firestore/core/src/local/leveldb_index_manager.cc @@ -128,11 +128,11 @@ std::vector LevelDbIndexManager::GetCollectionParents( void LevelDbIndexManager::Start() { std::unordered_map index_states; - // Fetch all index states if persisted for the user. These states contain per - // user information on how up to date the index is. + // Fetch all index states that are persisted for the user. These states + // contain per user information on how up to date the index is. { auto state_iter = db_->current_transaction()->NewIterator(); - auto state_key_prefix = LevelDbIndexStateKey::KeyPrefix(); + auto state_key_prefix = LevelDbIndexStateKey::KeyPrefix(uid_); LevelDbIndexStateKey state_key; for (state_iter->Seek(state_key_prefix); state_iter->Valid(); state_iter->Next()) { @@ -141,10 +141,6 @@ void LevelDbIndexManager::Start() { break; } - if (state_key.user_id() != uid_) { - continue; - } - index_states.insert( {state_key.index_id(), DecodeIndexState(state_iter->value())}); } @@ -184,8 +180,8 @@ void LevelDbIndexManager::Start() { ? iter->second : FieldIndex::InitialState(); - // Store the index and update `memoizedMaxIndexId` and - // `memoizedMaxSequenceNumber`. + // Store the index and update `memoized_max_index_id` and + // `memoized_max_sequence_number`. MemoizeIndex(FieldIndex(config_key.index_id(), config_key.collection_group(), std::move(segments), state)); @@ -224,9 +220,6 @@ void LevelDbIndexManager::MemoizeIndex(FieldIndex index) { auto existing_index_iter = existing_indexes.find(index_id); - // Pop and save `FieldIndex*` until existing_index_iter->second is found. - // This is essentially deleting existing_index_iter->second from the queue - // because `popped_out` will be pushed back to `next_index_to_update_` later. if (existing_index_iter != existing_indexes.end()) { DeleteFromUpdateQueue(&existing_index_iter->second); } @@ -261,16 +254,33 @@ void LevelDbIndexManager::DeleteFieldIndex(const FieldIndex& index) { db_->current_transaction()->Delete(LevelDbIndexConfigurationKey::Key( index.index_id(), index.collection_group())); - db_->current_transaction()->Delete( - LevelDbIndexStateKey::Key(index.index_id(), uid_)); + // Delete states from all users for this index id. + { + auto state_prefix = LevelDbIndexStateKey::KeyPrefix(); + auto iter = db_->current_transaction()->NewIterator(); + LevelDbIndexStateKey state_key; + for (iter->Seek(state_prefix); iter->Valid(); iter->Next()) { + if (!absl::StartsWith(iter->key(), state_prefix) || + !state_key.Decode(iter->key())) { + break; + } - auto entry_prefix = LevelDbIndexEntryKey::KeyPrefix(index.index_id(), uid_); - auto iter = db_->current_transaction()->NewIterator(); - for (iter->Seek(entry_prefix); iter->Valid(); iter->Next()) { - if (!absl::StartsWith(iter->key(), entry_prefix)) { - break; + if (state_key.index_id() == index.index_id()) { + db_->current_transaction()->Delete(iter->key()); + } + } + } + + // Delete entries from all users for this index id. + { + auto entry_prefix = LevelDbIndexEntryKey::KeyPrefix(index.index_id()); + auto iter = db_->current_transaction()->NewIterator(); + for (iter->Seek(entry_prefix); iter->Valid(); iter->Next()) { + if (!absl::StartsWith(iter->key(), entry_prefix)) { + break; + } + db_->current_transaction()->Delete(iter->key()); } - db_->current_transaction()->Delete(iter->key()); } auto group_index_iter = memoized_indexes_.find(index.collection_group()); @@ -279,7 +289,7 @@ void LevelDbIndexManager::DeleteFieldIndex(const FieldIndex& index) { auto index_iter = index_map.find(index.index_id()); if (index_iter != index_map.end()) { DeleteFromUpdateQueue(&index_iter->second); - index_map.erase(index.index_id()); + index_map.erase(index_iter); } } } @@ -314,8 +324,9 @@ absl::optional LevelDbIndexManager::GetFieldIndex( return {}; } -std::vector LevelDbIndexManager::GetDocumentsMatchingTarget( - model::FieldIndex field_index, core::Target target) { +absl::optional> +LevelDbIndexManager::GetDocumentsMatchingTarget(model::FieldIndex field_index, + core::Target target) { (void)field_index; (void)target; return {}; diff --git a/Firestore/core/src/local/leveldb_index_manager.h b/Firestore/core/src/local/leveldb_index_manager.h index 407ac0b9780..9af99a3a905 100644 --- a/Firestore/core/src/local/leveldb_index_manager.h +++ b/Firestore/core/src/local/leveldb_index_manager.h @@ -58,7 +58,7 @@ class LevelDbIndexManager : public IndexManager { absl::optional GetFieldIndex(core::Target target) override; - std::vector GetDocumentsMatchingTarget( + absl::optional> GetDocumentsMatchingTarget( model::FieldIndex fieldIndex, core::Target target) override; absl::optional GetNextCollectionGroupToUpdate() override; @@ -99,7 +99,7 @@ class LevelDbIndexManager : public IndexManager { * An in-memory map from collection group to a map of indexes associated with * the collection groups. * - * The map is indexes is keyed off index ids. + * The nested map is an index_id to FieldIndex map. */ std::unordered_map> diff --git a/Firestore/core/src/local/leveldb_key.cc b/Firestore/core/src/local/leveldb_key.cc index f6dc88aee3e..11334138703 100644 --- a/Firestore/core/src/local/leveldb_key.cc +++ b/Firestore/core/src/local/leveldb_key.cc @@ -1192,12 +1192,19 @@ std::string LevelDbIndexStateKey::KeyPrefix() { return writer.result(); } -std::string LevelDbIndexStateKey::Key(int32_t index_id, - absl::string_view user_id) { +std::string LevelDbIndexStateKey::KeyPrefix(absl::string_view user_id) { Writer writer; writer.WriteTableName(kIndexStateTable); - writer.WriteIndexId(index_id); writer.WriteUserId(user_id); + return writer.result(); +} + +std::string LevelDbIndexStateKey::Key(absl::string_view user_id, + int32_t index_id) { + Writer writer; + writer.WriteTableName(kIndexStateTable); + writer.WriteUserId(user_id); + writer.WriteIndexId(index_id); writer.WriteTerminator(); return writer.result(); } @@ -1205,8 +1212,8 @@ std::string LevelDbIndexStateKey::Key(int32_t index_id, bool LevelDbIndexStateKey::Decode(absl::string_view key) { Reader reader{key}; reader.ReadTableNameMatching(kIndexStateTable); - index_id_ = reader.ReadIndexId(); user_id_ = reader.ReadUserId(); + index_id_ = reader.ReadIndexId(); reader.ReadTerminator(); return reader.ok(); } @@ -1217,12 +1224,10 @@ std::string LevelDbIndexEntryKey::KeyPrefix() { return writer.result(); } -std::string LevelDbIndexEntryKey::KeyPrefix(int32_t index_id, - absl::string_view user_id) { +std::string LevelDbIndexEntryKey::KeyPrefix(int32_t index_id) { Writer writer; writer.WriteTableName(kIndexEntriesTable); writer.WriteIndexId(index_id); - writer.WriteUserId(user_id); return writer.result(); } diff --git a/Firestore/core/src/local/leveldb_key.h b/Firestore/core/src/local/leveldb_key.h index 35ded2d60ec..509d7ed1ab0 100644 --- a/Firestore/core/src/local/leveldb_key.h +++ b/Firestore/core/src/local/leveldb_key.h @@ -784,9 +784,15 @@ class LevelDbIndexStateKey { static std::string KeyPrefix(); /** - * Creates a key that points to the key for the given index id and user id. + * Creates a key prefix that points just before the first key for a given user + * id. */ - static std::string Key(int32_t index_id, absl::string_view user_id); + static std::string KeyPrefix(absl::string_view user_id); + + /** + * Creates a key that points to the key for the given user id and index id. + */ + static std::string Key(absl::string_view user_id, int32_t index_id); /** * Decodes the given complete key, storing the decoded values in this @@ -799,16 +805,16 @@ class LevelDbIndexStateKey { ABSL_MUST_USE_RESULT bool Decode(absl::string_view key); - /** The index id for this entry. */ - int32_t index_id() const { - return index_id_; - } - /** The user id for this entry. */ const std::string& user_id() const { return user_id_; } + /** The index id for this entry. */ + int32_t index_id() const { + return index_id_; + } + private: int32_t index_id_; std::string user_id_; @@ -828,10 +834,9 @@ class LevelDbIndexEntryKey { static std::string KeyPrefix(); /** - * Creates a key prefix that points the first entry of a given index_id for - * a user. + * Creates a key prefix that points the first entry of a given index_id. */ - static std::string KeyPrefix(int32_t index_id, absl::string_view user_id); + static std::string KeyPrefix(int32_t index_id); /** * Creates a key that points to the key for the given index entry fields. diff --git a/Firestore/core/src/local/local_serializer.cc b/Firestore/core/src/local/local_serializer.cc index 735c88bdab9..a058235a236 100644 --- a/Firestore/core/src/local/local_serializer.cc +++ b/Firestore/core/src/local/local_serializer.cc @@ -474,8 +474,8 @@ std::vector LocalSerializer::DecodeFieldIndexSegments( } Segment::Kind kind = Segment::Kind::kContains; - if (field.which_value_mode != - google_firestore_admin_v1_Index_IndexField_array_config_tag) { + if (field.which_value_mode == + google_firestore_admin_v1_Index_IndexField_order_tag) { if (field.order == google_firestore_admin_v1_Index_IndexField_Order_ASCENDING) { kind = Segment::Kind::kAscending; @@ -506,19 +506,30 @@ LocalSerializer::EncodeFieldIndexSegments( google_firestore_admin_v1_Index_IndexField field; field.field_path = nanopb::MakeBytesArray(segment.field_path().CanonicalString()); - if (segment.kind() == model::Segment::kContains) { - field.which_value_mode = - google_firestore_admin_v1_Index_IndexField_array_config_tag; - field.array_config = - google_firestore_admin_v1_Index_IndexField_ArrayConfig_CONTAINS; - } else if (segment.kind() == model::Segment::kAscending) { - field.which_value_mode = - google_firestore_admin_v1_Index_IndexField_order_tag; - field.order = google_firestore_admin_v1_Index_IndexField_Order_ASCENDING; - } else { - field.which_value_mode = - google_firestore_admin_v1_Index_IndexField_order_tag; - field.order = google_firestore_admin_v1_Index_IndexField_Order_DESCENDING; + switch (segment.kind()) { + case model::Segment::kContains: { + field.which_value_mode = + google_firestore_admin_v1_Index_IndexField_array_config_tag; + field.array_config = + google_firestore_admin_v1_Index_IndexField_ArrayConfig_CONTAINS; + break; + } + case model::Segment::kAscending: { + field.which_value_mode = + google_firestore_admin_v1_Index_IndexField_order_tag; + field.order = + google_firestore_admin_v1_Index_IndexField_Order_ASCENDING; + break; + } + case model::Segment::kDescending: { + field.which_value_mode = + google_firestore_admin_v1_Index_IndexField_order_tag; + field.order = + google_firestore_admin_v1_Index_IndexField_Order_DESCENDING; + break; + } + default: + HARD_FAIL("Unrecognized enum value from segment.kind()"); } result->fields[i] = std::move(field); diff --git a/Firestore/core/src/local/memory_index_manager.cc b/Firestore/core/src/local/memory_index_manager.cc index c65cbfcb003..9fdc609c690 100644 --- a/Firestore/core/src/local/memory_index_manager.cc +++ b/Firestore/core/src/local/memory_index_manager.cc @@ -95,8 +95,9 @@ absl::optional MemoryIndexManager::GetFieldIndex( return absl::nullopt; } -std::vector MemoryIndexManager::GetDocumentsMatchingTarget( - model::FieldIndex fieldIndex, core::Target target) { +absl::optional> +MemoryIndexManager::GetDocumentsMatchingTarget(model::FieldIndex fieldIndex, + core::Target target) { (void)fieldIndex; (void)target; return {}; diff --git a/Firestore/core/src/local/memory_index_manager.h b/Firestore/core/src/local/memory_index_manager.h index 6ecd4ce9e59..bd2afcdc129 100644 --- a/Firestore/core/src/local/memory_index_manager.h +++ b/Firestore/core/src/local/memory_index_manager.h @@ -49,6 +49,7 @@ class MemoryCollectionParentIndex { class MemoryIndexManager : public IndexManager { public: MemoryIndexManager() = default; + void Start() override; void AddToCollectionParentIndex( @@ -68,7 +69,7 @@ class MemoryIndexManager : public IndexManager { absl::optional GetFieldIndex(core::Target target) override; - std::vector GetDocumentsMatchingTarget( + absl::optional> GetDocumentsMatchingTarget( model::FieldIndex fieldIndex, core::Target target) override; absl::optional GetNextCollectionGroupToUpdate() override; diff --git a/Firestore/core/test/unit/local/leveldb_key_test.cc b/Firestore/core/test/unit/local/leveldb_key_test.cc index 76092d0a4e5..3c9941a2e6e 100644 --- a/Firestore/core/test/unit/local/leveldb_key_test.cc +++ b/Firestore/core/test/unit/local/leveldb_key_test.cc @@ -545,39 +545,39 @@ TEST(IndexStateKeyTest, Prefixing) { auto table_key = LevelDbIndexStateKey::KeyPrefix(); ASSERT_TRUE( - absl::StartsWith(LevelDbIndexStateKey::Key(0, "user_a"), table_key)); + absl::StartsWith(LevelDbIndexStateKey::Key("user_a", 0), table_key)); - ASSERT_FALSE(absl::StartsWith(LevelDbIndexStateKey::Key(0, "user_a"), - LevelDbIndexStateKey::Key(0, "user_b"))); - ASSERT_FALSE(absl::StartsWith(LevelDbIndexStateKey::Key(0, "user_a"), - LevelDbIndexStateKey::Key(1, "user_a"))); + ASSERT_FALSE(absl::StartsWith(LevelDbIndexStateKey::Key("user_a", 0), + LevelDbIndexStateKey::Key("user_b", 0))); + ASSERT_FALSE(absl::StartsWith(LevelDbIndexStateKey::Key("user_a", 0), + LevelDbIndexStateKey::Key("user_a", 0))); } TEST(IndexStateKeyTest, Ordering) { - ASSERT_LT(LevelDbIndexStateKey::Key(0, "foo/bar"), - LevelDbIndexStateKey::Key(1, "foo/bar")); - ASSERT_LT(LevelDbIndexStateKey::Key(0, "foo/bar"), - LevelDbIndexStateKey::Key(0, "foo/bar1")); + ASSERT_LT(LevelDbIndexStateKey::Key("foo/bar", 0), + LevelDbIndexStateKey::Key("foo/bar", 1)); + ASSERT_LT(LevelDbIndexStateKey::Key("foo/bar", 0), + LevelDbIndexStateKey::Key("foo/bar1", 0)); } TEST(IndexStateKeyTest, EncodeDecodeCycle) { LevelDbIndexStateKey key; - std::vector> ids{ - {0, "foo/bar"}, {1, "foo/bar2"}, {-1, "foo-bar?baz!quux"}}; + std::vector> ids{ + {"foo/bar", 0}, {"foo/bar2", 1}, {"foo-bar?baz!quux", -1}}; for (auto&& id : ids) { auto encoded = LevelDbIndexStateKey::Key(id.first, id.second); bool ok = key.Decode(encoded); ASSERT_TRUE(ok); - ASSERT_EQ(id.first, key.index_id()); - ASSERT_EQ(id.second, key.user_id()); + ASSERT_EQ(id.first, key.user_id()); + ASSERT_EQ(id.second, key.index_id()); } } TEST(IndexStateKeyTest, Description) { AssertExpectedKeyDescription( "[index_state: index_id=99 user_id=foo-bar?baz!quux]", - LevelDbIndexStateKey::Key(99, "foo-bar?baz!quux")); + LevelDbIndexStateKey::Key("foo-bar?baz!quux", 99)); } TEST(IndexEntryKeyTest, Prefixing) { @@ -590,11 +590,7 @@ TEST(IndexEntryKeyTest, Prefixing) { ASSERT_TRUE( absl::StartsWith(LevelDbIndexEntryKey::Key(0, "user_id", "", "", ""), - LevelDbIndexEntryKey::KeyPrefix(0, "user_id"))); - - ASSERT_FALSE( - absl::StartsWith(LevelDbIndexEntryKey::Key(0, "user_id", "", "", ""), - LevelDbIndexEntryKey::KeyPrefix(0, "user_iz"))); + LevelDbIndexEntryKey::KeyPrefix(0))); ASSERT_FALSE(absl::StartsWith(LevelDbIndexEntryKey::Key(0, "", "", "", ""), LevelDbIndexEntryKey::Key(1, "", "", "", ""))); From bd851ab48a0919b0bc9e770807d92e75a604e2b7 Mon Sep 17 00:00:00 2001 From: Wu-Hui Date: Wed, 16 Feb 2022 20:58:54 -0500 Subject: [PATCH 07/10] Fix tests --- Firestore/core/test/unit/local/leveldb_key_test.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firestore/core/test/unit/local/leveldb_key_test.cc b/Firestore/core/test/unit/local/leveldb_key_test.cc index 3c9941a2e6e..963d72f1d7c 100644 --- a/Firestore/core/test/unit/local/leveldb_key_test.cc +++ b/Firestore/core/test/unit/local/leveldb_key_test.cc @@ -550,7 +550,7 @@ TEST(IndexStateKeyTest, Prefixing) { ASSERT_FALSE(absl::StartsWith(LevelDbIndexStateKey::Key("user_a", 0), LevelDbIndexStateKey::Key("user_b", 0))); ASSERT_FALSE(absl::StartsWith(LevelDbIndexStateKey::Key("user_a", 0), - LevelDbIndexStateKey::Key("user_a", 0))); + LevelDbIndexStateKey::Key("user_a", 1))); } TEST(IndexStateKeyTest, Ordering) { @@ -576,7 +576,7 @@ TEST(IndexStateKeyTest, EncodeDecodeCycle) { TEST(IndexStateKeyTest, Description) { AssertExpectedKeyDescription( - "[index_state: index_id=99 user_id=foo-bar?baz!quux]", + "[index_state: user_id=foo-bar?baz!quux index_id=99]", LevelDbIndexStateKey::Key("foo-bar?baz!quux", 99)); } From 3d5ba8729ac5999d309f82e4b768600c8bd85e1b Mon Sep 17 00:00:00 2001 From: Wu-Hui Date: Fri, 18 Feb 2022 10:43:11 -0500 Subject: [PATCH 08/10] Comment format --- Firestore/core/src/local/index_manager.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Firestore/core/src/local/index_manager.h b/Firestore/core/src/local/index_manager.h index 5a2377fd108..bfd98a0c134 100644 --- a/Firestore/core/src/local/index_manager.h +++ b/Firestore/core/src/local/index_manager.h @@ -75,9 +75,9 @@ class IndexManager { /** * Adds a field path index. * - * The actual entries for this index will be created and persisted - * in the background by the SDK, and the index will be used for query - * execution once values are persisted. + * The actual entries for this index will be created and persisted in the + * background by the SDK, and the index will be used for query execution once + * values are persisted. */ virtual void AddFieldIndex(const model::FieldIndex& index) = 0; From 4c7e4eb206ffc47021dec827017a12517f277213 Mon Sep 17 00:00:00 2001 From: wu-hui <53845758+wu-hui@users.noreply.github.com> Date: Fri, 18 Feb 2022 10:45:21 -0500 Subject: [PATCH 09/10] Apply suggestions from code review Co-authored-by: Sebastian Schmidt --- Firestore/core/src/local/leveldb_index_manager.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Firestore/core/src/local/leveldb_index_manager.cc b/Firestore/core/src/local/leveldb_index_manager.cc index f895f39ff33..ea75f7ff4cf 100644 --- a/Firestore/core/src/local/leveldb_index_manager.cc +++ b/Firestore/core/src/local/leveldb_index_manager.cc @@ -174,14 +174,14 @@ void LevelDbIndexManager::Start() { // If we fetched an index state for the user above, combine it with this // index. We use the default state if we don't have an index state (e.g. - // the index was created while a different user as logged in). + // the index was created while a different user was logged in). auto iter = index_states.find(config_key.index_id()); IndexState state = iter != index_states.end() ? iter->second : FieldIndex::InitialState(); - // Store the index and update `memoized_max_index_id` and - // `memoized_max_sequence_number`. + // Store the index and update `memoized_max_index_id_` and + // `memoized_max_sequence_number_`. MemoizeIndex(FieldIndex(config_key.index_id(), config_key.collection_group(), std::move(segments), state)); @@ -226,7 +226,7 @@ void LevelDbIndexManager::MemoizeIndex(FieldIndex index) { // Moves `index` into `existing_indexes`. existing_indexes.insert({index_id, std::move(index)}); - // next_index_to_update_ holds a pointer to Index owned by `existing_indexes`. + // next_index_to_update_ holds a pointer to the index owned by `existing_indexes`. next_index_to_update_.push(&existing_indexes.find(index_id)->second); memoized_max_index_id_ = std::max(memoized_max_index_id_, index_id); memoized_max_sequence_number_ = From a80966ab213596f71e7f1dee8fc1b3d6c786625a Mon Sep 17 00:00:00 2001 From: Wu-Hui Date: Fri, 18 Feb 2022 10:47:55 -0500 Subject: [PATCH 10/10] More formatting --- Firestore/core/src/local/leveldb_index_manager.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Firestore/core/src/local/leveldb_index_manager.cc b/Firestore/core/src/local/leveldb_index_manager.cc index ea75f7ff4cf..3b4bfd1dd69 100644 --- a/Firestore/core/src/local/leveldb_index_manager.cc +++ b/Firestore/core/src/local/leveldb_index_manager.cc @@ -226,7 +226,8 @@ void LevelDbIndexManager::MemoizeIndex(FieldIndex index) { // Moves `index` into `existing_indexes`. existing_indexes.insert({index_id, std::move(index)}); - // next_index_to_update_ holds a pointer to the index owned by `existing_indexes`. + // next_index_to_update_ holds a pointer to the index owned by + // `existing_indexes`. next_index_to_update_.push(&existing_indexes.find(index_id)->second); memoized_max_index_id_ = std::max(memoized_max_index_id_, index_id); memoized_max_sequence_number_ =