FIRDatabaseConfig.h 2.8 KB

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