View Source wfnet_net (wfnet v0.1.0)
Summary
Functions
Check/validate the graph of a workflow
Check that a WF definition is valid.
load the workflow into a digraph.
Load a workflow definition into an ETS table.
read a workflow file and return it as a list of task tuples.
Types
-type task_data() :: term().
-type task_id() :: integer().
-type task_rec() :: #task_rec{}.
-type task_state() :: inactive | done | waiting | running.
-type task_type() :: wfenter | wftask | wfands | wfandj | wfxors | wfxorj | wfexit.
Functions
-spec check_digraph(digraph:graph()) -> ok | {error, term()}.
Check/validate the graph of a workflow
We check for the following:
- There should be no leftover
placeholder
vertices. - There should be exactly one
wfenter
, and with no predecessors. - There should be exactly one
wfexit
, and with no successors. - All other tasks must be on a path between
wfenter
andwfexit
.
-spec check_wf([task()]) -> ok | {error, term()}.
Check that a WF definition is valid.
Check that the task tuples in a WF are valid.-spec load_digraph(list()) -> {ok, digraph:graph()} | {error, term()}.
load the workflow into a digraph.
A new digraph containing the workflow is returned.
It is the responsibility of the caller to delete the digraph when no longer needed.Load a workflow definition into an ETS table.
The workflow definition, WF
, is converted to digraph, and the ETS records are generated from the digraph vertices.
-spec read_file(file:name_all()) -> {ok, [term()]} | {error, term()}.