FIRDatabaseConfig.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 <Foundation/Foundation.h>
  17. @protocol FAuthTokenProvider;
  18. NS_ASSUME_NONNULL_BEGIN
  19. /**
  20. * TODO: Merge FIRDatabaseConfig into FIRDatabase.
  21. */
  22. @interface FIRDatabaseConfig : NSObject
  23. - (id)initWithSessionIdentifier:(NSString *)identifier
  24. authTokenProvider:(id<FAuthTokenProvider>)authTokenProvider;
  25. /**
  26. * By default the Firebase Database client will keep data in memory while your
  27. * application is running, but not when it is restarted. By setting this value
  28. * to YES, the data will be persisted to on-device (disk) storage and will thus
  29. * be available again when the app is restarted (even when there is no network
  30. * connectivity at that time). Note that this property must be set before
  31. * creating your first FIRDatabaseReference and only needs to be called once per
  32. * application.
  33. *
  34. * If your app uses Firebase Authentication, the client will automatically
  35. * persist the user's authentication token across restarts, even without
  36. * persistence enabled. But if the auth token expired while offline and you've
  37. * enabled persistence, the client will pause write operations until you
  38. * successfully re-authenticate (or explicitly unauthenticate) to prevent your
  39. * writes from being sent unauthenticated and failing due to security rules.
  40. */
  41. @property(nonatomic) BOOL persistenceEnabled;
  42. /**
  43. * By default the Firebase Database client will use up to 10MB of disk space to
  44. * cache data. If the cache grows beyond this size, the client will start
  45. * removing data that hasn't been recently used. If you find that your
  46. * application caches too little or too much data, call this method to change
  47. * the cache size. This property must be set before creating your first
  48. * FIRDatabaseReference and only needs to be called once per application.
  49. *
  50. * Note that the specified cache size is only an approximation and the size on
  51. * disk may temporarily exceed it at times.
  52. */
  53. @property(nonatomic) NSUInteger persistenceCacheSizeBytes;
  54. /**
  55. * Sets the dispatch queue on which all events are raised. The default queue is
  56. * the main queue.
  57. */
  58. @property(nonatomic, strong) dispatch_queue_t callbackQueue;
  59. @end
  60. NS_ASSUME_NONNULL_END