Function golem_rust::operation

source ยท
pub fn operation<In: Clone, Out: Clone, Err: Clone>(
    execute_fn: impl Fn(In) -> Result<Out, Err> + 'static,
    compensate_fn: impl Fn(In, Out) -> Result<(), Err> + 'static,
) -> impl Operation<In = In, Out = Out, Err = Err>
Expand description

Constructs an Operation from two closures: one for executing the operation, and one for rolling it back. The rollback operation always sees the input and the output of the operation.

This operation can run the compensation in both fallible and infallible transactions.