Beamable SDK
|
Batch manager. This generic class manages the business logic which determines how and when a batch is expired. More...
Public Member Functions | |
BatchManager (CoroutineService coroutineService, int batchCapacity, double batchTimeoutSeconds, float heartbeatInterval=1f) | |
Initializes a new instance of the BatchManager<T> 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... | |
Batch manager. This generic class manages the business logic which determines how and when a batch is expired.
|
inline |
Initializes a new instance of the BatchManager<T> class.
|
inlinevirtual |
Add the specified item to the batch.
item | Item. |
Reimplemented in Beamable.Api.Analytics.Batch.PersistentBatchManager< T >.
|
inlineprotectedvirtual |
Checks whether the batch should be expired.
|
inlinevirtual |
Flush this Batch This causes it to expire, trigger the relevant callbacks, and rotate
|
inlineprotected |
Raises the expired event.
batchItems | Batch items. |
|
inlineprotectedvirtual |
Heartbeat which occurs at a regular interval and executes lifecycle logic
Reimplemented in Beamable.Api.Analytics.Batch.PersistentBatchManager< T >.
|
inlineprotectedvirtual |
Rotates the batch. This creates a new batch and hooks the OnExpired event
Reimplemented in Beamable.Api.Analytics.Batch.PersistentBatchManager< T >.
|
inline |
Sets the batch's capacity threshold before expiration.
batchCapacity | Batch capacity. |
|
inline |
Sets the timeout seconds before expiration.
batchTimeoutSeconds | Batch timeout seconds. |
|
inline |
Start this batch's lifecycle processing This starts a coroutine which executs a Heartbeat at a regular interval
|
inline |
Stop this batch's lifecycle processing This means the Heartbeat will cease to execute
|
protected |
Flag for whether the BatchManager is actively evaluating the batch's lifecycle
Action<List<T> > Beamable.Api.Analytics.Batch.BatchManager< T >.OnBatchExpired |
Occurs when on batch expired.