WorkflowStem.Persistence (workflow_stem v0.5.0)

Copy Markdown View Source

Persistence adapter facade for workflow executions and checkpoints.

Reads the adapter module from :workflow_stem, :persistence_adapter (a module implementing WorkflowStem.Adapters.PersistenceAdapter; the value must be a module name or nil). With no adapter configured, persistence is disabled:

Configure an adapter with:

config :workflow_stem, persistence_adapter: MyApp.WorkflowPersistence

Summary

Functions

adapter()

@spec adapter() :: module() | nil

enabled?()

@spec enabled?() :: boolean()

Returns true when a configured adapter module implements save_execution/2. Loads the adapter module if it is not loaded yet.

get_execution(tenant_id, execution_id)

@spec get_execution(String.t(), String.t()) :: {:ok, map()} | {:error, term()}

list_executions(tenant_id, opts)

@spec list_executions(String.t(), map()) :: {:ok, [map()]} | {:error, term()}

save_checkpoint(tenant_id, execution_id, checkpoint)

@spec save_checkpoint(String.t(), String.t(), map()) ::
  {:ok, term()} | {:error, term()}

save_execution(tenant_id, execution)

@spec save_execution(String.t(), map()) :: {:ok, term()} | {:error, term()}