FIRDatabaseConfig.h 2.7 KB

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