Two Phase Commit v0.1.0 Traktor View Source
Traktor is a library to execute actions in a traceable manner by applying a two-phase-commit pattern.
It is mainly defined by two behaviours:
Traktor.Actionfor the business logic;Traktor.Storefor the persistance layer.
Entity
An action or a group of actions can be applied to an entity. The action is a behaviour that transforms an entity from one version to another. Eg. booking and payment actions are applied to the Checkout entity.
Link to this section Summary
Types
Module implementing the Traktor.Action behaviour
Specific arguments required to apply an action to an entity
Unique reference of an entity
The revision of the state of an entity
The state of an entity at a specific revision
Module implementing the Traktor.Store behaviour. An in memory store is provided with the package
A transaction contains all the information required to commit an action
Unique reference of a transaction
Functions
Executes the business logic and persists the result
Prepares the execution of the businses logic and persists it
Link to this section Types
Module implementing the Traktor.Action behaviour.
Specific arguments required to apply an action to an entity.
error_reason() ::
{:conflict, revision()} | {:pending, transaction_ref()} | term()
Unique reference of an entity.
The revision of the state of an entity.
The state of an entity at a specific revision.
Module implementing the Traktor.Store behaviour. An in memory store is provided with the package.
A transaction contains all the information required to commit an action.
Unique reference of a transaction.
Link to this section Functions
Runs both phases of the two phase commit: prepare/6 and commit/6.
commit(action(), state(), transaction(), store(), ref(), transaction_ref()) :: {:ok, state(), revision(), result :: any()} | on_error()
Executes the business logic and persists the result.
prepare(action(), state(), args(), store(), ref(), revision()) :: {:ok, transaction(), transaction_ref()} | on_error()
Prepares the execution of the businses logic and persists it.