View Source WorkflowMetal.Case.Supervisor (workflow_metal v0.2.1)

DynamicSupervisor to supervise all case of a workflow.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

consume tokens that locked by the task

Fetch tokens that locked by the task.

Issue tokens after a task completion.

Open a case(`GenServer').

Request :free and :locked(locked by the task) tokens which should offer to the task.

Terminate a case(`GenServer').

Free tokens that locked by the task.

Link to this section Types

Specs

application() :: WorkflowMetal.Application.t()

Specs

Specs

Specs

task_id() :: WorkflowMetal.Storage.Schema.Task.id()

Specs

Specs

Specs

Specs

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

consume_tokens(application, case_id, task_id)

View Source

Specs

consume_tokens(application(), case_id(), task_id()) ::
  {:ok, [token_schema(), ...]}
  | {:error, :tokens_not_available}
  | {:error, :case_not_found}

consume tokens that locked by the task

This usually happens after a task execution.

Link to this function

fetch_locked_tokens(application, case_id, task_id)

View Source

Specs

fetch_locked_tokens(application(), case_id(), task_id()) ::
  {:ok, [token_schema()]}
  | {:error, :case_not_available}
  | {:error, :case_not_found}

Fetch tokens that locked by the task.

This usually happens when a task is starting.

Link to this function

issue_tokens(application, case_id, token_schema_list)

View Source

Specs

issue_tokens(application(), case_id(), [token_schema(), ...]) ::
  {:ok, [token_schema(), ...]} | {:error, :case_not_found}

Issue tokens after a task completion.

Link to this function

lock_tokens(application, case_id, token_ids, task_id)

View Source

Specs

lock_tokens(application(), case_id(), [token_id(), ...], task_id()) ::
  {:ok, [token_schema(), ...]}
  | {:error, :tokens_not_available}
  | {:error, :case_not_found}

Lock tokens for the task.

This usually happens before a workitem execution.

Link to this function

open_case(application, case_id)

View Source

Specs

open_case(application(), case_id()) ::
  WorkflowMetal.Registration.Adapter.on_start_child()
  | {:error, :case_not_found}
  | {:error, :workflow_not_found}

Open a case(`GenServer').

Link to this function

request_tokens(application, case_id, task_id)

View Source

Specs

request_tokens(application(), case_id(), task_id()) ::
  {:ok, [token_schema()]} | {:error, :case_not_found}

Request :free and :locked(locked by the task) tokens which should offer to the task.

This usually happens after a task restore from the storage.

Link to this function

terminate_case(application, case_id)

View Source

Specs

terminate_case(application(), case_id()) ::
  :ok | {:error, :case_not_found} | {:error, :workflow_not_found}

Terminate a case(`GenServer').

Link to this function

unlock_tokens(application, case_id, task_id)

View Source

Specs

unlock_tokens(application(), case_id(), task_id()) ::
  :ok | {:error, :case_not_available} | {:error, :case_not_found}

Free tokens that locked by the task.

This usually happens afetr a task has been abandoned.