FerricStore.Flow.Job (ferricstore v0.4.2)

Copy Markdown View Source

Claimed Flow job returned by FerricStore.Flow.Workflow modules.

FerricStore.Flow.Job wraps the raw Flow record returned by flow_claim_due/2. It keeps the raw :record map available while exposing the fields most handlers need directly:

  • :id
  • :type
  • :state
  • :partition_key
  • :lease_token
  • :fencing_token
  • :payload
  • :payload_ref

SDK helpers use these guard fields automatically:

BillingFlow.ok(job, result)
BillingFlow.error(job, reason)
BillingFlow.extend_lease(job, lease_ms: 60_000)

guard_opts/2 adds :partition_key and :fencing_token to command options. lease_guard_opts/2 also adds :lease_token, used by guarded transitions.

The job is not durable state by itself. Durable truth remains the Flow record in FerricStore.

Summary

Types

t()

@type t() :: %FerricStore.Flow.Job{
  fencing_token: non_neg_integer() | nil,
  id: binary(),
  lease_token: binary() | nil,
  partition_key: binary() | nil,
  payload: term(),
  payload_omitted: boolean() | nil,
  payload_ref: binary() | nil,
  payload_size: non_neg_integer() | nil,
  record: map(),
  state: binary(),
  type: binary(),
  workflow: module()
}

Functions

guard_opts(job, opts \\ [])

@spec guard_opts(
  t(),
  keyword()
) :: keyword()

lease_guard_opts(job, opts \\ [])

@spec lease_guard_opts(
  t(),
  keyword()
) :: keyword()

new(workflow, record)

@spec new(module(), map()) :: t()