map

abstract suspend fun <R> map(transform: suspend (value: T) -> R): DurableFuture<R>

Map the success result of this DurableFuture.

Return

a new DurableFuture with the mapped result, when completed

Parameters

transform

the mapper to execute if this DurableFuture completes with success. The mapper can throw a dev.restate.sdk.common.TerminalException, thus failing the returned DurableFuture.


abstract suspend fun <R> map(transformSuccess: suspend (value: T) -> R, transformFailure: suspend (exception: TerminalException) -> R): DurableFuture<R>

Map both the success and the failure result of this DurableFuture.

Return

a new DurableFuture with the mapped result, when completed

Parameters

transformSuccess

the mapper to execute if this DurableFuture completes with success. The mapper can throw a dev.restate.sdk.common.TerminalException, thus failing the returned DurableFuture.

transformFailure

the mapper to execute if this DurableFuture completes with failure. The mapper can throw a dev.restate.sdk.common.TerminalException, thus failing the returned DurableFuture.