View Source wfnet_tasks (wfnet v0.1.0)
Functions for handling the workflow task states and results.
All the data is kept in an ETS table, which is created with wfnet_net:load_ets/1
.
Each record in the table is of type wfnet:task_rec()
, see include/wfnet.hrl
for details.
{ Id, Type, State, Pred, Succ, Data, Result }
Summary
Functions
collect and return the results of all the tasks.
collect and return the states of all the tasks.
Return the result field of a task
Return the state field of a task
save a task's result
save a task's state
Types
-type task_id() :: integer().
-type task_state() :: inactive | done | waiting | running.
Functions
-spec all_results(ets:table()) -> {ok, map()} | {error, term()}.
-spec all_states(ets:table()) -> {ok, map()} | {error, term()}.
Return the result field of a task
In case of non-existent table or task record error
will be returned.
-spec get_state(ets:table(), task_id()) -> {ok, task_state()} | {error, term()}.
Return the state field of a task
In case of non-existent table or task recorderror
will be returned.
-spec put_state(ets:table(), task_id(), task_state()) -> ok | {error, term()}.