ExStorageService.Metadata.Models.Job (ex_storage_service v0.6.2)

Copy Markdown View Source

Typed boundary for one durable, fenced background job.

Concord values are persisted as plain maps so native nested-field comparisons can inspect lease and fencing fields.

Summary

Types

kind()

@type kind() ::
  :repair_blob | :cross_cluster_put | :cross_cluster_delete | :scrub | :cleanup

state()

@type state() :: :pending | :running | :completed | :failed

t()

@type t() :: %ExStorageService.Metadata.Models.Job{
  attempts: non_neg_integer(),
  completed_at_ms: non_neg_integer() | nil,
  created_at_ms: non_neg_integer(),
  fencing_token: non_neg_integer(),
  job_id: binary(),
  kind: kind(),
  last_error: binary() | nil,
  lease_until_ms: non_neg_integer(),
  max_attempts: pos_integer(),
  next_attempt_at_ms: non_neg_integer(),
  operation_id: binary(),
  owner_generation: pos_integer() | nil,
  owner_node: binary() | nil,
  payload: map(),
  schema: 2,
  state: state(),
  updated_at_ms: non_neg_integer()
}

Functions

cast(job)

@spec cast(map() | t()) :: {:ok, t()} | {:error, term()}

kinds()

@spec kinds() :: [kind()]

new(operation_id, event, now_ms, opts \\ [])

@spec new(binary(), map(), non_neg_integer(), keyword()) ::
  {:ok, t()} | {:error, term()}

states()

@spec states() :: [state()]

to_map(job)

@spec to_map(t()) :: map()