FIRFirestore+Internal.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * Copyright 2017 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import "FIRFirestore.h"
  17. #include <memory>
  18. #include <string>
  19. #include "Firestore/core/src/api/firestore.h"
  20. #include "Firestore/core/src/credentials/credentials_provider.h"
  21. #include "Firestore/core/src/util/async_queue.h"
  22. @class FIRApp;
  23. @class FSTFirestoreClient;
  24. @class FSTUserDataReader;
  25. namespace firebase {
  26. namespace firestore {
  27. namespace remote {
  28. class FirebaseMetadataProvider;
  29. } // namespace remote
  30. } // namespace firestore
  31. } // namespace firebase
  32. namespace api = firebase::firestore::api;
  33. namespace credentials = firebase::firestore::credentials;
  34. namespace model = firebase::firestore::model;
  35. namespace remote = firebase::firestore::remote;
  36. NS_ASSUME_NONNULL_BEGIN
  37. /** Provides a registry management interface for FIRFirestore instances. */
  38. @protocol FSTFirestoreInstanceRegistry
  39. /** Removes the FIRFirestore instance with given database name from registry. */
  40. - (void)removeInstanceWithDatabase:(NSString *)database;
  41. @end
  42. @interface FIRFirestore (/* Init */)
  43. /**
  44. * Initializes a Firestore object with all the required parameters directly. This exists so that
  45. * tests can create FIRFirestore objects without needing FIRApp.
  46. */
  47. - (instancetype)initWithDatabaseID:(model::DatabaseId)databaseID
  48. persistenceKey:(std::string)persistenceKey
  49. authCredentialsProvider:
  50. (std::shared_ptr<credentials::AuthCredentialsProvider>)authCredentialsProvider
  51. appCheckCredentialsProvider:
  52. (std::shared_ptr<credentials::AppCheckCredentialsProvider>)appCheckCredentialsProvider
  53. workerQueue:
  54. (std::shared_ptr<firebase::firestore::util::AsyncQueue>)workerQueue
  55. firebaseMetadataProvider:
  56. (std::unique_ptr<remote::FirebaseMetadataProvider>)firebaseMetadataProvider
  57. firebaseApp:(FIRApp *)app
  58. instanceRegistry:(nullable id<FSTFirestoreInstanceRegistry>)registry;
  59. @end
  60. /** Internal FIRFirestore API we don't want exposed in our public header files. */
  61. @interface FIRFirestore (Internal)
  62. + (FIRFirestore *)recoverFromFirestore:(std::shared_ptr<api::Firestore>)firestore;
  63. - (void)terminateInternalWithCompletion:(nullable void (^)(NSError *_Nullable error))completion;
  64. - (const std::shared_ptr<firebase::firestore::util::AsyncQueue> &)workerQueue;
  65. @property(nonatomic, assign, readonly) std::shared_ptr<api::Firestore> wrapped;
  66. @property(nonatomic, assign, readonly) const model::DatabaseId &databaseID;
  67. @property(nonatomic, strong, readonly) FSTUserDataReader *dataReader;
  68. @end
  69. NS_ASSUME_NONNULL_END