Beamable SDK
Public Member Functions | Protected Member Functions | Protected Attributes | Events | List of all members
Core.Platform.SDK.Analytics.Batch.BatchManager< T > Class Template Reference

Batch manager. This generic class manages the business logic which determines how and when a batch is expired. More...

Inheritance diagram for Core.Platform.SDK.Analytics.Batch.BatchManager< T >:
Inheritance graph
[legend]

Public Member Functions

 BatchManager (CoroutineService coroutineService, int batchCapacity, double batchTimeoutSeconds, float heartbeatInterval=1f)
 Initializes a new instance of the Core.Platform.SDK.Analytics.Batch.BatchManager`1 class. More...
 
void Start ()
 Start this batch's lifecycle processing This starts a coroutine which executs a Heartbeat at a regular interval More...
 
void Stop ()
 Stop this batch's lifecycle processing This means the Heartbeat will cease to execute More...
 
void RestartHeartbeat (bool onlyIfStarted=true)
 
virtual void Add (T item)
 Add the specified item to the batch. More...
 
virtual void Flush ()
 Flush this Batch This causes it to expire, trigger the relevant callbacks, and rotate More...
 
void SetCapacity (int batchCapacity)
 Sets the batch's capacity threshold before expiration. More...
 
void SetTimeoutSeconds (double batchTimeoutSeconds)
 Sets the timeout seconds before expiration. More...
 
void SetHeartbeat (float heatbeatInterval)
 

Protected Member Functions

virtual void RotateBatch ()
 Rotates the batch. This creates a new batch and hooks the OnExpired event More...
 
void OnExpired (List< T > batchItems)
 Raises the expired event. More...
 
virtual void CheckBatchExpired ()
 Checks whether the batch should be expired. More...
 
virtual void OnHeartbeat ()
 Heartbeat which occurs at a regular interval and executes lifecycle logic More...
 
virtual void OnStart ()
 

Protected Attributes

bool _isActive
 Flag for whether the BatchManager is actively evaluating the batch's lifecycle More...
 
int _batchCapacity
 
double _batchTimeoutSeconds
 
double _heartbeatSeconds
 
WaitForSeconds _heartbeatInterval
 
IEnumerator _heatbeatCoroutine
 
IBatchContainer< T > _currentBatch
 

Events

Action< List< T > > OnBatchExpired
 Occurs when on batch expired. More...
 

Detailed Description

Batch manager. This generic class manages the business logic which determines how and when a batch is expired.

Constructor & Destructor Documentation

◆ BatchManager()

Core.Platform.SDK.Analytics.Batch.BatchManager< T >.BatchManager ( CoroutineService  coroutineService,
int  batchCapacity,
double  batchTimeoutSeconds,
float  heartbeatInterval = 1f 
)
inline

Initializes a new instance of the Core.Platform.SDK.Analytics.Batch.BatchManager`1 class.

Parameters
batchCapacityBatch capacity threshold before expiration.
batchTimeoutSecondsBatch timeout seconds before expiration.
heartbeatIntervalHeartbeat interval indicates how often the batch lifecycle is evaluated.

Member Function Documentation

◆ Add()

virtual void Core.Platform.SDK.Analytics.Batch.BatchManager< T >.Add ( item)
inlinevirtual

Add the specified item to the batch.

Parameters
itemItem.

Reimplemented in Core.Platform.SDK.Analytics.Batch.PersistentBatchManager< T >.

◆ CheckBatchExpired()

virtual void Core.Platform.SDK.Analytics.Batch.BatchManager< T >.CheckBatchExpired ( )
inlineprotectedvirtual

Checks whether the batch should be expired.

◆ Flush()

virtual void Core.Platform.SDK.Analytics.Batch.BatchManager< T >.Flush ( )
inlinevirtual

Flush this Batch This causes it to expire, trigger the relevant callbacks, and rotate

◆ OnExpired()

void Core.Platform.SDK.Analytics.Batch.BatchManager< T >.OnExpired ( List< T >  batchItems)
inlineprotected

Raises the expired event.

Parameters
batchItemsBatch items.

◆ OnHeartbeat()

virtual void Core.Platform.SDK.Analytics.Batch.BatchManager< T >.OnHeartbeat ( )
inlineprotectedvirtual

Heartbeat which occurs at a regular interval and executes lifecycle logic

Reimplemented in Core.Platform.SDK.Analytics.Batch.PersistentBatchManager< T >.

◆ RotateBatch()

virtual void Core.Platform.SDK.Analytics.Batch.BatchManager< T >.RotateBatch ( )
inlineprotectedvirtual

Rotates the batch. This creates a new batch and hooks the OnExpired event

Reimplemented in Core.Platform.SDK.Analytics.Batch.PersistentBatchManager< T >.

◆ SetCapacity()

void Core.Platform.SDK.Analytics.Batch.BatchManager< T >.SetCapacity ( int  batchCapacity)
inline

Sets the batch's capacity threshold before expiration.

Parameters
batchCapacityBatch capacity.

◆ SetTimeoutSeconds()

void Core.Platform.SDK.Analytics.Batch.BatchManager< T >.SetTimeoutSeconds ( double  batchTimeoutSeconds)
inline

Sets the timeout seconds before expiration.

Parameters
batchTimeoutSecondsBatch timeout seconds.

◆ Start()

Start this batch's lifecycle processing This starts a coroutine which executs a Heartbeat at a regular interval

◆ Stop()

Stop this batch's lifecycle processing This means the Heartbeat will cease to execute

Member Data Documentation

◆ _isActive

bool Core.Platform.SDK.Analytics.Batch.BatchManager< T >._isActive
protected

Flag for whether the BatchManager is actively evaluating the batch's lifecycle

Event Documentation

◆ OnBatchExpired

Action<List<T> > Core.Platform.SDK.Analytics.Batch.BatchManager< T >.OnBatchExpired

Occurs when on batch expired.


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