GDTCORFlatFileStorage.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright 2018 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. #import <GoogleDataTransport/GDTCORLifecycle.h>
  18. #import <GoogleDataTransport/GDTCORStorageProtocol.h>
  19. @class GDTCOREvent;
  20. @class GDTCORUploadCoordinator;
  21. NS_ASSUME_NONNULL_BEGIN
  22. /** Manages the storage of events. This class is thread-safe. */
  23. @interface GDTCORFlatFileStorage
  24. : NSObject <NSSecureCoding, GDTCORStorageProtocol, GDTCORLifecycleProtocol>
  25. /** The queue on which all storage work will occur. */
  26. @property(nonatomic) dispatch_queue_t storageQueue;
  27. /** A map of targets to a set of stored events. */
  28. @property(nonatomic)
  29. NSMutableDictionary<NSNumber *, NSMutableSet<GDTCOREvent *> *> *targetToEventSet;
  30. /** All the events that have been stored. */
  31. @property(readonly, nonatomic) NSMutableDictionary<NSNumber *, GDTCOREvent *> *storedEvents;
  32. /** The upload coordinator instance used by this storage instance. */
  33. @property(nonatomic) GDTCORUploadCoordinator *uploadCoordinator;
  34. /** Creates and/or returns the storage singleton.
  35. *
  36. * @return The storage singleton.
  37. */
  38. + (instancetype)sharedInstance;
  39. /** Returns the path to the keyed archive of the singleton. This is where the singleton is saved
  40. * to disk during certain app lifecycle events.
  41. *
  42. * @return File path to serialized singleton.
  43. */
  44. + (NSString *)archivePath;
  45. @end
  46. NS_ASSUME_NONNULL_END