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