WorkflowStem.ExecutionStore (workflow_stem v0.2.0)

Copy Markdown View Source

In-memory execution store for the workflow stem.

Phase 3: this is intentionally simple and deterministic to support rapid iteration. Persistence is introduced later via the persistence adapter.

Keyed by execution_id and stores {tenant_id, workflow_handle, profile, runtime}.

Summary

Types

entry()

@type entry() :: %{
  execution_id: WorkflowStem.Types.execution_id(),
  tenant_id: WorkflowStem.Types.tenant_id(),
  workflow_handle: WorkflowStem.Types.workflow_handle(),
  profile: WorkflowStem.Types.profile(),
  runtime: WorkflowStem.Types.runtime()
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

delete(execution_id)

@spec delete(WorkflowStem.Types.execution_id()) :: :ok

ensure_started()

@spec ensure_started() :: :ok

fetch(execution_id)

@spec fetch(WorkflowStem.Types.execution_id()) ::
  {:ok, entry()} | {:error, :not_found}

list(tenant_id)

@spec list(WorkflowStem.Types.tenant_id()) :: [entry()]

put(entry)

@spec put(entry()) :: :ok

update(execution_id, fun)

@spec update(WorkflowStem.Types.execution_id(), (entry() ->
                                             {:ok, entry()} | {:error, term()})) ::
  {:ok, entry()} | {:error, term()}