FerricStore.Workflow (ferricstore_sdk v0.4.2)

Copy Markdown View Source

State-machine workflow convenience API.

This layer keeps workflows explicit: start a flow in a state, claim due work, transition to the next state, or finish with complete/fail/retry.

Summary

Types

t()

@type t() :: %FerricStore.Workflow{
  client: pid(),
  codec: module(),
  initial_state: binary(),
  lease_ms: pos_integer(),
  type: binary(),
  worker: binary()
}

Functions

claim(workflow, state, opts \\ [])

complete(workflow, id, opts)

fail(workflow, id, opts)

install_policy(workflow, opts \\ [])

@spec install_policy(
  t(),
  keyword()
) :: FerricStore.Flow.PolicySnapshot.t() | {:error, term()}

Installs this workflow's Flow policy.

Workflow declarations replace the stored policy by default. Pass replace: false to request an explicit deep patch, and use expected_generation for compare-and-swap installation.

new(client, type, opts \\ [])

retry(workflow, id, opts)

start(workflow, id, opts \\ [])

transition(workflow, id, from_state, to_state, opts)