Implementation of the backoff algorithm API for a "Full Jitter" exponential backoff with jitter strategy. More...
Functions | |
BackoffAlgorithmStatus_t | BackoffAlgorithm_GetNextBackoff (BackoffAlgorithmContext_t *pRetryContext, uint32_t randomValue, uint16_t *pNextBackOff) |
Simple exponential backoff and jitter function that provides the delay value for the next retry attempt. After a failure of an operation that needs to be retried, the application should use this function to obtain the backoff delay value for the next retry, and then wait for the backoff time period before retrying the operation. More... | |
void | BackoffAlgorithm_InitializeParams (BackoffAlgorithmContext_t *pContext, uint16_t backOffBase, uint16_t maxBackOff, uint32_t maxAttempts) |
Initializes the context for using backoff algorithm. The parameters are required for calculating the next retry backoff delay. This function must be called by the application before the first new retry attempt. More... | |
Implementation of the backoff algorithm API for a "Full Jitter" exponential backoff with jitter strategy.
BackoffAlgorithmStatus_t BackoffAlgorithm_GetNextBackoff | ( | BackoffAlgorithmContext_t * | pRetryContext, |
uint32_t | randomValue, | ||
uint16_t * | pNextBackOff | ||
) |
Simple exponential backoff and jitter function that provides the delay value for the next retry attempt. After a failure of an operation that needs to be retried, the application should use this function to obtain the backoff delay value for the next retry, and then wait for the backoff time period before retrying the operation.
[in,out] | pRetryContext | Structure containing parameters for the next backoff value calculation. |
[in] | randomValue | The random value to use for calculation of the backoff period. The random value should be in the range of [0, UINT32_MAX]. |
[out] | pNextBackOff | This will be populated with the backoff value (in milliseconds) for the next retry attempt. The value does not exceed the maximum backoff delay configured in the context. |
void BackoffAlgorithm_InitializeParams | ( | BackoffAlgorithmContext_t * | pContext, |
uint16_t | backOffBase, | ||
uint16_t | maxBackOff, | ||
uint32_t | maxAttempts | ||
) |
Initializes the context for using backoff algorithm. The parameters are required for calculating the next retry backoff delay. This function must be called by the application before the first new retry attempt.
[out] | pContext | The context to initialize with parameters required for the next backoff delay calculation function. |
[in] | maxBackOff | The maximum backoff delay (in milliseconds) between consecutive retry attempts. |
[in] | backOffBase | The base value (in milliseconds) of backoff delay to use in the exponential backoff and jitter model. |
[in] | maxAttempts | The maximum number of retry attempts. Set the value to BACKOFF_ALGORITHM_RETRY_FOREVER to retry for ever. |