Docket.Postgres.RunCodec (docket v0.1.1)

Copy Markdown View Source

Maps one durable Docket.Run to its Postgres row.

Postgres columns are the sole copy of fields needed for identity, claiming, scheduling, inspection, and constraints. Every other run field is one opaque ETF value in state.

Summary

Types

row_attrs()

@type row_attrs() :: %{
  run_id: String.t(),
  graph_id: String.t(),
  graph_hash: String.t() | nil,
  status: Docket.Run.durable_status(),
  step: non_neg_integer(),
  state: binary(),
  checkpoint_seq: non_neg_integer(),
  started_at: DateTime.t() | nil,
  updated_at: DateTime.t() | nil,
  finished_at: DateTime.t() | nil
}

Functions

dump(run)

@spec dump(Docket.Run.t()) :: {:ok, row_attrs()} | {:error, Docket.Error.t()}

load(row)

@spec load(Docket.Postgres.Schemas.Run.t() | map()) ::
  {:ok, Docket.Run.t()} | {:error, Docket.Error.t()}

load!(row)