Two Phase Commit v0.1.0 Traktor.Action behaviour View Source
The action specification.
An action defines the business logic that is executed in a two-phase-commit approch. A module providing the busness logic must export the following two functions:
prepare/2
function that prepares the execution of the businses logic;commit/2
function that executes the business logic.Calling the two functions after each other will run the business logic and return the result.
with {:ok, transaction} <- prepare(state, args),
{:ok, new_state, result} <- commit(state, transaction) do
{:ok, new_state, result}
end
Link to this section Summary
Types
Specific arguments required to apply an action to an entity
Action error
Data resulting from commiting an action that is not included in the entity state
The state of an entity at a specific revision
Module implementing the Traktor.Action
behaviour
A transaction contains all the information required to commit an action
Link to this section Types
Specific arguments required to apply an action to an entity.
Action error.
Data resulting from commiting an action that is not included in the entity state.
The state of an entity at a specific revision.
Module implementing the Traktor.Action
behaviour.
A transaction contains all the information required to commit an action.
Link to this section Callbacks
commit(state(), transaction()) :: {:ok, state(), result()} | on_error()
prepare(state(), args()) :: {:ok, transaction()} | on_error()