Initialise channel with persistence and context

This commit is contained in:
Christoph Wendt 2015-09-03 23:22:04 -07:00
parent ca405da200
commit c88249d3be
2 changed files with 20 additions and 17 deletions

View File

@ -36,15 +36,15 @@
@class BITOrderedDictionary; @class BITOrderedDictionary;
@class BITConfiguration; @class BITConfiguration;
@class BITTelemetryData; @class BITTelemetryData;
@class BITTelemetryContext;
@class BITPersistence;
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface BITChannel : NSObject @interface BITChannel : NSObject
///----------------------------------------------------------------------------- @property (nonatomic, strong) BITTelemetryContext *telemetryContext;
/// @name Queue management
///-----------------------------------------------------------------------------
@property (nonatomic, strong) BITPersistence *persistence;
/** /**
* A queue which makes array operations thread safe. * A queue which makes array operations thread safe.
*/ */
@ -55,6 +55,13 @@ NS_ASSUME_NONNULL_BEGIN
*/ */
@property (nonatomic, assign) NSUInteger dataItemCount; @property (nonatomic, assign) NSUInteger dataItemCount;
/**
* A timer source which is used to flush the queue after a cretain time.
*/
@property (nonatomic, strong, null_unspecified) dispatch_source_t timerSource;
- (instancetype)initWithTelemetryContext:(BITTelemetryContext *)telemetryContext persistence:(BITPersistence *) persistence;
/** /**
* Enqueue telemetry data (events, metrics, exceptions, traces) before processing it. * Enqueue telemetry data (events, metrics, exceptions, traces) before processing it.
* *
@ -67,10 +74,6 @@ NS_ASSUME_NONNULL_BEGIN
*/ */
- (void)persistDataItemQueue; - (void)persistDataItemQueue;
///-----------------------------------------------------------------------------
/// @name JSON Stream
///-----------------------------------------------------------------------------
/** /**
* Adds the specified dictionary to the JSON Stream string. * Adds the specified dictionary to the JSON Stream string.
* *
@ -93,15 +96,6 @@ void bit_appendStringToSafeJsonStream(NSString *string, char *__nonnull*__nonnul
*/ */
void bit_resetSafeJsonStream(char *__nonnull*__nonnull jsonStream); void bit_resetSafeJsonStream(char *__nonnull*__nonnull jsonStream);
///-----------------------------------------------------------------------------
/// @name Batching
///-----------------------------------------------------------------------------
/**
* A timer source which is used to flush the queue after a cretain time.
*/
@property (nonatomic, strong, null_unspecified) dispatch_source_t timerSource;
/** /**
* Starts the timer. * Starts the timer.
*/ */

View File

@ -3,6 +3,7 @@
#if HOCKEYSDK_FEATURE_TELEMETRY #if HOCKEYSDK_FEATURE_TELEMETRY
#import "HockeySDK.h" #import "HockeySDK.h"
#import "BITTelemetryContext.h"
#import "BITTelemetryData.h" #import "BITTelemetryData.h"
#import "HockeySDKPrivate.h" #import "HockeySDKPrivate.h"
@ -28,6 +29,14 @@ static BITChannel *_sharedChannel = nil;
return self; return self;
} }
- (instancetype)initWithTelemetryContext:(BITTelemetryContext *)telemetryContext persistence:(BITPersistence *) persistence {
if(self = [self init]) {
_telemetryContext = telemetryContext;
_persistence = persistence;
}
return self;
}
#pragma mark - Queue management #pragma mark - Queue management
- (BOOL)isQueueBusy{ - (BOOL)isQueueBusy{