Instance-resolved PostgreSQL admission-plan boundary.
Docket.Postgres.RunStore.claim_due/3 is the sole admission entrypoint and
the sole executor of policy plans. A selected implementation receives
normalized policy values and pre-quoted identifiers, builds one data-only
SQL plan, decodes that statement's rows, and owns its bounded admission
observations. A policy may also implement one narrow startup configuration
callback. Plan construction never receives a run-store module or query
callback.
Summary
Types
@type claim_result() :: {:ok, claim_batch()} | {:error, term()}
@type runtime_input() :: %{ :now => DateTime.t(), :limit => pos_integer(), :orphan_ttl_ms => non_neg_integer(), :max_claim_attempts => pos_integer(), optional(:preference) => :ready | :expired | nil }
@opaque t()
Callbacks
@callback build_plan(plan_context(), runtime_input(), state :: term()) :: Docket.Postgres.ClaimPolicy.Plan.t()
@callback init( keyword(), init_context() ) :: {:ok, state :: term()} | {:error, term()}
@callback observe( plan_observation :: map(), decoded_observation :: map() | nil, claim_result(), duration :: integer(), state :: term() ) :: :ok