FIRPersistentCacheIndexManager.mm 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 "Firestore/Source/API/FIRFirestore+Internal.h"
  17. #import "Firestore/Source/API/FIRPersistentCacheIndexManager+Internal.h"
  18. using firebase::firestore::api::Firestore;
  19. using firebase::firestore::api::PersistentCacheIndexManager;
  20. NS_ASSUME_NONNULL_BEGIN
  21. @implementation FIRPersistentCacheIndexManager {
  22. /** The `Firestore` instance that created this index manager. */
  23. std::shared_ptr<const PersistentCacheIndexManager> _indexManager;
  24. }
  25. - (instancetype)initWithPersistentCacheIndexManager:
  26. (std::shared_ptr<const PersistentCacheIndexManager>)indexManager {
  27. if (self = [super init]) {
  28. _indexManager = indexManager;
  29. }
  30. return self;
  31. }
  32. - (void)enableIndexAutoCreation {
  33. _indexManager->EnableIndexAutoCreation();
  34. }
  35. - (void)disableIndexAutoCreation {
  36. _indexManager->DisableIndexAutoCreation();
  37. }
  38. - (void)deleteAllIndexes {
  39. _indexManager->DeleteAllFieldIndexes();
  40. }
  41. @end
  42. NS_ASSUME_NONNULL_END