View Source WorkflowMetal.Storage.Adapter behaviour (workflow_metal v0.2.1)

Defines the behaviour to be implemented by a storage adapter to be used by WorkflowMetal.

Link to this section Summary

Callbacks

Return a child spec for the storage

Consume tokens that locked by the task.

Delete a specified workflow.

Retrieve start and end of a workflow.

Retrieve in/out places of a transition.

Retrieve tokens of the task.

Retrieve a transition of the workflow.

Retrieve in/out transitions of a place.

Retrieve tokens of the task.

Fetch a workitem of a task.

Retrieve workitems generated by the task.

Insert a workitem of a task.

Unlock tokens that locked by the task.

Link to this section Types

Specs

adapter_meta() :: map()

Specs

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

Specs

arc_beginning() :: {:transition, transition_id()} | {:place, place_id()}

Specs

Specs

Specs

Specs

Specs

Specs

config() :: keyword()

Specs

error() :: term()

Specs

fetch_tasks_options() ::
  [state: [task_state(), ...], transition_id: transition_id()]
  | [{:transition_id, transition_id()}]

Specs

on_consume_tokens() :: {:ok, [token_schema()]}

Specs

on_delete_workflow() :: :ok

Specs

on_fetch_arcs() :: {:ok, [arc_schema()]}

Specs

on_fetch_case() :: {:ok, case_schema()} | {:error, :case_not_found}
Link to this type

on_fetch_edge_places()

View Source

Specs

on_fetch_edge_places() :: {:ok, {place_schema(), place_schema()}}

Specs

on_fetch_places() :: {:ok, [place_schema()]}

Specs

on_fetch_task() :: {:ok, task_schema()} | {:error, :task_not_found}

Specs

on_fetch_tasks() :: {:ok, [task_schema()]}

Specs

on_fetch_tokens() :: {:ok, [token_schema()]}

Specs

on_fetch_transition() ::
  {:ok, transition_schema()} | {:error, :transition_not_found}
Link to this type

on_fetch_transitions()

View Source

Specs

on_fetch_transitions() :: {:ok, [transition_schema()]}
Link to this type

on_fetch_unconsumed_tokens()

View Source

Specs

on_fetch_unconsumed_tokens() :: {:ok, [token_schema()]}

Specs

on_fetch_workflow() :: {:ok, workflow_schema()}

Specs

on_fetch_workitem() :: {:ok, workitem_schema()} | {:error, :workitem_not_found}

Specs

on_fetch_workitems() :: {:ok, [workitem_schema()]} | {:error, :task_not_found}

Specs

on_insert_case() :: {:ok, case_schema()} | {:error, error()}

Specs

on_insert_task() ::
  {:ok, task_schema()}
  | {:error, :workflow_not_found}
  | {:error, :transition_not_found}
  | {:error, :case_not_found}

Specs

on_insert_workflow() :: {:ok, workflow_schema()} | {:error, error()}

Specs

on_insert_workitem() ::
  {:ok, workitem_schema()}
  | {:error, :workflow_not_found}
  | {:error, :case_not_found}
  | {:error, :task_not_found}

Specs

on_issue_token() :: {:ok, token_schema()}

Specs

on_lock_tokens() :: {:ok, token_schema()}

Specs

on_unlock_tokens() :: {:ok, [token_schema()]}

Specs

on_update_case() :: {:ok, case_schema()} | {:error, error()}

Specs

on_update_task() ::
  {:ok, task_schema()}
  | {:error, :task_not_found}
  | {:error, :task_not_available}

Specs

on_update_workitem() ::
  {:ok, workitem_schema()}
  | {:error, :workitem_not_found}
  | {:error, :workitem_not_available}

Specs

Specs

Specs

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

Specs

task_schema() :: WorkflowMetal.Storage.Schema.Task.t()

Specs

task_state() :: WorkflowMetal.Storage.Schema.Task.state()

Specs

Specs

Specs

Specs

Specs

Specs

Specs

update_case_params() :: %{optional(:state) => case_state()}

Specs

update_task_params() :: %{
  optional(:state) => task_state(),
  optional(:token_payload) => token_payload()
}
Link to this type

update_workitem_params()

View Source

Specs

update_workitem_params() :: %{
  optional(:state) => workitem_state(),
  optional(:output) => workitem_output()
}
Link to this type

workflow_associations_params()

View Source

Specs

workflow_associations_params() :: %{
  places: [place_schema()],
  transitions: [transition_schema()],
  arcs: [arc_schema()]
}

Specs

Specs

Specs

workitem_id() :: WorkflowMetal.Storage.Schema.Workitem.id()

Specs

workitem_output() :: WorkflowMetal.Storage.Schema.Workitem.output()

Specs

workitem_schema() :: WorkflowMetal.Storage.Schema.Workitem.t()

Specs

workitem_state() :: WorkflowMetal.Storage.Schema.Workitem.state()

Link to this section Callbacks

Link to this callback

child_spec(application, config)

View Source

Specs

child_spec(application(), config()) ::
  {:ok, :supervisor.child_spec() | {module(), term()} | module(),
   adapter_meta()}

