FIRPersistentCacheSettings+Internal.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright 2023 Google LLC
  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 <Foundation/Foundation.h>
  17. #include <memory>
  18. #include "Firestore/core/src/api/persistent_cache_index_manager.h"
  19. NS_ASSUME_NONNULL_BEGIN
  20. // TODO(sum/avg) move the contents of this category to
  21. // ../Public/FirebaseFirestore/FIRPersistentCacheIndexManager.h
  22. /**
  23. * A PersistentCacheIndexManager which you can config persistent cache indexes used for
  24. * local query execution.
  25. */
  26. NS_SWIFT_NAME(PersistentCacheIndexManager)
  27. @interface FIRPersistentCacheIndexManager : NSObject
  28. /** :nodoc: */
  29. - (instancetype)init
  30. __attribute__((unavailable("FIRPersistentCacheIndexManager cannot be created directly.")));
  31. /**
  32. * Enables SDK to create persistent cache indexes automatically for local query execution when SDK
  33. * believes cache indexes can help improves performance.
  34. *
  35. * This feature is disabled by default.
  36. */
  37. - (void)enableIndexAutoCreation NS_SWIFT_NAME(enableIndexAutoCreation());
  38. /**
  39. * Stops creating persistent cache indexes automatically for local query execution. The indexes
  40. * which have been created by calling `enableIndexAutoCreation` still take effect.
  41. */
  42. - (void)disableIndexAutoCreation NS_SWIFT_NAME(disableIndexAutoCreation());
  43. /**
  44. * Removes all persistent cache indexes. Please note this function will also deletes indexes
  45. * generated by [[FIRFirestore firestore] setIndexConfigurationFromJSON] and [[FIRFirestore
  46. * firestore] setIndexConfigurationFromStream], which are deprecated.
  47. */
  48. - (void)deleteAllIndexes NS_SWIFT_NAME(deleteAllIndexes());
  49. @end
  50. @interface FIRPersistentCacheIndexManager (/* Init */)
  51. - (instancetype)initWithPersistentCacheIndexManager:
  52. (std::shared_ptr<const firebase::firestore::api::PersistentCacheIndexManager>)indexManager
  53. NS_DESIGNATED_INITIALIZER;
  54. @end
  55. NS_ASSUME_NONNULL_END