CouncilEx.Recorder.Ecto (CouncilEx v0.1.0)

Copy Markdown View Source

Default CouncilEx.Recorder implementation backed by Ecto + Postgres.

Persists each run's lifecycle into <prefix>runs and <prefix>run_events. Skips :member_token events by default — token chunks are high volume and the design intentionally keeps them PubSub-only.

Args

Passed via {module, args} in the :recorder option to CouncilEx.start/3. Recognised keys (all optional except :repo):

  • :repo — your application's Ecto.Repo. Required. Falls back to Application.get_env(:council_ex, CouncilEx.Recorder.Ecto)[:repo] if unset in args.

  • :table_prefix — string prefix for the runs and run_events tables. Defaults to "council_ex_".

  • :oban_job_id — bigint. Stored on the run row for forensic lookup. Set automatically by CouncilEx.Workers.Oban.

  • :attempt — integer ≥ 1. Defaults to 1.

  • :parent_attempt_run_id — link to the previous attempt's run id. Set by Worker on retries.

  • :event_filter — controls which events get persisted to run_events. Either:

    • {:exclude, [type, ...]} — persist all except listed types (the default is {:exclude, [:member_token]})
    • {:include, [type, ...]} — persist only the listed types

Failure mode

Recorder crashes do not kill the run (per CouncilEx.Runner.RecorderProcess semantics). If init/2 fails to insert the run row it returns {:stop, reason} — the run still starts but no history is written.

Summary

Types

t()

@type t() :: %CouncilEx.Recorder.Ecto{
  event_filter: term(),
  events_source: term(),
  repo: term(),
  run_id: term(),
  runs_source: term(),
  seq: term()
}