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

Persistent Batch Manager. Subclass of BatchManager that adds the ability to persist batches to disk and restore from disk This BatchManager enforces that type T is a JsonSerializable.ISerializable More...

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

Public Member Functions

 PersistentBatchManager (CoroutineService coroutineService, string storageKey, int batchCapacity, double batchTimeoutSeconds, float heartbeatInterval=1f)
 Initializes a new instance of the Core.Platform.SDK.Analytics.Batch.PersistentBatchManager`1 class. More...
 
override void Add (T item)
 Add an item to the Batch More...
 
- Public Member Functions inherited from Core.Platform.SDK.Analytics.Batch.BatchManager< T >
 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 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

override void OnStart ()
 
override void RotateBatch ()
 Rotates the batch. This creates a new batch, hooks OnExpired event, and declares the batch ready for backup More...
 
override void OnHeartbeat ()
 Raises the heartbeat event. This runs the base class OnHeartbeat and also checks whether we should backup the batch. More...
 
void BackupEventBatch ()
 Backups the event batch to disk. More...
 
void RestoreEventBatch ()
 Restores the event batch from disk and adds any elements to the current batch. More...
 
- Protected Member Functions inherited from Core.Platform.SDK.Analytics.Batch.BatchManager< T >
void OnExpired (List< T > batchItems)
 Raises the expired event. More...
 
virtual void CheckBatchExpired ()
 Checks whether the batch should be expired. More...
 

Protected Attributes

string _storageKey
 The storage key used for persisting to disk. More...
 
bool _backupBatchNow
 A flag which determines whether to backup the current batch on the next Heartbeat. More...
 
- Protected Attributes inherited from Core.Platform.SDK.Analytics.Batch.BatchManager< T >
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
 

Additional Inherited Members

- Events inherited from Core.Platform.SDK.Analytics.Batch.BatchManager< T >
Action< List< T > > OnBatchExpired
 Occurs when on batch expired. More...
 

Detailed Description

Persistent Batch Manager. Subclass of BatchManager that adds the ability to persist batches to disk and restore from disk This BatchManager enforces that type T is a JsonSerializable.ISerializable

Type Constraints
T :class 
T :JsonSerializable.ISerializable 

Constructor & Destructor Documentation

◆ PersistentBatchManager()

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

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

Parameters
storageKeyStorage key used for persistent storage.
batchCapacityBatch capacity threshold for batch expiration.
batchTimeoutSecondsMaximum seconds before a batch is expired.
heartbeatIntervalHeartbeat interval.

Member Function Documentation

◆ Add()

override void Core.Platform.SDK.Analytics.Batch.PersistentBatchManager< T >.Add ( item)
inlinevirtual

Add an item to the Batch

Parameters
itemItem.

Reimplemented from Core.Platform.SDK.Analytics.Batch.BatchManager< T >.

◆ BackupEventBatch()

void Core.Platform.SDK.Analytics.Batch.PersistentBatchManager< T >.BackupEventBatch ( )
inlineprotected

Backups the event batch to disk.

◆ OnHeartbeat()

override void Core.Platform.SDK.Analytics.Batch.PersistentBatchManager< T >.OnHeartbeat ( )
inlineprotectedvirtual

Raises the heartbeat event. This runs the base class OnHeartbeat and also checks whether we should backup the batch.

Reimplemented from Core.Platform.SDK.Analytics.Batch.BatchManager< T >.

◆ RestoreEventBatch()

void Core.Platform.SDK.Analytics.Batch.PersistentBatchManager< T >.RestoreEventBatch ( )
inlineprotected

Restores the event batch from disk and adds any elements to the current batch.

◆ RotateBatch()

override void Core.Platform.SDK.Analytics.Batch.PersistentBatchManager< T >.RotateBatch ( )
inlineprotectedvirtual

Rotates the batch. This creates a new batch, hooks OnExpired event, and declares the batch ready for backup

Reimplemented from Core.Platform.SDK.Analytics.Batch.BatchManager< T >.

Member Data Documentation

◆ _backupBatchNow

bool Core.Platform.SDK.Analytics.Batch.PersistentBatchManager< T >._backupBatchNow
protected

A flag which determines whether to backup the current batch on the next Heartbeat.

◆ _storageKey

The storage key used for persisting to disk.


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