GeoGenius.Registration (geo_genius v0.2.0)

Copy Markdown View Source

Translates the catalog's exact-candidate lifecycle decision into the public Elixir result vocabulary.

Registration and run claiming are one database statement. The statement has committed before this module returns, so callers may enqueue only an :enqueue result without exposing partially registered catalog state.

Summary

Functions

Atomically registers one exact manifest or diagnoses its existing import attempt.

Atomically replaces one failed latest attempt with an exact corrected manifest.

Types

accepted()

@type accepted() :: %{
  run_id: Ecto.UUID.t(),
  release_id: Ecto.UUID.t(),
  attempt: pos_integer(),
  reason: accepted_reason()
}

accepted_reason()

@type accepted_reason() :: :registered | :retried | :same_owner | :completed

result()

@type result() ::
  {:enqueue, accepted()}
  | {:existing, accepted()}
  | {:error, GeoGenius.CandidateError.t()}

Functions

prepare_import(context, manifest, claim)

@spec prepare_import(GeoGenius.Context.t(), GeoGenius.Manifest.t(), map()) :: result()

Atomically registers one exact manifest or diagnoses its existing import attempt.

retry_failed(context, failed_run_id, manifest, claim)

@spec retry_failed(
  GeoGenius.Context.t(),
  Ecto.UUID.t(),
  GeoGenius.Manifest.t(),
  map()
) :: result()

Atomically replaces one failed latest attempt with an exact corrected manifest.