Durable.Storage.Schemas.WorkflowExecution (Durable v0.1.0-rc)

View Source

Ecto schema for workflow execution records.

Each workflow execution represents a single run of a workflow, tracking its status, context, and progress through steps.

Summary

Functions

Creates a changeset for inserting a new workflow execution.

Creates a changeset for marking workflow as compensated (all compensations succeeded).

Creates a changeset for marking workflow as compensating.

Creates a changeset for marking workflow compensation as failed.

Creates a changeset for locking a workflow for execution.

Creates a changeset for updating workflow status.

Creates a changeset for unlocking a workflow.

Types

status()

@type status() ::
  :pending
  | :running
  | :completed
  | :failed
  | :waiting
  | :cancelled
  | :compensating
  | :compensated
  | :compensation_failed

t()

@type t() :: %Durable.Storage.Schemas.WorkflowExecution{
  __meta__: term(),
  compensated_at: DateTime.t() | nil,
  compensation_results: [map()],
  completed_at: DateTime.t() | nil,
  context: map(),
  current_step: String.t() | nil,
  error: map() | nil,
  id: Ecto.UUID.t(),
  input: map(),
  inserted_at: DateTime.t(),
  lock_token: term(),
  locked_at: DateTime.t() | nil,
  locked_by: String.t() | nil,
  parent_workflow_id: Ecto.UUID.t() | nil,
  pending_inputs: term(),
  priority: integer(),
  queue: String.t(),
  scheduled_at: DateTime.t() | nil,
  started_at: DateTime.t() | nil,
  status: status(),
  step_executions: term(),
  updated_at: DateTime.t(),
  workflow_module: String.t(),
  workflow_name: String.t()
}

Functions

changeset(execution, attrs)

Creates a changeset for inserting a new workflow execution.

compensated_changeset(execution, results)

Creates a changeset for marking workflow as compensated (all compensations succeeded).

compensating_changeset(execution)

Creates a changeset for marking workflow as compensating.

compensation_failed_changeset(execution, results, error)

Creates a changeset for marking workflow compensation as failed.

lock_changeset(execution, locked_by)

Creates a changeset for locking a workflow for execution.

status_changeset(execution, status, attrs \\ %{})

Creates a changeset for updating workflow status.

unlock_changeset(execution)

Creates a changeset for unlocking a workflow.