Return a child spec for the storage

Link to this callback

consume_tokens(adapter_meta, list, arg3)

View Source

Specs

consume_tokens(adapter_meta(), [token_id()], task_id() | :termination) ::
  on_consume_tokens()

Consume tokens that locked by the task.

Link to this callback

delete_workflow(adapter_meta, workflow_id)

View Source

Specs

delete_workflow(adapter_meta(), workflow_id()) :: on_delete_workflow()

Delete a specified workflow.

Link to this callback

fetch_arcs(adapter_meta, arc_beginning, arc_direction)

View Source

Specs

Retrieve arcs of a workflow.

Link to this callback

fetch_case(adapter_meta, case_id)

View Source

Specs

fetch_case(adapter_meta(), case_id()) :: on_fetch_case()

Retrieve a case.

Link to this callback

fetch_edge_places(adapter_meta, workflow_id)

View Source

Specs

fetch_edge_places(adapter_meta(), workflow_id()) :: on_fetch_edge_places()

Retrieve start and end of a workflow.

Link to this callback

fetch_places(adapter_meta, transition_id, arc_direction)

View Source

Specs

Retrieve in/out places of a transition.

Link to this callback

fetch_task(adapter_meta, task_id)

View Source

Specs

fetch_task(adapter_meta(), task_id()) :: on_fetch_task()

Retrieve a task.

Link to this callback

fetch_tasks(adapter_meta, case_id, fetch_tasks_options)

View Source

Specs

Retrieve tasks of a case.

Link to this callback

fetch_tokens(adapter_meta, list)

View Source

Specs

fetch_tokens(adapter_meta(), [token_id()]) :: on_fetch_tokens()

Retrieve tokens of the task.

Link to this callback

fetch_transition(adapter_meta, transition_id)

View Source

Specs

fetch_transition(adapter_meta(), transition_id()) :: on_fetch_transition()

Retrieve a transition of the workflow.

Link to this callback

fetch_transitions(adapter_meta, place_id, arc_direction)

View Source

Specs

fetch_transitions(adapter_meta(), place_id(), arc_direction()) ::
  on_fetch_transitions()

Retrieve in/out transitions of a place.

Link to this callback

fetch_unconsumed_tokens(adapter_meta, case_id)

View Source

Specs

fetch_unconsumed_tokens(adapter_meta(), case_id()) ::
  on_fetch_unconsumed_tokens()

Retrieve tokens of the task.

Link to this callback

fetch_workflow(adapter_meta, workflow_id)

View Source

Specs

fetch_workflow(adapter_meta(), workflow_id()) :: on_fetch_workflow()

Retrieve a workflow.

Link to this callback

fetch_workitem(adapter_meta, workitem_id)

View Source

Specs

fetch_workitem(adapter_meta(), workitem_id()) :: on_fetch_workitem()

Fetch a workitem of a task.

Link to this callback

fetch_workitems(adapter_meta, task_id)

View Source

Specs

fetch_workitems(adapter_meta(), task_id()) :: on_fetch_workitems()

Retrieve workitems generated by the task.

Link to this callback

insert_case(adapter_meta, case_schema)

View Source

Specs

insert_case(adapter_meta(), case_schema()) :: on_insert_case()

Insert a case.

Link to this callback

insert_task(adapter_meta, task_schema)

View Source

Specs

insert_task(adapter_meta(), task_schema()) :: on_insert_task()

Create a task.

Link to this callback

insert_workflow(adapter_meta, workflow_schema, workflow_associations_params)

View Source

Specs

Insert a workflow.

Link to this callback

insert_workitem(adapter_meta, workitem_schema)

View Source

Specs

insert_workitem(adapter_meta(), workitem_schema()) :: on_insert_workitem()

Insert a workitem of a task.

Link to this callback

issue_token(adapter_meta, token_schema)

View Source

Specs

issue_token(adapter_meta(), token_schema()) :: on_issue_token()

Issue a token.

If produced_by_task_id is :genesis, the token is a genesis token.

Link to this callback

lock_tokens(adapter_meta, token_ids, locked_by_task_id)

View Source

Specs

lock_tokens(
  adapter_meta(),
  token_ids :: [token_id(), ...],
  locked_by_task_id :: task_id()
) :: on_lock_tokens()

Lock tokens atomically.

Link to this callback

unlock_tokens(adapter_meta, list)

View Source

Specs

unlock_tokens(adapter_meta(), [token_id()]) :: on_unlock_tokens()

Unlock tokens that locked by the task.

Link to this callback

update_case(adapter_meta, case_id, update_case_params)

View Source

Specs

Update the case.

update_case_params

update_case_params:

State

  • :active
  • :terminated
  • :finished
Link to this callback

update_task(adapter_meta, task_id, update_task_params)

View Source

Specs

Update the task.

update_task_params: State and TokenPayload

Link to this callback

update_workitem(adapter_meta, workitem_id, update_workitem_params)

View Source

Specs

Update the workitem.

update_workitem_params: State and Output.