PreEmptive Analytics iOS API  2.0
The official iOS API for sending PreEmptive Analytics data.
<PAFlowController> Protocol Reference

Protocol for defining a flow controller. More...

Inheritance diagram for <PAFlowController>:
PADefaultFlowController

Instance Methods

(NSUInteger) - getInterval:
 Calculates the time to wait until the next automatic batching and sending of messages. More...
 
(NSUInteger) - messagesToDrop:
 The number of messages to drop based in the current count. More...
 
(BOOL) - okToTransmit
 Determines if message sending is currently permitted. More...
 
(void) - onSend:
 Updates the flow controller based on the success or failure of a message transmission. More...
 
(BOOL) - hasBatchExpired:attempts:
 Determines if a stored messages batch has expired and is eligible for deletion/dropping. More...
 

Properties

NSUInteger queueSize
 The maximum number of messages that can be held in the queue.
 
NSUInteger highWater
 The point at which queued messages should be batched and sent. More...
 
NSUInteger minimumInterval
 The minimum amout of time the transmitter should wait between checking the message queue specified in milliseconds.
 
NSUInteger maximumInterval
 The maximum amout of time the transmitter should wait between checking the message queue specified in milliseconds.
 
BOOL offline
 Is the transmission of messages prohibited?
 
BOOL sendDisabled
 Is the transmission of messages temporarily disabled? More...
 
BOOL supportOfflineStorage
 Is offline storage of messages permitted?
 
NSUInteger maximumBatchSize
 The maximum size (in bytes) of a message batch. More...
 
NSUInteger minimumFailureCount
 The minimum amount of times a message should be attempted to be sent before becoming eligible for deletion from offline storage.
 
NSUInteger minimumTimeToLive
 The minimum age(in seconds) a message must be before it becomes eligible for deletion from offline storage.
 

Detailed Description

Protocol for defining a flow controller.

Definition at line 13 of file PAFlowController.h.

Method Documentation

- (NSUInteger) getInterval: (NSUInteger)  numberOfMessages

Calculates the time to wait until the next automatic batching and sending of messages.

It should return a value between minimumInterval and maximumInterval based on history of the number of messages being sent and the queueSize.

Parameters
numberOfMessagesThe number of messages just batched and sent.
Returns
The time interval to wait in milliseconds.

Reimplemented in PADefaultFlowController.

- (BOOL) hasBatchExpired: (NSDate *)  date
attempts: (NSUInteger)  attempts 

Determines if a stored messages batch has expired and is eligible for deletion/dropping.

This should take into account minimumFailureCount and minimumTimeToLive.

Parameters
dateThe creation date of the batch.
attemptsThe number of transmission attempts.
Returns
YES if it has expired.

Reimplemented in PADefaultFlowController.

- (NSUInteger) messagesToDrop: (NSUInteger)  currentMessageCount

The number of messages to drop based in the current count.

Typically those above the queueSize would be dropped.

Parameters
currentMessageCountThe current number of messages.
Returns
The number of messages to drop

Reimplemented in PADefaultFlowController.

- (BOOL) okToTransmit

Determines if message sending is currently permitted.

This should take the follwing properties into account online and sendDisabled.

Returns
YES If it is ok to transmit.

Reimplemented in PADefaultFlowController.

- (void) onSend: (BOOL)  sendSucceeded

Updates the flow controller based on the success or failure of a message transmission.

Parameters
sendSucceededWas the transmission successful?

Reimplemented in PADefaultFlowController.

Property Documentation

- (NSUInteger) highWater
readwriteatomic

The point at which queued messages should be batched and sent.

Must be less than queueSize

Definition at line 23 of file PAFlowController.h.

- (NSUInteger) maximumBatchSize
readwriteatomic

The maximum size (in bytes) of a message batch.

If a batch exceeds this size, it is split into multiple batches. If a single message exceeds this size, it will be discarded if transmission fails at any time.

Definition at line 54 of file PAFlowController.h.

- (BOOL) sendDisabled
readwriteatomic

Is the transmission of messages temporarily disabled?

See also
PAClient::setSendDisabled

Definition at line 44 of file PAFlowController.h.


The documentation for this protocol was generated from the following file: