View Source WorkflowMetal.Case.Case (workflow_metal v0.2.1)
GenStateMachine
process to present a workflow case.
storage
Storage
The data of :token_table
is stored in ETS in the following format:
{token_id, token_schema, token_state, place_id, locked_by_task_id, consumed_by_task_id}
state
State
created+------->active+------->finished
+ +
| |
| v
+---------->terminated
restore
Restore
Restore a case while offering tokens.
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Consume tokens.
Free tokens that locked by the task.
Free tokens that locked by the task.
Issue tokens.
Lock tokens.
Offer :free
and :locked
tokens to the task.
terminate a case.
Link to this section Types
Specs
application() :: WorkflowMetal.Application.t()
Specs
case_id() :: WorkflowMetal.Storage.Schema.Case.id()
Specs
case_schema() :: WorkflowMetal.Storage.Schema.Case.t()
Specs
options() :: [name: term(), case_schema: case_schema()]
Specs
place_schema() :: WorkflowMetal.Storage.Schema.Place.t()
Specs
t() :: %WorkflowMetal.Case.Case{ application: application() | nil, case_schema: case_schema() | nil, end_place: place_schema() | nil, free_token_ids: MapSet.t(), start_place: place_schema() | nil, token_table: :ets.tid() | nil }
Specs
task_id() :: WorkflowMetal.Storage.Schema.Task.id()
Specs
token_id() :: WorkflowMetal.Storage.Schema.Token.id()
Specs
token_schema() :: WorkflowMetal.Storage.Schema.Token.t()
Specs
workflow_id() :: WorkflowMetal.Storage.Schema.Workflow.id()
Specs
workflow_identifier() :: WorkflowMetal.Workflow.Supervisor.workflow_identifier()
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Specs
consume_tokens(:gen_statem.server_ref(), task_id()) :: {:ok, [token_schema(), ...]} | {:error, :tokens_not_available}
Consume tokens.
Specs
fetch_locked_tokens_from_task(:gen_statem.server_ref(), task_id()) :: {:ok, [token_schema()]}
Free tokens that locked by the task.
eg: free :locked
tokens when a task has been abandoned.
Specs
free_tokens_from_task(:gen_statem.server_ref(), task_id()) :: :ok
Free tokens that locked by the task.
eg: free :locked
tokens when a task has been abandoned.
Specs
issue_tokens(:gen_statem.server_ref(), [token_schema(), ...]) :: {:ok, [token_schema(), ...]}
Issue tokens.
Specs
lock_tokens(:gen_statem.server_ref(), [token_id()], task_id()) :: {:ok, [token_schema(), ...]} | {:error, :tokens_not_available}
Lock tokens.
Specs
offer_tokens_to_task(:gen_statem.server_ref(), task_id()) :: {:ok, [token_schema()]}
Offer :free
and :locked
tokens to the task.
eg: request :free
and :locked
tokens when a task restore from storage.
Specs
terminate(:gen_statem.server_ref()) :: :ok
terminate a case.