atomicUpdate

fun <T> atomicUpdate(container: StateContainer<T>, updater: (T) -> T, maxRetries: Int = 10): StateUpdateResult<T>

Atomically updates state with retry logic for failed operations.

This method provides additional retry logic for update operations that might fail due to transient issues. Since the underlying StateContainer implementations are already thread-safe, this mainly handles retry logic for validation failures or temporary operation failures.

Return

StateUpdateResult indicating success or failure

Parameters

container

The state container to update

updater

Function to transform the state

maxRetries

Maximum number of retry attempts (default: 10)