FPRGDTRateLimiter+Private.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // Copyright 2020 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #import "FirebasePerformance/Sources/Loggers/FPRGDTRateLimiter.h"
  15. #import <UIKit/UIKit.h>
  16. #import "FirebasePerformance/Sources/Common/FPRPerfDate.h"
  17. #import "FirebasePerformance/Sources/Configurations/FPRConfigurations.h"
  18. NS_ASSUME_NONNULL_BEGIN
  19. /**
  20. * Extension that is added on top of the class FPRGDTRateLimiter to make the
  21. * private methods visible between the implementation file and the unit tests.
  22. */
  23. @interface FPRGDTRateLimiter ()
  24. /**
  25. * Number of events that are allowed per minute. This is an internal variable used only for unit
  26. * testing.
  27. */
  28. @property(nonatomic) CGFloat overrideRate;
  29. /**
  30. * Number of network events that are allowed per minute. This is an internal variable used only for
  31. * unit testing.
  32. */
  33. @property(nonatomic) CGFloat overrideNetworkRate;
  34. /** Number of trace events that can be sent in burst per minute. */
  35. @property(nonatomic) NSInteger traceEventBurstSize;
  36. /** Number of network events that can be sent in burst per minute. */
  37. @property(nonatomic) NSInteger networkEventburstSize;
  38. /** Total number of trace events that are allowed to be sent . */
  39. @property(nonatomic) NSInteger allowedTraceEventsCount;
  40. /** Number of network events that are allowed to be sent . */
  41. @property(nonatomic) NSInteger allowedNetworkEventsCount;
  42. /** Time at which the last trace event was sent. */
  43. @property(nonatomic) NSDate *lastTraceEventTime;
  44. /** Time at which the last network event was sent. */
  45. @property(nonatomic) NSDate *lastNetworkEventTime;
  46. /** @brief Override configurations. */
  47. @property(nonatomic) FPRConfigurations *configurations;
  48. /**
  49. * Creates an instance of the FPRGDTRateLimiter with the defined date.
  50. *
  51. * @param date The date object used for time calculations.
  52. * @return An instance of the rate limiter.
  53. */
  54. - (instancetype)initWithDate:(id<FPRDate>)date;
  55. @end
  56. NS_ASSUME_NONNULL_END