Synapse.Workflow.Persistence behaviour (Synapse v0.1.1)

View Source

Behaviour + helpers for persisting workflow execution snapshots.

Implementations (e.g., Postgres) store durable snapshots so workflows can be resumed after failures.

Summary

Types

request_id()

@type request_id() :: String.t()

Callbacks

delete_snapshot(request_id, keyword)

(optional)
@callback delete_snapshot(
  request_id(),
  keyword()
) :: :ok | {:error, term()}

get_snapshot(request_id, keyword)

(optional)
@callback get_snapshot(
  request_id(),
  keyword()
) ::
  {:ok, Synapse.Workflow.Persistence.Snapshot.t()}
  | {:error, :not_found | term()}

upsert_snapshot(t, keyword)

@callback upsert_snapshot(
  Synapse.Workflow.Persistence.Snapshot.t(),
  keyword()
) :: :ok | {:error, term()}