Skip to main content

with_unique_uuid

Function with_unique_uuid 

Source
pub async fn with_unique_uuid<F, Fut, T, E>(
    value_name: &str,
    try_candidate: F,
) -> Result<T, E>
where F: FnMut(Uuid) -> Fut, Fut: Future<Output = Result<UniqueUuidAttempt<T>, E>>, E: From<UtilsError>,
Expand description

Runs an operation with a business-unique UUID and caller-owned error type.

The callback receives a fresh UUID candidate on every attempt. Returning UniqueUuidAttempt::Collision asks the helper to retry with a new candidate, while returning an error stops immediately and gives that error back to the caller. If all candidates collide, the standard retry-budget error is converted into the caller’s error type.