Trellis.SelfCheckJob (Trellis v0.1.0-alpha)

Copy Markdown View Source

A background check of a target table, as Trellis.self_check/3 starts it and Trellis.self_check_job/2 reads it back.

  • id is what Trellis.self_check_job/2 takes.
  • target is the audited target's bare table name.
  • mode is :standard or :strict, as the job was started. A second Trellis.self_check/3 of a target whose job is still running returns that job, so its mode is the first call's.
  • state is :queued (no worker has taken it up yet; with no drain worker anywhere in the fleet it stays so), :running, then :done, :failed (error says why) or :cancelled (the worker running it shut down; error says so). Only :done carries a report.
  • rows_compared counts the distinct keys the pages so far compared; it moves while the job is :running.
  • report is the Trellis.SelfCheckReport, once the job is :done.
  • error says why a :failed or :cancelled job ended.

A job ends when its transform is dropped, and Trellis.self_check_job/2 then returns nil for it.

Summary

Functions

Whether the job has ended, so polling it again changes nothing.

Types

state()

@type state() :: :queued | :running | :done | :failed | :cancelled

t()

@type t() :: %Trellis.SelfCheckJob{
  error: String.t() | nil,
  id: integer(),
  mode: :standard | :strict,
  report: Trellis.SelfCheckReport.t() | nil,
  rows_compared: non_neg_integer(),
  state: state(),
  target: String.t()
}

Functions

finished?(self_check_job)

@spec finished?(t()) :: boolean()

Whether the job has ended, so polling it again changes nothing.