FIRFirestoreSettings.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * Copyright 2017 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. NS_ASSUME_NONNULL_BEGIN
  18. @protocol FIRLocalCacheSettings;
  19. /** Used to set on-disk cache size to unlimited. Garbage collection will not run. */
  20. FOUNDATION_EXTERN const int64_t
  21. kFIRFirestoreCacheSizeUnlimited NS_SWIFT_NAME(FirestoreCacheSizeUnlimited);
  22. /** Settings used to configure a `Firestore` instance. */
  23. NS_SWIFT_NAME(FirestoreSettings)
  24. @interface FIRFirestoreSettings : NSObject <NSCopying>
  25. /**
  26. * Creates and returns an empty `FirestoreSettings` object.
  27. *
  28. * @return The created `FirestoreSettings` object.
  29. */
  30. - (instancetype)init NS_DESIGNATED_INITIALIZER;
  31. /** The hostname to connect to. */
  32. @property(nonatomic, copy) NSString* host;
  33. /** Whether to use SSL when connecting. */
  34. @property(nonatomic, getter=isSSLEnabled) BOOL sslEnabled;
  35. /**
  36. * A dispatch queue to be used to execute all completion handlers and event handlers. By default,
  37. * the main queue is used.
  38. */
  39. @property(nonatomic, strong) dispatch_queue_t dispatchQueue;
  40. /**
  41. * NOTE: This field will be deprecated in a future major release. Use the `cacheSettings` field
  42. * instead to specify cache type, and other cache configurations.
  43. *
  44. * Set to false to disable local persistent storage.
  45. */
  46. @property(nonatomic, getter=isPersistenceEnabled) BOOL persistenceEnabled DEPRECATED_MSG_ATTRIBUTE(
  47. "This field is deprecated. Use `cacheSettings` instead.");
  48. /**
  49. * NOTE: This field will be deprecated in a future major release. Use the `cacheSettings` field
  50. * instead to specify cache size, and other cache configurations.
  51. *
  52. * Sets the cache size threshold above which the SDK will attempt to collect least-recently-used
  53. * documents. The size is not a guarantee that the cache will stay below that size, only that if
  54. * the cache exceeds the given size, cleanup will be attempted. Cannot be set lower than 1MB.
  55. *
  56. * Set to `FirestoreCacheSizeUnlimited` to disable garbage collection entirely.
  57. */
  58. @property(nonatomic, assign) int64_t cacheSizeBytes DEPRECATED_MSG_ATTRIBUTE(
  59. "This field is deprecated. Use `cacheSettings` instead.");
  60. /**
  61. * Specifies the cache used by the SDK. Available options are `PersistentCacheSettings`
  62. * and `MemoryCacheSettings`, each with different configuration options.
  63. *
  64. * When unspecified, `PersistentCacheSettings` will be used by default.
  65. *
  66. * NOTE: setting this field and `cacheSizeBytes` or `persistenceEnabled` at the same time will throw
  67. * an exception during SDK initialization. Instead, use the configuration in
  68. * the `PersistentCacheSettings` object to specify the cache size.
  69. */
  70. @property(nonatomic, strong) id<FIRLocalCacheSettings, NSObject> cacheSettings;
  71. @end
  72. NS_ASSUME_NONNULL_END